git clone git@github.com.....
cd script-template-ts
yarn install
cp .env.example .env
# Update .env content
# Setup other secret configs as well
- Normal mode - without monitor
yarn start
- Monitor mode
yarn start:dev
yarn build
- Run test
yarn test
- Run test coverage
yarn test:cov
# Set timezone
sudo timedatectl set-timezone Asia/Ho_Chi_Minh
timedatectl
sudo apt install zip unzip
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install --global yarn
sudo npm install --global pm2
pm2 install pm2-logrotate
pm2 set pm2-logrotate:max_size 10M
pm2 set pm2-logrotate:compress true
pm2 set pm2-logrotate:retain 10
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
COPY public content and register to git provider to allow clone repo with ssh
# New terminal session
[from main] tmux
# Attach tmux session
[from main] tmux a
[from main] tmux a -t sessionId
# Detach tmux session
[from tmux session] Ctrl + B + D
# Kill tmux session
[from tmux session] exit
[from main] tmux kill-ses -t sessionId
# Start App
pm2 --name thescript start npm -- run start:prod
pm2 monit
pm2 reload thescript --update-env
# Start
pm2 start pm2.config.js
# Reload
pm2 reload pm2.config.js
# Delete
pm2 delete pm2.config.js