forked from ro31337/libretaxi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·25 lines (25 loc) · 1.04 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
#
# Lazy deploy script.
# Author: Roman Pushkin
#
# 1. Attach to remote hostname and execute ~/redeploy-libretaxi.sh (see below):
# 2. Kill all "node" processes with args containing "libretaxi".
# Sends SIGTERM, which is handled by application, so it's OK to kill app this way.
# 3. Sleep for 5 seconds
# 4. Kill tmux session if any
# 5. Sleep for 1 second
# 6. Create new tmux session with the following commands:
# a) change to project directory (~/work/libretaxi)
# b) git pull
# c) npm install
# d) npm run telegram
# 7. Show "OK deployed message" if everything's OK (you may see some tmux warnings though).
#
# Attach to tmux on your host: tmux attach
# Detach from the session: Ctrl+b, d
#
# ~/redeploy-libretaxi.sh:
# (pkill -f "node.*libretaxi" | true) && sleep 5 && (tmux kill-session -t "bot" | true) && sleep 1 && tmux new-session -s "bot" -n "Prod-bot" -d "cd ~/work/libretaxi/ && git pull && npm i && (while true;do sleep 2 && npm run telegram;done);bash" && echo OK deployed
#
ssh [email protected] -t "~/redeploy-libretaxi.sh"