-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-stxeco.sh
executable file
·76 lines (69 loc) · 2.43 KB
/
deploy-stxeco.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash -e
#
############################################################
export SERVICE=$1
export DEPLOYMENT=$2
export PORT=22
export SERVER=popper.brightblock.org
if [ "$DEPLOYMENT" == "prod" ]; then
SERVER=chomsky.brightblock.org;
PORT=7019
fi
export DOCKER_ID_USER='mijoco'
export DOCKER_COMPOSE_CMD='docker-compose'
export DOCKER_CMD='docker'
if [ -z "${SERVICE}" ]; then
mvn -f ./stxeco-api/pom.xml -Dmaven.test.skip=true clean install
docker-compose build
$DOCKER_CMD tag mijoco/stxeco_express mijoco/stxeco_express
$DOCKER_CMD tag mijoco/stxeco_api mijoco/stxeco_api
$DOCKER_CMD push mijoco/stxeco_express:latest
$DOCKER_CMD push mijoco/stxeco_api:latest
fi
if [ "$SERVICE" == "stxeco_express" ]; then
docker-compose build stxeco_express
$DOCKER_CMD tag mijoco/stxeco_express mijoco/stxeco_express
$DOCKER_CMD push mijoco/stxeco_express:latest
fi
if [ "$SERVICE" == "stxeco_api" ]; then
mvn -f ./stxeco-api/pom.xml -Dmaven.test.skip=true clean install
docker-compose build
$DOCKER_CMD tag mijoco/stxeco_api mijoco/stxeco_api
$DOCKER_CMD push mijoco/stxeco_api:latest
fi
if [ "$SERVICE" == "stacks_voice_express" ]; then
mvn -f ./stxeco-api/pom.xml -Dmaven.test.skip=true clean install
docker-compose build stacks_voice_express
$DOCKER_CMD tag mijoco/stacks_voice_express mijoco/stacks_voice_express
$DOCKER_CMD push mijoco/stacks_voice_express:latest
fi
echo --- stxeco:copying to [ $PATH_DEPLOY ] --------------------------------------------------------------------------------;
printf "\n\n Connectiong to $SERVER.\n"
if [ -z "${SERVICE}" ]; then
ssh -i ~/.ssh/id_rsa -p $PORT bob@$SERVER "
cd /home/bob/hubgit/stxeco-server
# git pull
# cp .env.production .env
cat .env
docker login
. ~/.profile
docker compose -f docker-compose-images.yml pull
docker compose -f docker-compose-images.yml down
docker compose -f docker-compose-images.yml up -d
";
else
ssh -i ~/.ssh/id_rsa -p $PORT bob@$SERVER "
cd /home/bob/hubgit/stxeco-server
cat .env
docker login
. ~/.profile
docker compose -f docker-compose-images.yml pull
docker compose -f docker-compose-images.yml stop $SERVICE
docker compose -f docker-compose-images.yml rm $SERVICE
docker compose -f docker-compose-images.yml create $SERVICE
docker compose -f docker-compose-images.yml start $SERVICE
";
fi
printf "Finished....\n"
printf "\n-----------------------------------------------------------------------------------------------------\n";
exit 0;