-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modify appspec and add a docker-compose for dev
- Loading branch information
Showing
5 changed files
with
42 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ Dockerfile | |
*.log | ||
.env | ||
docker-compose.yml | ||
rust-toolchain | ||
docker-compose.dev.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: '3' | ||
|
||
services: | ||
web: | ||
build: . | ||
depends_on: | ||
- nats | ||
env_file: .env | ||
ports: | ||
- "8000:${PORT:-8000}" | ||
|
||
nats: | ||
image: nats:2.6.0-alpine | ||
ports: | ||
- "4222:4222" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# !/bin/bash | ||
for container_id in `docker ps --format "table {{.ID}} {{.Names}} {{.CreatedAt}}" | grep web | awk -F " " '{print $1}'` | ||
#!/usr/bin/env bash | ||
container_id="" | ||
for id in `docker ps --format "table {{.ID}} {{.Names}} {{.CreatedAt}}" | grep web | awk -F " " '{print $1}'` | ||
do | ||
container_ids+=($container_id) | ||
container_id="$id" | ||
done | ||
docker-compose up -d --build --no-deps --scale web=2 --no-recreate server | ||
echo "found running web container: $container_id" | ||
echo "scaling web to 2 containers" | ||
docker-compose up -d --build --no-deps --scale web=2 --no-recreate web | ||
sleep 10 | ||
for container_id in "${container_ids[@]}" | ||
do | ||
docker kill -s SIGTERM $container_id | ||
done | ||
echo "killing container $container_id" | ||
docker kill -s SIGTERM $container_id | ||
sleep 1 | ||
for container_id in "${container_ids[@]}" | ||
do | ||
docker rm -f $container_id | ||
done | ||
echo "removing container $container_id" | ||
docker rm -f $container_id | ||
sleep 1 | ||
docker-compose up -d --no-deps --scale web=1 --no-recreate server | ||
echo "scaling back down to one container" | ||
docker-compose up -d --no-deps --scale web=1 --no-recreate web |