Skip to content

Commit

Permalink
add code deploy app spec and deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
aryan9600 committed Sep 23, 2021
1 parent b567be7 commit b7d808c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions appspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 0.0
os: linux
files:
- source: /
destination: /opt/kv-store
hooks:
ApplicationStart:
- location: scripts/deploy.sh
timeout: 300
runas: root
18 changes: 18 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# !/bin/bash
for container_id in `docker ps --format "table {{.ID}} {{.Names}} {{.CreatedAt}}" | grep web | awk -F " " '{print $1}'`
do
container_ids+=($container_id)
done
docker-compose up -d --build --no-deps --scale web=2 --no-recreate server
sleep 10
for container_id in "${container_ids[@]}"
do
docker kill -s SIGTERM $container_id
done
sleep 1
for container_id in "${container_ids[@]}"
do
docker rm -f $container_id
done
sleep 1
docker-compose up -d --no-deps --scale web=1 --no-recreate server

0 comments on commit b7d808c

Please sign in to comment.