Built with Node | NestJS 8.
Install the following
NodeJS Version : v19.x.x
YARN Version : 1.x.x
Access to the repository should be requested. Then clone "new-era-be"
rename ".env-backend-prod" to ".env"
env can be requested and downloaded here (a password is required).
~~~~~~~~~~~
Added setup for production server
ecosystem.config.js
```
module.exports = {
apps: [
{
name: 'be:3001',
exec_mode: 'cluster',
instances: '1',
script: './dist/src/main.js',
"env": {
"PORT": "3001",
}
}
]
}
```
Automate "Vip of the month"
# Use root account
crontab -u webapp -e
```
@reboot pm2 resurrect
0 0 1 * * curl -X POST 'http://localhost:3001/vipmonths/assign' # PROD
0 0 1 * * curl -X POST 'http://localhost:4001/vipmonths/assign' # QAT
```
Connect to the backend server using web dashboard or ssh.
# make sure you're in "webapp" user using "whoami"
# to use webapp user use command below
$ su - webapp
Go to the root folder of the project "new-era-be".
$ cd /home/webapp/new-era-be # or cd ~/new-era-be
Execute the following command on the terminal:
$ git pull
$ yarn
$ yarn run build
$pm2 update
# You can use the 1 liner command
$ git pull && yarn && yarn run build && pm2 update
Make sure the projects are in the correct branch | https://vip.neweracap.ph is using the "develop" branch