Skip to content

Commit 6791644

Browse files
author
matthias_schaub
committed
deploy.sh now runs ansible cmd. Travis will only run deploy when on branch dev. Docker recreate commands are now in recreate_container.sh.
1 parent ea5e3c9 commit 6791644

File tree

4 files changed

+32
-22
lines changed

4 files changed

+32
-22
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,10 @@ after_success:
4848
- openssl aes-256-cbc -K $encrypted_c17fa81e6490_key -iv $encrypted_c17fa81e6490_iv -in travis/ssh-private-key.enc -out travis/ssh-private-key -d
4949
- chmod 600 travis/ssh-private-key
5050
- ssh-add travis/ssh-private-key
51-
- ansible-playbook -i ansible/inventory.yml ansible/playbook.yml # Deploy to dev server
51+
- chmod +x deploy.sh
52+
53+
deploy:
54+
provider: script
55+
script: bash deploy.sh
56+
on:
57+
branch: dev

ansible/playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
dest: /home/mapswipe/python-mapswipe-workers
1010
version: dev
1111
- name: Rebuild and restart Docker container usind Docker-Compose.
12-
script: /home/mapswipe/python-mapswipe-worker/deploy.sh
12+
script: /home/mapswipe/python-mapswipe-worker/recreate_container.sh

deploy.sh

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
11
#!/bin/bash
2-
# This script builds and starts all Docker container for running the Mapswipe ecosystem.
3-
# It is run either manually or by an Ansible Playbook after a successful Travis build.
4-
5-
# docker-compose build --no-cache postgres firebase_deploy mapswipe_workers manager_dashboard nginx api
6-
docker-compose build --no-cache postgres mapswipe_workers manager_dashboard nginx api
7-
if [[ $? = 0 ]]; then
8-
echo "success"
9-
else
10-
echo "failure: $?"
11-
exit
12-
fi
13-
14-
# docker-compose up -d --force-recreate postgres firebase_deploy mapswipe_workers manager_dashboard nginx api
15-
docker-compose up -d --force-recreate postgres mapswipe_workers manager_dashboard nginx api
16-
if [[ $? = 0 ]]; then
17-
echo "success"
18-
else
19-
echo "failure: $?"
20-
exit
21-
fi
2+
# Deploy to dev server.
3+
# This script is called by Travis.
4+
ansible-playbook -i ansible/inventory.yml ansible/playbook.yml

recreate_container.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# This script builds and starts all Docker container for running the Mapswipe ecosystem.
3+
# It is run either manually or by an Ansible Playbook after a successful Travis build.
4+
5+
# docker-compose build --no-cache postgres firebase_deploy mapswipe_workers manager_dashboard nginx api
6+
docker-compose build --no-cache postgres mapswipe_workers manager_dashboard nginx api
7+
if [[ $? = 0 ]]; then
8+
echo "success"
9+
else
10+
echo "failure: $?"
11+
exit
12+
fi
13+
14+
# docker-compose up -d --force-recreate postgres firebase_deploy mapswipe_workers manager_dashboard nginx api
15+
docker-compose up -d --force-recreate postgres mapswipe_workers manager_dashboard nginx api
16+
if [[ $? = 0 ]]; then
17+
echo "success"
18+
else
19+
echo "failure: $?"
20+
exit
21+
fi

0 commit comments

Comments
 (0)