Deployment on local machine & exposure via NGINX.
In this guide we use Rocky Linux (similar as Red Hat Enterprise Linux).
-
NGINX server enabled:
sudo dnf install -y nginx sudo systemctl enable --now nginx
Disclaimer: In this guide, we assume that the current user name is tal
.
-
Clone the NextStep Repository:
git clone git@github.com:NextStepFinalProject/NextStep.git && cd NextStep
Edit the
nextstep-backend/.env
, andnextstep-frontend/.env
files:In the
nextstep-backend/.env
, setup:FRONTEND_URL=http://nextstep.theworkpc.com:1785
In the
nextstep-frontend/.env
, setup:VITE_DOMAIN_NAME=0.0.0.0 VITE_ALLOWED_HOSTS=nextstep.theworkpc.com
-
Setup build of frontend:
cd nextstep-frontend npm i npm run build
Done. Step out from the NextStep directory:
cd ../..
-
Clone this repository:
git clone git@github.com:NextStepFinalProject/NextStep-DevOps.git && NextStep-DevOps
-
Setup local deployment via systemd files:
Edit the linux backend service to your environment (i.e. user name, npm path, working directory).
Then, install the backend service:
sudo cp linux/nextstep-backend.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable --now nextstep-backend.service
-
Setup nginx configuration:
Edit the nginx.conf file to your environment (i.e. user name, build files path).
Then, add the
nginx
user to thetal
group:sudo usermod -a -G tal nginx
Give execute permissions to
tal
group:chmod g+x /home/tal chmod g+x /home/tal/Code chmod g+x /home/tal/Code/NextStep chmod g+x /home/tal/Code/NextStep/nextstep-frontend chmod -R g+rx /home/tal/Code/NextStep/nextstep-frontend/dist
Confirm
nginx
is in thetal
group:id nginx
Test that the
index.html
file can be accesses by thenginx
user:sudo -u nginx cat /home/tal/Code/NextStep/nextstep-frontend/dist/index.html
Apply the configuration, and restart nginx:
sudo cp nginx/nginx.conf /etc/nginx/nginx.conf sudo systemctl restart nginx
-
The nextstep frontend application will be exposed to the world in http://nextstep.theworkpc.com:1785
-
The nextstep backend application will be exposed to the world in http://backend.nextstep.theworkpc.com:1785