forked from artcom/eppsa-ksm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·28 lines (28 loc) · 996 Bytes
/
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
26
27
28
#!/bin/bash
set -e
ssh -o StrictHostKeyChecking=no -p $SSH_PORT $SSH_USER@$SSH_HOST << EOF
if ! grep -q "HOST=$HOST" /etc/environment; then
echo "Setting HOST in environment"
echo "HOST=$HOST" | sudo tee --append /etc/environment > /dev/null
fi;
if ! grep -q "CERTIFICATE_PATH=$CERTIFICATE_PATH" /etc/environment; then
echo "Setting CERTIFICATE_PATH in environment"
echo "CERTIFICATE_PATH=$CERTIFICATE_PATH" | sudo tee --append /etc/environment > /dev/null
fi;
echo "HOST=$HOST"
echo "CERTIFICATE_PATH=$CERTIFICATE_PATH"
sudo systemctl stop eppsa-ksm
cd eppsa-ksm
docker-compose rm -f
cd /home/$SSH_USER
rm -rf eppsa-ksm
git clone https://github.com/artcom/eppsa-ksm.git
cd eppsa-ksm
grep path .gitmodules | sed 's/.*= //' | xargs rm -rf
git checkout -b $GIT_BRANCH
git submodule init
git submodule update --recursive
./build.sh
docker-compose -f docker-compose.yml -f docker-compose.production.yml build
sudo systemctl start eppsa-ksm
EOF