All credits go to: https://github.com/cedricpinson/globetweeter
- Configure pooling correctly: knex/knex#2820 (comment) e.g.
"pool": {
"min": 2,
"max": 6,
"createTimeoutMillis": 3000,
"acquireTimeoutMillis": 30000,
"idleTimeoutMillis": 30000,
"reapIntervalMillis": 1000,
"createRetryIntervalMillis": 100,
"propagateCreateError": false // <- default is true, set to false
},
npm i
cd ~/apps
git clone https://github.com/umaar/wiki-globe
cd wiki-globe
npm i
npm run start-production-process
location /globe {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_pass http://127.0.0.1:<PORT_HERE>;
}
cd ~/apps/wiki-globe/
git fetch origin master
git reset --hard origin/master
npm i
npm run stop-production-process
npm run start-production-process
touch ~/development/wiki-globe/config/default.json && jq -s add ~/development/wiki-globe/config/default.json ~/.wiki-globe.json > ~/development/wiki-globe/__tmp__config.json && cp ~/development/wiki-globe/__tmp__config.json ~/development/wiki-globe/config/default.json && rm ~/development/wiki-globe/__tmp__config.json
cp ~/.wiki-globe-production.json ~/apps/wiki-globe/config/production.json
A detached process is spawned by the server. Killing the main parent process with the process manager can also kill detached child processes in the same parent tree. Use the --no-treekill
to avoid this issue, or, simply use pm2 restart
instead of explicitly stopping and starting the process.
pm2 startup
# follow instructions of the above command
pm2 save