Skip to content

Commit

Permalink
[#224] Hardcode domains for target environments in Docker Compose files
Browse files Browse the repository at this point in the history
Updated the Docker Compose files for beta, dev, staging, and test
environments to hardcode the domain names for each respective
environment. This change ensures that the services within each
environment are accessible through predefined, environment-specific
URLs, enhancing clarity and reducing the reliance on dynamically
generated domain names based on environment variables. Specifically, the
changes include hardcoding the Grafana URL, status-service, backend API,
and frontend service URLs to their respective environment-specific
domains.

This change also addresses the original issue stated in #224 - an
exception on dev sever to apply specific CORS policy only there.

This adjustment facilitates more predictable deployment and
access patterns for services across different deployment stages.
  • Loading branch information
placek committed Feb 21, 2024
1 parent 2e28e74 commit 3deaa05
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions scripts/govtool/docker-compose.beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ services:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_INSTALL_PLUGINS=grafana-piechart-panel
- GF_SERVER_ROOT_URL=https://${SUBDOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK}.govtool.byron.network/grafana
- GF_SERVER_ROOT_URL=https://sanchogov.tools/grafana/login
- GF_SERVER_SERVE_FROM_SUB_PATH=true
restart: always
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/grafana`)"
- "traefik.http.routers.grafana.rule=Host(`sanchogov.tools`) && PathPrefix(`/grafana`)"
- "traefik.http.routers.grafana.entrypoints=websecure"
- "traefik.http.routers.grafana.tls.certresolver=myresolver"
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
Expand All @@ -76,7 +76,7 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.status-service.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/status`)"
- "traefik.http.routers.status-service.rule=Host(`sanchogov.tools`) && PathPrefix(`/status`)"
- "traefik.http.routers.status-service.entrypoints=websecure"
- "traefik.http.routers.status-service.tls.certresolver=myresolver"
- "traefik.http.services.status-service.loadbalancer.server.port=8000"
Expand Down Expand Up @@ -180,11 +180,11 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.backend.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/api`)"
- "traefik.http.routers.backend.rule=Host(`sanchogov.tools`) && PathPrefix(`/api`)"
- "traefik.http.middlewares.backend-stripprefix.stripprefix.prefixes=/api"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolallowmethods=GET,HEAD,OPTIONS"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolallowheaders=*"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolalloworiginlist=https://${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network},http://localhost"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolalloworiginlist=https://sanchogov.tools"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.backend-cors.headers.addvaryheader=true"
- "traefik.http.routers.backend.middlewares=backend-stripprefix@docker,backend-cors@docker"
Expand All @@ -206,7 +206,7 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.frontend.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`)"
- "traefik.http.routers.frontend.rule=Host(`sanchogov.tools`)"
- "traefik.http.routers.frontend.entrypoints=websecure"
- "traefik.http.routers.frontend.tls.certresolver=myresolver"
- "traefik.http.middlewares.frontend-csp.headers.contentSecurityPolicy=default-src 'self'; img-src *.usersnap.com 'self' data:; script-src *.usersnap.com 'self' 'unsafe-inline' https://www.googletagmanager.com https://browser.sentry-cdn.com; style-src *.usersnap.com *.googleapis.com 'self' 'unsafe-inline' https://fonts.googleapis.com; connect-src *.usersnap.com https://s3.eu-central-1.amazonaws.com/upload.usersnap.com 'self' https://o4506155985141760.ingest.sentry.io/api/4506156032196608/envelope/ *.google-analytics.com; font-src *.usersnap.com *.gstatic.com 'self' 'unsafe-inline' https://fonts.gstatic.com; worker-src blob:"
Expand Down
12 changes: 6 additions & 6 deletions scripts/govtool/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ services:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_INSTALL_PLUGINS=grafana-piechart-panel
- GF_SERVER_ROOT_URL=https://${SUBDOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK}.govtool.byron.network/grafana
- GF_SERVER_ROOT_URL=https://dev-sanchonet.govtool.byron.network/grafana
- GF_SERVER_SERVE_FROM_SUB_PATH=true
restart: always
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/grafana`)"
- "traefik.http.routers.grafana.rule=Host(`dev-sanchonet.govtool.byron.network`) && PathPrefix(`/grafana`)"
- "traefik.http.routers.grafana.entrypoints=websecure"
- "traefik.http.routers.grafana.tls.certresolver=myresolver"
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
Expand All @@ -76,7 +76,7 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.status-service.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/status`)"
- "traefik.http.routers.status-service.rule=Host(`dev-sanchonet.govtool.byron.network`) && PathPrefix(`/status`)"
- "traefik.http.routers.status-service.entrypoints=websecure"
- "traefik.http.routers.status-service.tls.certresolver=myresolver"
- "traefik.http.services.status-service.loadbalancer.server.port=8000"
Expand Down Expand Up @@ -180,11 +180,11 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.backend.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/api`)"
- "traefik.http.routers.backend.rule=Host(`dev-sanchonet.govtool.byron.network`) && PathPrefix(`/api`)"
- "traefik.http.middlewares.backend-stripprefix.stripprefix.prefixes=/api"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolallowmethods=GET,HEAD,OPTIONS"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolallowheaders=*"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolalloworiginlist=https://${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network},http://localhost"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolalloworiginlist=https://dev-sanchonet.govtool.byron.network,http://localhost"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.backend-cors.headers.addvaryheader=true"
- "traefik.http.routers.backend.middlewares=backend-stripprefix@docker,backend-cors@docker"
Expand All @@ -206,7 +206,7 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.frontend.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`)"
- "traefik.http.routers.frontend.rule=Host(`dev-sanchonet.govtool.byron.network`)"
- "traefik.http.routers.frontend.entrypoints=websecure"
- "traefik.http.routers.frontend.tls.certresolver=myresolver"
- "traefik.http.middlewares.frontend-csp.headers.contentSecurityPolicy=default-src 'self'; img-src *.usersnap.com 'self' data:; script-src *.usersnap.com 'self' 'unsafe-inline' https://www.googletagmanager.com https://browser.sentry-cdn.com; style-src *.usersnap.com *.googleapis.com 'self' 'unsafe-inline' https://fonts.googleapis.com; connect-src *.usersnap.com https://s3.eu-central-1.amazonaws.com/upload.usersnap.com 'self' https://o4506155985141760.ingest.sentry.io/api/4506156032196608/envelope/ *.google-analytics.com; font-src *.usersnap.com *.gstatic.com 'self' 'unsafe-inline' https://fonts.gstatic.com; worker-src blob:"
Expand Down
12 changes: 6 additions & 6 deletions scripts/govtool/docker-compose.staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ services:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_INSTALL_PLUGINS=grafana-piechart-panel
- GF_SERVER_ROOT_URL=https://${SUBDOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK}.govtool.byron.network/grafana
- GF_SERVER_ROOT_URL=https://staging.govtool.byron.network/grafana
- GF_SERVER_SERVE_FROM_SUB_PATH=true
restart: always
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/grafana`)"
- "traefik.http.routers.grafana.rule=Host(`staging.govtool.byron.network`) && PathPrefix(`/grafana`)"
- "traefik.http.routers.grafana.entrypoints=websecure"
- "traefik.http.routers.grafana.tls.certresolver=myresolver"
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
Expand All @@ -76,7 +76,7 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.status-service.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/status`)"
- "traefik.http.routers.status-service.rule=Host(`staging.govtool.byron.network`) && PathPrefix(`/status`)"
- "traefik.http.routers.status-service.entrypoints=websecure"
- "traefik.http.routers.status-service.tls.certresolver=myresolver"
- "traefik.http.services.status-service.loadbalancer.server.port=8000"
Expand Down Expand Up @@ -180,11 +180,11 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.backend.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/api`)"
- "traefik.http.routers.backend.rule=Host(`staging.govtool.byron.network`) && PathPrefix(`/api`)"
- "traefik.http.middlewares.backend-stripprefix.stripprefix.prefixes=/api"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolallowmethods=GET,HEAD,OPTIONS"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolallowheaders=*"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolalloworiginlist=https://${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network},http://localhost"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolalloworiginlist=https://staging.govtool.byron.network"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.backend-cors.headers.addvaryheader=true"
- "traefik.http.routers.backend.middlewares=backend-stripprefix@docker,backend-cors@docker"
Expand All @@ -206,7 +206,7 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.frontend.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`)"
- "traefik.http.routers.frontend.rule=Host(`staging.govtool.byron.network`)"
- "traefik.http.routers.frontend.entrypoints=websecure"
- "traefik.http.routers.frontend.tls.certresolver=myresolver"
- "traefik.http.middlewares.frontend-csp.headers.contentSecurityPolicy=default-src 'self'; img-src *.usersnap.com 'self' data:; script-src *.usersnap.com 'self' 'unsafe-inline' https://www.googletagmanager.com https://browser.sentry-cdn.com; style-src *.usersnap.com *.googleapis.com 'self' 'unsafe-inline' https://fonts.googleapis.com; connect-src *.usersnap.com https://s3.eu-central-1.amazonaws.com/upload.usersnap.com 'self' https://o4506155985141760.ingest.sentry.io/api/4506156032196608/envelope/ *.google-analytics.com; font-src *.usersnap.com *.gstatic.com 'self' 'unsafe-inline' https://fonts.gstatic.com; worker-src blob:"
Expand Down
12 changes: 6 additions & 6 deletions scripts/govtool/docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ services:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_INSTALL_PLUGINS=grafana-piechart-panel
- GF_SERVER_ROOT_URL=https://${SUBDOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK}.govtool.byron.network/grafana
- GF_SERVER_ROOT_URL=https://test.govtool.byron.network/grafana
- GF_SERVER_SERVE_FROM_SUB_PATH=true
restart: always
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/grafana`)"
- "traefik.http.routers.grafana.rule=Host(`test.govtool.byron.network`) && PathPrefix(`/grafana`)"
- "traefik.http.routers.grafana.entrypoints=websecure"
- "traefik.http.routers.grafana.tls.certresolver=myresolver"
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
Expand All @@ -76,7 +76,7 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.status-service.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/status`)"
- "traefik.http.routers.status-service.rule=Host(`test.govtool.byron.network`) && PathPrefix(`/status`)"
- "traefik.http.routers.status-service.entrypoints=websecure"
- "traefik.http.routers.status-service.tls.certresolver=myresolver"
- "traefik.http.services.status-service.loadbalancer.server.port=8000"
Expand Down Expand Up @@ -180,11 +180,11 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.backend.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`) && PathPrefix(`/api`)"
- "traefik.http.routers.backend.rule=Host(`test.govtool.byron.network`) && PathPrefix(`/api`)"
- "traefik.http.middlewares.backend-stripprefix.stripprefix.prefixes=/api"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolallowmethods=GET,HEAD,OPTIONS"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolallowheaders=*"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolalloworiginlist=https://${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network},http://localhost"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolalloworiginlist=https://test.govtool.byron.network"
- "traefik.http.middlewares.backend-cors.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.backend-cors.headers.addvaryheader=true"
- "traefik.http.routers.backend.middlewares=backend-stripprefix@docker,backend-cors@docker"
Expand All @@ -206,7 +206,7 @@ services:
logging: *logging
labels:
- "traefik.enable=true"
- "traefik.http.routers.frontend.rule=Host(`${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}`)"
- "traefik.http.routers.frontend.rule=Host(`test.govtool.byron.network`)"
- "traefik.http.routers.frontend.entrypoints=websecure"
- "traefik.http.routers.frontend.tls.certresolver=myresolver"
- "traefik.http.middlewares.frontend-csp.headers.contentSecurityPolicy=default-src 'self'; img-src *.usersnap.com 'self' data:; script-src *.usersnap.com 'self' 'unsafe-inline' https://www.googletagmanager.com https://browser.sentry-cdn.com; style-src *.usersnap.com *.googleapis.com 'self' 'unsafe-inline' https://fonts.googleapis.com; connect-src *.usersnap.com https://s3.eu-central-1.amazonaws.com/upload.usersnap.com 'self' https://o4506155985141760.ingest.sentry.io/api/4506156032196608/envelope/ *.google-analytics.com; font-src *.usersnap.com *.gstatic.com 'self' 'unsafe-inline' https://fonts.gstatic.com; worker-src blob:"
Expand Down

0 comments on commit 3deaa05

Please sign in to comment.