This guide is intended for deployment testing purposes & it uses the Root user. Creating a new user is strongly suggested for a production setup.
ssh root@enter.CCdotCom.IP.address
- Enter the password provided by Vultr on the CCdotCom server page & follow all prompts until connected.
sudo apt update && sudo apt upgrade -y
sudo ufw enable
sudo ufw status
- It should display that the UFW Firewall is active.
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
- Restart the CCdotCom server then reconnect via SSH (repeat step 2).
sudo reboot
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install nodejs
npm --version
- The NPM version should be displayed.
node --version
- The Node version should be displayed.
cd ~/
mkdir superkloklabs
cd superkloklabs
git clone https://github.com/Superklok/CurrentCourantDotCom.git
cd CurrentCourantDotCom/v1.x.x/
npm i
npm i pm2 -g
- Set environment variables:
cd ~/
nano .bashrc
- Add the following to the top of the file:
export CLOUDINARY_CLOUD_NAME="YourCloudinaryCloudName"
export CLOUDINARY_KEY="YourCloudinaryKey"
export CLOUDINARY_SECRET="YourCloudinarySecret"
export SESSION_SECRET="YourSessionSecret"
export AUTHOR_CODE="YourAuthorCode"
export DB_URL="YourMongoDatabaseURL"
export PORT="ThePortCCdotComIsRunningOn"
export NODE_ENV="production"
- Press ctrl+x & save changes, then refresh the user environment:
source .bashrc
- Double check that the new environment variables have been set correctly.
env
- Then start the app in cluster mode:
cd superkloklabs/CurrentCourantDotCom/v1.x.x/
pm2 start app.js --name "CCdotCom" -i max
pm2 startup ubuntu
pm2 save
sudo apt install nginx
sudo nano /etc/nginx/sites-available/default
- Add the following to the location part of the server block:
server_name yourwebsite.com www.yourwebsite.com;
location / {
proxy_pass http://localhost:ThePortCCdotComIsRunningOn;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
- Press ctrl+x & save changes.
- Check NGINX config:
sudo nginx -t
- Restart NGINX:
sudo service nginx restart
11. Update your DNS "A" records for "yourwebsite.com" & "www.yourwebsite.com" with the CCdotCom server IP address.
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --nginx -d yourwebsite.com -d www.yourwebsite.com
- Enter your@email.com for the email address it requests, & select (y)es, then (n)o.
- Test the 90 day renewal process:
certbot renew --dry-run
- Test the PM2 startup script by restarting the CCdotCom server:
sudo reboot
- Then reconnect to the CCdotCom server via SSH (repeat step 2).
- Check PM2 to make sure CCdotCom is still running in cluster mode:
pm2 status
- Logout of SSH:
exit