-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·45 lines (33 loc) · 1.6 KB
/
deploy.sh
File metadata and controls
executable file
·45 lines (33 loc) · 1.6 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
function deploy_to_host() {
DOCKERHOST=$1
echo ""
echo "================= Processing host ${DOCKERHOST}"
#read -rsp $'Press any key to continue...\n' -n1 key
echo "Stop docker:"
ssh -f root@$DOCKERHOST 'cd /home/checkemail/docker-compose; sudo -u checkemail docker-compose down'
echo "Update docker from GIT"
ssh -f root@$DOCKERHOST 'su checkemail; cd /home/checkemail/docker-compose; git fetch --all; git reset --hard origin/master' 2>&1
#read -rsp $'Press any key to continue...\n' -n1 key
echo "Copy environment vars"
scp web-variables.env root@$DOCKERHOST:/home/checkemail/docker-compose/
#read -rsp $'Press any key to continue...\n' -n1 key
echo "Copy entrypoint script"
scp entrypoint.sh root@$DOCKERHOST:/home/checkemail/docker-compose/
#read -rsp $'Press any key to continue...\n' -n1 key
echo "Update PHP sources:"
ssh -f root@$DOCKERHOST 'cd /home/checkemail; sudo -u checkemail hg pull; sudo -u checkemail hg update'
#read -rsp $'Press any key to continue...\n' -n1 key
echo "Update docker images"
ssh -f root@$DOCKERHOST 'docker pull iordachej/php:7.2-fpm-alpine3.7-sf4'
#read -rsp $'Press any key to continue...\n' -n1 key
echo "Run docker:"
ssh -f root@$DOCKERHOST 'cd /home/checkemail/docker-compose; sudo -u checkemail docker-compose up -d'
#read -rsp $'Press any key to FINISH...\n' -n1 key
}
while IFS='' read -r line || [[ -n "$line" ]]; do
#echo "Text read from file: $line"
[ -z "$line" ] && continue
deploy_to_host $line
#read -rsp $'Press any key to continue...\n' -n1 key
done < "$1"