This is a Next.js project bootstrapped with create-next-app
.
Install dependencies and run the development server:
yarn install
yarn dev
Open http://localhost:3000 with your browser to see the result.
Build the production application in the .next
folder, then start the application in production mode:
yarn build
yarn start
Open http://localhost:3000 with your browser to see the result.
To change ports, use yarn start -p <PORT>
.
Setup PM2 (first time only):
# install pm2
npm i -g pm2
# add host to ssh config
vi ~/.ssh/config
# Add:
# Host switcheo-website
# User ubuntu
# Hostname 13.251.197.177
Deploy using PM2:
pm2 deploy ecosystem.config.js production
SSH into the prod instance and deploy using PM2:
ssh switcheo-website
cd /var/www/switcheo-website/current
git pull
yarn build
PM2_NAME=production pm2 startOrRestart ecosystem.config.js --env production