-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add govtool stack and update configs
- Loading branch information
Showing
8 changed files
with
143 additions
and
33 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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
secrets/ | ||
configs/ | ||
docker-compose-rendered.yml | ||
docker-compose-swarm-rendered.yml | ||
docker-compose-services-rendered.yml | ||
/*-rendered.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
export BASE_IMAGE_NAME="govtool" | ||
# build the base image | ||
docker build -t "$BASE_IMAGE_NAME"/backend-base -f ../../govtool/backend/Dockerfile.base ../../govtool/backend | ||
docker compose -f ./docker-compose-govtool.yml build | ||
docker compose -f ./docker-compose.yml build |
13 changes: 13 additions & 0 deletions
13
tests/test-infrastructure/configs_template/backend_config.json
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,13 @@ | ||
{ | ||
"dbsyncconfig" : { | ||
"host" : "postgres", | ||
"dbname" : "${DBSYNC_DATABASE}", | ||
"user" : "postgres", | ||
"password" : "${POSTGRES_PASSWORD}", | ||
"port" : 5432 | ||
}, | ||
"port" : 8080, | ||
"host" : "0.0.0.0", | ||
"cachedurationseconds": 20, | ||
"sentrydsn": "https://username:password@senty.host/id" | ||
} |
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,51 @@ | ||
version: "3.9" | ||
networks: | ||
frontend: | ||
external: true | ||
postgres: | ||
external: true | ||
configs: | ||
config.json: | ||
name: govtool_backend_config.json | ||
external: true | ||
services: | ||
backend: | ||
image: govtool/backend | ||
build: | ||
context: ../../govtool/backend | ||
args: | ||
BASE_IMAGE_TAG: govtool/backend-base | ||
entrypoint: | ||
- sh | ||
- -c | ||
- vva-be -c /config.json start-app | ||
environment: | ||
VIRTUAL_HOST: https://${BASE_DOMAIN} -> :8080 | ||
VIRTUAL_HOST_2: https://${BASE_DOMAIN}/swagger -> :8080/swagger | ||
VIRTUAL_HOST_3: https://${BASE_DOMAIN}/api/ -> :8080/ | ||
|
||
networks: | ||
- frontend | ||
- postgres | ||
configs: | ||
- config.json | ||
deploy: | ||
restart_policy: | ||
delay: "30s" | ||
placement: | ||
constraints: | ||
- node.labels.govtool==true | ||
frontend: | ||
image: govtool/frontend | ||
build: | ||
context: ../../govtool/frontend | ||
environment: | ||
VIRTUAL_HOST: https://${BASE_DOMAIN} | ||
networks: | ||
- frontend | ||
deploy: | ||
restart_policy: | ||
delay: "30s" | ||
placement: | ||
constraints: | ||
- node.labels.govtool==true |
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
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,47 @@ | ||
#!/bin/bash | ||
## Docker swarm doesn't read .env file. | ||
## This script reads env file and variables | ||
## and apply them to compose file and | ||
## then execute `docker stack deploy` | ||
|
||
set -eo pipefail | ||
|
||
function load_env(){ | ||
set -a | ||
. ./.env | ||
set +a | ||
} | ||
|
||
function help_deploy(){ | ||
echo "Something is wrong with the command" | ||
echo | ||
echo " Usage:" | ||
echo " $0 [stack-name] [filename]" | ||
echo | ||
} | ||
|
||
function deploy-stack(){ | ||
## apply the environment to compose file | ||
## deploy the govtool test infrastructure stack | ||
## first argument is stack name and 2nd argument is the file name | ||
STACK_NAME=$1 | ||
COMPOSE_FILE=$2 | ||
FILENAME=$(basename -- "$COMPOSE_FILE") | ||
EXTENSION="${FILENAME##*.}" | ||
FILENAME_WITHOUT_EXT="${FILENAME%.*}" | ||
RENDERED_FILENAME="${FILENAME_WITHOUT_EXT}-rendered.${EXTENSION}" | ||
envsubst < "$COMPOSE_FILE" > "$RENDERED_FILENAME" | ||
echo docker stack deploy -c "$RENDERED_FILENAME" ${STACK_NAME} | ||
} | ||
|
||
|
||
if [ "$#" -eq 0 ]; then | ||
exit 0 | ||
elif [ "$#" -ne 2 ]; | ||
then | ||
help_deploy | ||
exit 1 | ||
else | ||
load_env | ||
deploy-stack "$1" "$2" | ||
fi |