Skip to content

Commit

Permalink
Separate out individual stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
mesudip committed May 7, 2024
1 parent 1152f70 commit db8bcef
Show file tree
Hide file tree
Showing 6 changed files with 251 additions and 241 deletions.
23 changes: 12 additions & 11 deletions tests/test-infrastructure/deploy-swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,32 @@ elif [ "$1" == "prepare" ]
then
## apply the enviroment to services compose file
## and deploy the stack
deploy-stack ${STACK_NAME}-services './docker-compose-services.yml'
deploy-stack ${STACK_NAME}-services './docker-compose-basic-services.yml'

elif [ "$1" == "finalize" ]
then
## apply the environment to compose file
## deploy the govtool test infrastructure stack
deploy-stack ${STACK_NAME}-base './docker-compose.yml'
deploy-stack ${STACK_NAME}-base './docker-compose-cardano.yml'
elif [ "$1" == 'stack' ]
then
if [ "$#" -ne 2 ]
then
echo 'stack requires the stack name "govtool" | "services" | "test"'
else
case "$2" in
govtool)
deploy-stack ${STACK_NAME} './docker-compose.yml'
;;
services)
deploy-stack ${STACK_NAME}-services './docker-compose.yml'
;;
base)
deploy-stack ${STACK_NAME}-base './docker-compose.yml'
all)
for DEPLOY_STACK in "basic-services" "cardano" "govaction-loader" "govtool" "test"; do
deploy-stack $DEPLOY_STACK "docker-compose-$DEPLOY_STACK.yml"
done
;;
*)
echo 'Invalid stack name. Valid options are "base", "services", or "govtool"'
if [[ ! -f ./"docker-compose-$2.yml" ]]
then
echo "Invalid stack name. $2"
else
deploy-stack $2 "docker-compose-$2.yml"
fi
;;
esac
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@ configs:
external: true
name: ${STACK_NAME}_postgres_db_setup.sql

### secrets and configs in docker compose
# secrets:
# postgres_user:
# file: "./secrets/${STACK_NAME}_postgres_user"
# postgres_password:
# file: "./secrets/${STACK_NAME}_postgres_password"
# configs:
# postgres_db_setup.sql:
# file: "./configs/${STACK_NAME}_postgres_db_setup.sql"
volumes:
postgres:
nginx_dhparam:
Expand Down
102 changes: 102 additions & 0 deletions tests/test-infrastructure/docker-compose-cardano.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
version: "3.9"
secrets:
postgres_user:
external: true
name: ${STACK_NAME}_postgres_user
postgres_password:
external: true
name: ${STACK_NAME}_postgres_password
dbsync_database:
external: true
name: ${STACK_NAME}_dbsync_database

volumes:
node_data:
node_ipc:
dbsync_data:

networks:
postgres:
external: true
frontend:
external: true
cardano:
attachable: true
name: cardano

services:
cardano-node:
image: ghcr.io/intersectmbo/cardano-node:8.10.0-pre
environment:
NETWORK: sanchonet
volumes:
- node_data:/data
- node_ipc:/ipc
stop_grace_period: 1m
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
ports:
- target: 3001
published: 30004
protocol: tcp
mode: host
deploy:
placement:
constraints:
- node.labels.blockchain== true
restart_policy:
condition: on-failure
delay: 15s
dbsync:
image: ghcr.io/intersectmbo/cardano-db-sync:sancho-4-2-1
networks:
- postgres
environment:
NETWORK: sanchonet
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
DISABLE_CACHE: ""
DISABLE_LEDGER: ""
DISABLE_EPOCH: ""
secrets:
- postgres_user
- source: dbsync_database
target: postgres_db
- postgres_password
volumes:
- dbsync_data:/var/lib/cexplorer
- node_ipc:/node-ipc
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
deploy:
labels:
"co_elastic_logs/enable": "false"
placement:
constraints:
- node.labels.blockchain== true
restart_policy:
condition: on-failure
delay: 15s
kuber:
image: dquadrant/kuber:4c3c5230db9a9b8ac84487fbc11ccd28b0cd5917-amd64
environment:
CARDANO_NODE_SOCKET_PATH: /ipc/node.socket
VIRTUAL_HOST: https://kuber-${BASE_DOMAIN}
NETWORK: 4
START_ERA: CONWAY
volumes:
- node_ipc:/ipc/
networks:
- cardano
deploy:
placement:
constraints:
- node.labels.blockchain== true
restart_policy:
delay: "30s"
56 changes: 56 additions & 0 deletions tests/test-infrastructure/docker-compose-govaction-loader.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: "3.9"

