From 3deaa0539e02f215a9c18cf3bb69622219473db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Placzy=C5=84ski?= Date: Wed, 21 Feb 2024 11:08:37 +0100 Subject: [PATCH] [#224] Hardcode domains for target environments in Docker Compose files 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. --- scripts/govtool/docker-compose.beta.yml | 12 ++++++------ scripts/govtool/docker-compose.dev.yml | 12 ++++++------ scripts/govtool/docker-compose.staging.yml | 12 ++++++------ scripts/govtool/docker-compose.test.yml | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/scripts/govtool/docker-compose.beta.yml b/scripts/govtool/docker-compose.beta.yml index 7c85b506f..0a608601f 100644 --- a/scripts/govtool/docker-compose.beta.yml +++ b/scripts/govtool/docker-compose.beta.yml @@ -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" @@ -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" @@ -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" @@ -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:" diff --git a/scripts/govtool/docker-compose.dev.yml b/scripts/govtool/docker-compose.dev.yml index 7c85b506f..a43d63137 100644 --- a/scripts/govtool/docker-compose.dev.yml +++ b/scripts/govtool/docker-compose.dev.yml @@ -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" @@ -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" @@ -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" @@ -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:" diff --git a/scripts/govtool/docker-compose.staging.yml b/scripts/govtool/docker-compose.staging.yml index 7c85b506f..24de7ae0a 100644 --- a/scripts/govtool/docker-compose.staging.yml +++ b/scripts/govtool/docker-compose.staging.yml @@ -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" @@ -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" @@ -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" @@ -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:" diff --git a/scripts/govtool/docker-compose.test.yml b/scripts/govtool/docker-compose.test.yml index 7c85b506f..14b818825 100644 --- a/scripts/govtool/docker-compose.test.yml +++ b/scripts/govtool/docker-compose.test.yml @@ -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" @@ -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" @@ -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" @@ -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:"