Full Deployment Cycle
Pre VM Tasks
- Create Auth0 Applications. Create the 2 Tenants(development and production).
- Create database with proper IP whitelisting as mentioned here
VM Install
There are a few packages/things to install.
Node js
PM2
This will require node js to be installed. PM2 is a node js package that runs the node server in the background
Log Folder
Looking at src/dashboard/ecosystem.config.js
Log files will be created at ../../../../pm2Logs/${timestamp}/
where timestamp
is month-day-year_hour.minutes.seconds
. Please make sure to create the folder ../../../../pm2Logs/
. PM2 will do the rest.
Code-Server
Optional
Found here. Basically run the commands
And then set up the config in /home/YOUR_USER_NAME/.config/code-server
. Mine looks like
Make sure the port is setup in the firewall
Jpegoptim
repo and
usage.
The rest of the jpegoptim stuff is handled by the bash scripts in Coastal-Image-Labeler\src\cli\bash
NGINX
This is a reverse proxy that runs on ports 80 and 443 and redirects traffic to the node server so that it doesnt have to run in sudo mode.
Check to see its running with
Certbot
VM Setup
- Setup NGINX here and Certbot here
- Go to
Coastal-Image-Labeler/src/dashboard
and install dependencies withnpm install
- Create the
.env.*.local
files like here, get their values like here. - Run the server with
npm run pm2
which will build and start the site in production mode. If need to run the site in development mode, runnpm run dev
.
As a note, sudo pm2 list
will show all pm2 processes. To stop/delete the server type
so that next time theres a clean restart.
Restarting Server With New Changes
After running git pull
you can simply run
which will end the current pm2 process (stops and deletes) and then builds and starts the site/server.