-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-deploy.sh
More file actions
executable file
·56 lines (41 loc) · 2.06 KB
/
docker-deploy.sh
File metadata and controls
executable file
·56 lines (41 loc) · 2.06 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
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
REMOTE='{{ssh_production}}'
REMOTE_DEVELOPMENT='{{ssh_development}}'
DOCKER_COMPOSE_DEVELOPMENT='docker-compose-development.yml'
DOCKER_COMPOSE='docker-compose.yml'
ENV_FILE='./.env'
NGINX_CONF='./configurations'
if [ "$1" != "" ]; then
DEFAULT_PEM_PATH=$1
else
DEFAULT_PEM_PATH='ssh/app-keypair.pem'
DEVELOPMENT_PEM_PATH=$DEFAULT_PEM_PATH
fi
# the production deployment script is commented out for now.
# you can remove the comments while pushing this thing on the production servers.
# push the production data first
# echo $DEFAULT_PEM_PATH
# echo "Pushing the docker-compose-production.yml on server"
# # push the single compose file
# scp -i $DEFAULT_PEM_PATH $DOCKER_COMPOSE $REMOTE:~/docker-compose.yml
# echo "Pushing the environment files to server"
# scp -i $DEFAULT_PEM_PATH $ENV_FILE $REMOTE:~/
# # scp -i $DEFAULT_PEM_PATH $ENV_PROD $REMOTE:~/
# echo "Push the nginx configurations"
# scp -r -i $DEFAULT_PEM_PATH $NGINX_CONF $REMOTE:~/
# # run the docker-compose up command to run the docker apps
# ssh -i $DEFAULT_PEM_PATH $REMOTE "sudo docker-compose pull"
# ssh -i $DEFAULT_PEM_PATH $REMOTE "sudo docker-compose down"
# ssh -i $DEFAULT_PEM_PATH $REMOTE "sudo docker-compose -f docker-compose.yml up -d --force-recreate --remove-orphans"
# echo "Success pushing the docker compose files to production HAB aws server."
# push the development data on aws server
echo "Pushing the docker-compose.yml on development server"
scp -i $DEVELOPMENT_PEM_PATH $DOCKER_COMPOSE_DEVELOPMENT $REMOTE_DEVELOPMENT:~/docker-compose.yml
echo "Pushing the environment files to server"
scp -i $DEVELOPMENT_PEM_PATH $ENV_FILE $REMOTE_DEVELOPMENT:~/
echo "Push the nginx configurations"
scp -r -i $DEVELOPMENT_PEM_PATH $NGINX_CONF $REMOTE_DEVELOPMENT:~/
# the docker-compose up command to run the docker apps
ssh -i $DEVELOPMENT_PEM_PATH $REMOTE_DEVELOPMENT "sudo docker-compose pull"
ssh -i $DEVELOPMENT_PEM_PATH $REMOTE_DEVELOPMENT "sudo docker-compose down"
ssh -i $DEVELOPMENT_PEM_PATH $REMOTE_DEVELOPMENT "sudo docker-compose -f docker-compose.yml up -d --force-recreate --remove-orphans"