networks:
frontend:
external: true
cardano:
external: true

services:

governance-action-loader-ui:
image: govtool/gov-action-loader-frontend
build:
context: ../../gov-action-loader/frontend
dockerfile: Dockerfile
environment:
VIRTUAL_HOST: https://governance-${BASE_DOMAIN}
networks:
- frontend
deploy:
placement:
constraints:
- node.labels.govtool-test-stack == true
restart_policy:
delay: "30s"
resources:
limits:
memory: 500M
reservations:
memory: 100M

governance-action-loader-api:
image: govtool/gov-action-loader-backend
build:
context: ../../gov-action-loader/backend
dockerfile: Dockerfile
environment:
KUBER_API_URL: "http://kuber:8081"
KUBER_API_KEY: ""
BLOCKFROST_API_URL: "${BLOCKFROST_API_URL}"
BLOCKFROST_PROJECT_ID: "${BLOCKFROST_PROJECT_ID}"
VIRTUAL_HOST: https://governance-${BASE_DOMAIN}/api/ -> /api/
networks:
- default
- frontend
deploy:
placement:
constraints:
- node.labels.govtool-test-stack == true
restart_policy:
delay: "30s"
resources:
limits:
memory: 1G
reservations:
memory: 500M
81 changes: 81 additions & 0 deletions tests/test-infrastructure/docker-compose-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
version: "3.9"
secrets:
postgres_user:
external: true
name: ${STACK_NAME}_postgres_user
postgres_password:
external: true
name: ${STACK_NAME}_postgres_password
lighthouserc.json:
external: true
name: ${STACK_NAME}_lighthouserc.json
metrics_api_secret_token:
external: true
name: ${STACK_NAME}_metrics_api_secret

volumes:
lhci_data:
node_data:
node_ipc:
dbsync_data:

networks:
postgres:
external: true
frontend:
external: true

services:
metrics_api:
image: voltaire-era/govtool-metrics-api
build:
context: ../test-metrics-api
environment:
VIRTUAL_HOST: https://metrics-${BASE_DOMAIN}/ -> :3000/
PGHOST: postgres
PGDATABASE: ${STACK_NAME}_metrics
secrets:
- source: postgres_password
target: /run/secrets/pgpassword
- source: postgres_user
target: /run/secrets/pguser
- source: metrics_api_secret_token
target: /run/secrets/api_secret_token
networks:
- postgres
- frontend
deploy:
placement:
constraints:
- node.labels.govtool-test-stack == true
restart_policy:
delay: "30s"
resources:
limits:
memory: 600M
reservations:
memory: 100M

lhci-server:
image: patrickhulce/lhci-server:0.12.0
environment:
VIRTUAL_HOST: https://lighthouse-${BASE_DOMAIN} -> :9001
volumes:
- lhci_data:/data
secrets:
- source: lighthouserc.json
target: /usr/src/lhci/lighthouserc.json
networks:
- postgres
- frontend
deploy:
placement:
constraints:
- node.labels.govtool-test-stack == true
restart_policy:
delay: "30s"
resources:
limits:
memory: 1G
reservations:
memory: 300M

0 comments on commit db8bcef

Please sign in to comment.