From 54cd6eaceaceacb12353494f3088bbb7bacd6dbc Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sat, 4 Nov 2023 12:08:28 +0100 Subject: [PATCH 01/16] migrated the backend to the simplified deployment --- .../backend/files => config}/envoy.yaml | 2 +- .../templates/deployments/backend-v2.yaml | 2 - docker-compose.local.yaml | 48 ++++++++++ docker-compose.yaml | 95 ++++++++++++------- 4 files changed, 108 insertions(+), 39 deletions(-) rename {deployment/charts/backend/files => config}/envoy.yaml (98%) create mode 100644 docker-compose.local.yaml diff --git a/deployment/charts/backend/files/envoy.yaml b/config/envoy.yaml similarity index 98% rename from deployment/charts/backend/files/envoy.yaml rename to config/envoy.yaml index b81cf80d..ae42d40e 100644 --- a/deployment/charts/backend/files/envoy.yaml +++ b/config/envoy.yaml @@ -55,5 +55,5 @@ static_resources: - endpoint: address: socket_address: - address: localhost + address: backend-v2 port_value: 50051 diff --git a/deployment/charts/backend/templates/deployments/backend-v2.yaml b/deployment/charts/backend/templates/deployments/backend-v2.yaml index 6d10351a..ecff3a34 100644 --- a/deployment/charts/backend/templates/deployments/backend-v2.yaml +++ b/deployment/charts/backend/templates/deployments/backend-v2.yaml @@ -141,8 +141,6 @@ spec: ports: - containerPort: 8081 name: http - - containerPort: 9901 - name: admin volumeMounts: - mountPath: /etc/envoy/envoy.yaml subPath: envoy.yaml diff --git a/docker-compose.local.yaml b/docker-compose.local.yaml new file mode 100644 index 00000000..618392aa --- /dev/null +++ b/docker-compose.local.yaml @@ -0,0 +1,48 @@ +services: + backend-v2: + image: ghcr.io/tum-dev/campus-backend/backend-server:latest + restart: always + ports: + - "50051:50051" + environment: + - DB_DSN=root:${DB_ROOT_PASSWORD}@tcp(db:${DB_PORT:-3306})/${DB_NAME}?charset=utf8mb4&parseTime=True&loc=Local + - ENVIRONMENT=${ENVIRONMENT:-dev} + - SENTRY_DSN=${SENTRY_DSN} + - APNS_KEY_ID=${APNS_KEY_ID} + - APNS_TEAM_ID=${APNS_TEAM_ID} + - APNS_P8_FILE_PATH=${APNS_P8_FILE_PATH} + - OMDB_API_KEY=${OMDB_API_KEY} + - CAMPUS_API_TOKEN=${CAMPUS_API_TOKEN} + - SMTP_PASSWORD=${SMTP_PASSWORD} + - SMTP_URL=${SMTP_URL:-postout.lrz.de} + - SMTP_USERNAME=${SMTP_USERNAME:-tca-support.os.in@tum.de} + - SMTP_PORT=${SMTP_PORT:-587} + volumes: + - backend-storage:/Storage + - ./apns_auth_key.p8:${APNS_P8_FILE_PATH}:ro + user: 1000:3000 + read_only: true + depends_on: + db: + condition: service_healthy + db: + image: bitnami/mariadb:latest + restart: unless-stopped + ports: + - "${DB_PORT:-3306}:3306" + environment: + - MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD} + - MARIADB_DATABASE=${DB_NAME} + volumes: + - campus-db-data:/bitnami/mariadb + healthcheck: + test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh'] + interval: 15s + timeout: 5s + retries: 6 + +volumes: + campus-db-data: + driver: local + backend-storage: + driver: local diff --git a/docker-compose.yaml b/docker-compose.yaml index 4b90d942..ba881715 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,16 +1,15 @@ services: - backend: - image: ghcr.io/tum-dev/campus-backend/backend-server:latest + backend-v2: restart: always build: context: server/ args: version: dev # compiled with the git sha in prod - ports: - - 50051:50051 + expose: + - "50051" environment: - DB_DSN=root:${DB_ROOT_PASSWORD}@tcp(db:${DB_PORT:-3306})/${DB_NAME}?charset=utf8mb4&parseTime=True&loc=Local - - ENVIRONMENT=dev + - ENVIRONMENT=${ENVIRONMENT:-dev} - SENTRY_DSN=${SENTRY_DSN} - APNS_KEY_ID=${APNS_KEY_ID} - APNS_TEAM_ID=${APNS_TEAM_ID} @@ -31,8 +30,9 @@ services: db: image: bitnami/mariadb:latest - ports: - - ${DB_PORT:-3306}:3306 + restart: unless-stopped + expose: + - "${DB_PORT:-3306}" environment: - MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD} - MARIADB_DATABASE=${DB_NAME} @@ -43,38 +43,61 @@ services: interval: 15s timeout: 5s retries: 6 - # The following code can be used to test the envoy proxy locally - # The reason why this is commented out is that this working requires the following change: - # - # ./deployment/charts/backend/files/envoy.yaml - # socket_address: - # - address: localhost - # + address: backend - # port_value: 50051 - # - #grpc-web: - # image: envoyproxy/envoy:v1.27-latest - # restart: always - # command: - # - /docker-entrypoint.sh - # - --config-path - # - /etc/envoy/envoy.yaml - # - --service-cluster - # - backend-v2 - # - --service-node - # - backend-v2 - # - --log-level - # - info - # ports: - # - 8081:8081 - # - 9901:9901 - # volumes: - # - ./deployment/charts/backend/files/envoy.yaml:/etc/envoy/envoy.yaml - # depends_on: - # - backend + grpc-web: + image: envoyproxy/envoy:v1.27-latest + restart: always + command: + - /docker-entrypoint.sh + - --config-path + - /etc/envoy/envoy.yaml + - --service-cluster + - backend-v2 + - --service-node + - backend-v2 + - --log-level + - info + expose: + - "8081" + #- "9901" # admin interface, not very useful + volumes: + - ./config/envoy.yaml:/etc/envoy/envoy.yaml:ro + depends_on: + - backend-v2 + backend-v1-accesslogs: + image: alpine:1.36 + command: [ /bin/sh, -c, 'tail -n+1 -F /var/log/apache2/access.log' ] + volumes: + - legacybackend-logs:/var/log/:ro + depends_on: + - backend-v1 + backend-v1-errorlogs: + image: alpine:1.36 + command: [ /bin/sh, -c, 'tail -n+1 -F /var/log/apache2/error.log' ] + volumes: + - legacybackend-logs:/var/log/:ro + depends_on: + - backend-v1 + backend-v1: + image: ghcr.io/kordianbruck/tca-backend/tca-server:latest + restart: always + read_only: true + tmpfs: + - /app/Tmp/ + - /var/www/html/tmp/ + - /var/run/apache2/ + volumes: + - legacybackend-logs:/var/log/ + - legacybackend-config:/app/Config/cfg.ini:ro + - backend-storage:/app/Storage/ + expose: + - "80" volumes: campus-db-data: driver: local backend-storage: driver: local + legacybackend-config: + driver: local + legacybackend-logs: + driver: local From ffe218f44fa8a19defceb13db8cbf9881c4b6c2d Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sat, 4 Nov 2023 13:53:56 +0100 Subject: [PATCH 02/16] applied the same security protocols as before --- docker-compose.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index ba881715..1af93d96 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -22,8 +22,9 @@ services: - SMTP_PORT=${SMTP_PORT:-587} volumes: - backend-storage:/Storage - - ./apns_auth_key.p8:${APNS_P8_FILE_PATH} + - ./apns_auth_key.p8:${APNS_P8_FILE_PATH}:ro user: 1000:3000 + read_only: true depends_on: db: condition: service_healthy From 9d7356b6dca3ef88f710214310e997ed3ffda461 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 11 Mar 2024 00:41:58 +0100 Subject: [PATCH 03/16] added docker-compose labels --- docker-compose.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1af93d96..ef325768 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,10 +1,12 @@ services: backend-v2: restart: always - build: - context: server/ - args: - version: dev # compiled with the git sha in prod + labels: + - "traefik.enable=true" + - "traefik.http.routers.backend-v2.rule=Host(`api.tum.app`)" + + - "traefik.http.routers.backend-v2_h2.rule=Host(`api-grpc.tum.app`) && Headers(`Content-Type`, `application/grpc`)" + - "traefik.http.routers.backend-v2_h2.scheme=h2c" expose: - "50051" environment: @@ -60,6 +62,9 @@ services: expose: - "8081" #- "9901" # admin interface, not very useful + labels: + - "traefik.enable=true" + - "traefik.http.routers.backend-v2.rule=Host(`api.tum.app`)" volumes: - ./config/envoy.yaml:/etc/envoy/envoy.yaml:ro depends_on: From fc2447bd2525fe7e1b52af57ff9212cf265579b5 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 11 Mar 2024 00:46:21 +0100 Subject: [PATCH 04/16] re-disabled the MensaCron --- docker-compose.local.yaml | 1 + docker-compose.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/docker-compose.local.yaml b/docker-compose.local.yaml index 618392aa..da143430 100644 --- a/docker-compose.local.yaml +++ b/docker-compose.local.yaml @@ -17,6 +17,7 @@ services: - SMTP_URL=${SMTP_URL:-postout.lrz.de} - SMTP_USERNAME=${SMTP_USERNAME:-tca-support.os.in@tum.de} - SMTP_PORT=${SMTP_PORT:-587} + - MensaCronDisabled=true volumes: - backend-storage:/Storage - ./apns_auth_key.p8:${APNS_P8_FILE_PATH}:ro diff --git a/docker-compose.yaml b/docker-compose.yaml index ef325768..3f3cc8ee 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -22,6 +22,7 @@ services: - SMTP_URL=${SMTP_URL:-postout.lrz.de} - SMTP_USERNAME=${SMTP_USERNAME:-tca-support.os.in@tum.de} - SMTP_PORT=${SMTP_PORT:-587} + - MensaCronDisabled=true volumes: - backend-storage:/Storage - ./apns_auth_key.p8:${APNS_P8_FILE_PATH}:ro From e8d930a13b984ebe26e7bbb1ba62bb4e88a44538 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sun, 31 Mar 2024 21:57:55 +0200 Subject: [PATCH 05/16] removed the v1 backend --- docker-compose.yaml | 48 ++++++++------------------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 0e6edb65..b26d0a3f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,12 +1,12 @@ services: - backend-v2: + backend: restart: always labels: - "traefik.enable=true" - - "traefik.http.routers.backend-v2.rule=Host(`api.tum.app`)" + - "traefik.http.routers.backend.rule=Host(`api.tum.app`)" - - "traefik.http.routers.backend-v2_h2.rule=Host(`api-grpc.tum.app`) && Headers(`Content-Type`, `application/grpc`)" - - "traefik.http.routers.backend-v2_h2.scheme=h2c" + - "traefik.http.routers.backend_h2.rule=Host(`api-grpc.tum.app`) && Headers(`Content-Type`, `application/grpc`)" + - "traefik.http.routers.backend_h2.scheme=h2c" expose: - "50051" environment: @@ -56,9 +56,9 @@ services: - --config-path - /etc/envoy/envoy.yaml - --service-cluster - - backend-v2 + - backend - --service-node - - backend-v2 + - backend - --log-level - info expose: @@ -66,46 +66,14 @@ services: #- "9901" # admin interface, not very useful labels: - "traefik.enable=true" - - "traefik.http.routers.backend-v2.rule=Host(`api.tum.app`)" + - "traefik.http.routers.backend.rule=Host(`api.tum.app`)" volumes: - ./config/envoy.yaml:/etc/envoy/envoy.yaml:ro depends_on: - - backend-v2 - backend-v1-accesslogs: - image: alpine:1.36 - command: [ /bin/sh, -c, 'tail -n+1 -F /var/log/apache2/access.log' ] - volumes: - - legacybackend-logs:/var/log/:ro - depends_on: - - backend-v1 - backend-v1-errorlogs: - image: alpine:1.36 - command: [ /bin/sh, -c, 'tail -n+1 -F /var/log/apache2/error.log' ] - volumes: - - legacybackend-logs:/var/log/:ro - depends_on: - - backend-v1 - backend-v1: - image: ghcr.io/kordianbruck/tca-backend/tca-server:latest - restart: always - read_only: true - tmpfs: - - /app/Tmp/ - - /var/www/html/tmp/ - - /var/run/apache2/ - volumes: - - legacybackend-logs:/var/log/ - - legacybackend-config:/app/Config/cfg.ini:ro - - backend-storage:/app/Storage/ - expose: - - "80" + - backend volumes: campus-db-data: driver: local backend-storage: driver: local - legacybackend-config: - driver: local - legacybackend-logs: - driver: local From 7748b515e5e672004a9dee5bb02358aae6b3bbe3 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sun, 31 Mar 2024 22:02:12 +0200 Subject: [PATCH 06/16] made sure that the `networks` is set up correctly --- docker-compose.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index b26d0a3f..810cd2ba 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,9 @@ services: backend: - restart: always + image: ghcr.io/tum-dev/campus-backend/backend-server:main + restart: unless-stopped + networks: + - traefik_traefik labels: - "traefik.enable=true" - "traefik.http.routers.backend.rule=Host(`api.tum.app`)" @@ -32,7 +35,6 @@ services: depends_on: db: condition: service_healthy - db: image: bitnami/mariadb:latest restart: unless-stopped @@ -50,7 +52,9 @@ services: retries: 6 grpc-web: image: envoyproxy/envoy:v1.27-latest - restart: always + restart: unless-stopped + networks: + - traefik_traefik command: - /docker-entrypoint.sh - --config-path From e1bb506c9d5c2ece80f6b6f951033ed073750f2f Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sun, 31 Mar 2024 22:30:27 +0200 Subject: [PATCH 07/16] removed a few traces of `APNS` --- docker-compose.local.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docker-compose.local.yaml b/docker-compose.local.yaml index da143430..71c0a6af 100644 --- a/docker-compose.local.yaml +++ b/docker-compose.local.yaml @@ -8,9 +8,6 @@ services: - DB_DSN=root:${DB_ROOT_PASSWORD}@tcp(db:${DB_PORT:-3306})/${DB_NAME}?charset=utf8mb4&parseTime=True&loc=Local - ENVIRONMENT=${ENVIRONMENT:-dev} - SENTRY_DSN=${SENTRY_DSN} - - APNS_KEY_ID=${APNS_KEY_ID} - - APNS_TEAM_ID=${APNS_TEAM_ID} - - APNS_P8_FILE_PATH=${APNS_P8_FILE_PATH} - OMDB_API_KEY=${OMDB_API_KEY} - CAMPUS_API_TOKEN=${CAMPUS_API_TOKEN} - SMTP_PASSWORD=${SMTP_PASSWORD} @@ -20,7 +17,6 @@ services: - MensaCronDisabled=true volumes: - backend-storage:/Storage - - ./apns_auth_key.p8:${APNS_P8_FILE_PATH}:ro user: 1000:3000 read_only: true depends_on: From 88f248c3e89e0ea9bf3362923d129e1c75800291 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sun, 31 Mar 2024 22:33:01 +0200 Subject: [PATCH 08/16] fixed a typo --- docker-compose.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yaml b/docker-compose.yaml index 885721ac..240dbdc5 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -80,3 +80,7 @@ volumes: driver: local backend-storage: driver: local + +networks: + traefik_traefik: + external: true From 7117decd161827299da85d404a90fda11cb10512 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sun, 31 Mar 2024 23:21:16 +0200 Subject: [PATCH 09/16] tested different port configuration in prod --- docker-compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 240dbdc5..5c63a3f1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -13,7 +13,7 @@ services: expose: - "50051" environment: - - DB_DSN=root:${DB_ROOT_PASSWORD}@tcp(db:${DB_PORT:-3306})/${DB_NAME}?charset=utf8mb4&parseTime=True&loc=Local + - DB_DSN=root:${DB_ROOT_PASSWORD}@tcp(db:3306)/${DB_NAME}?charset=utf8mb4&parseTime=True&loc=Local - ENVIRONMENT=${ENVIRONMENT:-dev} - DB_NAME=${DB_NAME} - SENTRY_DSN=${SENTRY_DSN} @@ -36,7 +36,7 @@ services: image: bitnami/mariadb:latest restart: unless-stopped expose: - - "${DB_PORT:-3306}" + - 3306 environment: - MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD} - MARIADB_DATABASE=${DB_NAME} From 03d239f8e2cd0553059b0180db1ce1609cee4058 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Sun, 31 Mar 2024 23:49:38 +0200 Subject: [PATCH 10/16] fixed the local docker compose file not building a local image --- docker-compose.local.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docker-compose.local.yaml b/docker-compose.local.yaml index 71c0a6af..d3efcbb6 100644 --- a/docker-compose.local.yaml +++ b/docker-compose.local.yaml @@ -1,6 +1,9 @@ services: - backend-v2: - image: ghcr.io/tum-dev/campus-backend/backend-server:latest + backend: + build: + context: server/ + args: + version: dev # compiled with the git sha in prod restart: always ports: - "50051:50051" @@ -17,8 +20,6 @@ services: - MensaCronDisabled=true volumes: - backend-storage:/Storage - user: 1000:3000 - read_only: true depends_on: db: condition: service_healthy From f536d0cd14f3a13e69f8728ac64d6270d0e793cc Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 1 Apr 2024 00:11:14 +0200 Subject: [PATCH 11/16] made sure that the `DB_NAME` is included in local development --- docker-compose.local.yaml | 3 ++- docker-compose.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.local.yaml b/docker-compose.local.yaml index d3efcbb6..ded082d4 100644 --- a/docker-compose.local.yaml +++ b/docker-compose.local.yaml @@ -8,8 +8,9 @@ services: ports: - "50051:50051" environment: - - DB_DSN=root:${DB_ROOT_PASSWORD}@tcp(db:${DB_PORT:-3306})/${DB_NAME}?charset=utf8mb4&parseTime=True&loc=Local - ENVIRONMENT=${ENVIRONMENT:-dev} + - DB_DSN=root:${DB_ROOT_PASSWORD}@tcp(db:${DB_PORT:-3306})/${DB_NAME}?charset=utf8mb4&parseTime=True&loc=Local + - DB_NAME=${DB_NAME} - SENTRY_DSN=${SENTRY_DSN} - OMDB_API_KEY=${OMDB_API_KEY} - CAMPUS_API_TOKEN=${CAMPUS_API_TOKEN} diff --git a/docker-compose.yaml b/docker-compose.yaml index 5c63a3f1..e0416236 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -13,8 +13,8 @@ services: expose: - "50051" environment: - - DB_DSN=root:${DB_ROOT_PASSWORD}@tcp(db:3306)/${DB_NAME}?charset=utf8mb4&parseTime=True&loc=Local - ENVIRONMENT=${ENVIRONMENT:-dev} + - DB_DSN=root:${DB_ROOT_PASSWORD}@tcp(db:3306)/${DB_NAME}?charset=utf8mb4&parseTime=True&loc=Local - DB_NAME=${DB_NAME} - SENTRY_DSN=${SENTRY_DSN} - OMDB_API_KEY=${OMDB_API_KEY} From b515923d9f9bf9e39089c2b291bb2d507c405d39 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 1 Apr 2024 00:28:22 +0200 Subject: [PATCH 12/16] aligned the local and remote options closer --- docker-compose.local.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker-compose.local.yaml b/docker-compose.local.yaml index ded082d4..7293a2f1 100644 --- a/docker-compose.local.yaml +++ b/docker-compose.local.yaml @@ -16,9 +16,12 @@ services: - CAMPUS_API_TOKEN=${CAMPUS_API_TOKEN} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_URL=${SMTP_URL:-postout.lrz.de} - - SMTP_USERNAME=${SMTP_USERNAME:-tca-support.os.in@tum.de} + - SMTP_USERNAME=${SMTP_USERNAME:-bot@tum.app} + - SMTP_FROM=${SMTP_FROM:-bot@tum.app} - SMTP_PORT=${SMTP_PORT:-587} - MensaCronDisabled=true + user: 1000:3000 + read_only: true volumes: - backend-storage:/Storage depends_on: @@ -32,6 +35,8 @@ services: environment: - MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD} - MARIADB_DATABASE=${DB_NAME} + - MARIADB_CHARACTER_SET=utf8mb4 + - MARIADB_COLLATE=utf8mb4_unicode_ci volumes: - campus-db-data:/bitnami/mariadb healthcheck: From 51209cbd610f82aef78bc4613e92c81be0e711f6 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 1 Apr 2024 01:04:34 +0200 Subject: [PATCH 13/16] made sure that the db can be connected to --- docker-compose.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index e0416236..0d98d7d7 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,14 +2,15 @@ services: backend: image: ghcr.io/tum-dev/campus-backend/backend-server:main restart: unless-stopped - networks: - - traefik_traefik labels: - "traefik.enable=true" - "traefik.http.routers.backend.rule=Host(`api.tum.app`)" - "traefik.http.routers.backend_h2.rule=Host(`api-grpc.tum.app`) && Headers(`Content-Type`, `application/grpc`)" - "traefik.http.routers.backend_h2.scheme=h2c" + networks: + - traefik_traefik + - campus_db expose: - "50051" environment: @@ -35,6 +36,8 @@ services: db: image: bitnami/mariadb:latest restart: unless-stopped + networks: + - campus_db expose: - 3306 environment: @@ -82,5 +85,6 @@ volumes: driver: local networks: - traefik_traefik: - external: true + campus_db: + traefik_traefik: + external: true From 86ac9480a822f63761e3d0122b3e184bedde2b80 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 1 Apr 2024 01:11:34 +0200 Subject: [PATCH 14/16] aligned the naming required by ci --- README.md | 4 ++-- docker-compose.local.yaml => docker-compose.local.yml | 0 docker-compose.yaml => docker-compose.yml | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename docker-compose.local.yaml => docker-compose.local.yml (100%) rename docker-compose.yaml => docker-compose.yml (100%) diff --git a/README.md b/README.md index 417e8062..2d8906c4 100644 --- a/README.md +++ b/README.md @@ -76,9 +76,9 @@ There are a few environment variables available: ## Running the Server (Docker) ```bash -docker compose up -d +docker compose -f docker-compose.local.yml up -d ``` -The docker compose will start the server and a mariadb instance. +The docker compose will start the server and a mariadb instance (=> without the grpc-web layer and without routing/certificates to worry about) The server will be available at `localhost:50051` and the mariadb instance at `localhost:3306`. Additionally, docker creates the volume `campus-db-data` to persist the data of the mariadb instances. diff --git a/docker-compose.local.yaml b/docker-compose.local.yml similarity index 100% rename from docker-compose.local.yaml rename to docker-compose.local.yml diff --git a/docker-compose.yaml b/docker-compose.yml similarity index 100% rename from docker-compose.yaml rename to docker-compose.yml From 286ef570904885778a8b91c54bec0a88c2470860 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 1 Apr 2024 02:41:23 +0200 Subject: [PATCH 15/16] removed unused `CAMPUS_API_TOKEN` option --- .env | 2 -- .../charts/backend/templates/deployments/backend-v2.yaml | 6 ------ docker-compose.local.yml | 1 - docker-compose.yml | 1 - 4 files changed, 10 deletions(-) diff --git a/.env b/.env index 0840d25b..3648159b 100644 --- a/.env +++ b/.env @@ -5,8 +5,6 @@ DB_PORT=3306 SENTRY_DSN= -CAMPUS_API_TOKEN= - SMTP_PASSWORD= SMTP_URL= SMTP_FROM= diff --git a/deployment/charts/backend/templates/deployments/backend-v2.yaml b/deployment/charts/backend/templates/deployments/backend-v2.yaml index 549ac728..45937580 100644 --- a/deployment/charts/backend/templates/deployments/backend-v2.yaml +++ b/deployment/charts/backend/templates/deployments/backend-v2.yaml @@ -53,11 +53,6 @@ spec: secretKeyRef: name: backend-api-keys key: SENTRY_DSN - - name: CAMPUS_API_TOKEN - valueFrom: - secretKeyRef: - name: backend-api-keys - key: CAMPUS_API_TOKEN - name: SMTP_PASSWORD valueFrom: secretKeyRef: @@ -161,7 +156,6 @@ metadata: app.kubernetes.io/name: backend-v2 data: OMDB_API_KEY: {{ $.Values.backend.omdbApiKey | b64enc }} - CAMPUS_API_TOKEN: {{ $.Values.backend.campusApiToken | b64enc }} SENTRY_DSN: {{ $.Values.backend.sentry.dsn | b64enc }} SMTP_PASSWORD: {{ $.Values.backend.smtp.password | b64enc }} SMTP_URL: {{ $.Values.backend.smtp.url | b64enc }} diff --git a/docker-compose.local.yml b/docker-compose.local.yml index 7293a2f1..36108ee4 100644 --- a/docker-compose.local.yml +++ b/docker-compose.local.yml @@ -13,7 +13,6 @@ services: - DB_NAME=${DB_NAME} - SENTRY_DSN=${SENTRY_DSN} - OMDB_API_KEY=${OMDB_API_KEY} - - CAMPUS_API_TOKEN=${CAMPUS_API_TOKEN} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_URL=${SMTP_URL:-postout.lrz.de} - SMTP_USERNAME=${SMTP_USERNAME:-bot@tum.app} diff --git a/docker-compose.yml b/docker-compose.yml index 0d98d7d7..6d38ea03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,6 @@ services: - DB_NAME=${DB_NAME} - SENTRY_DSN=${SENTRY_DSN} - OMDB_API_KEY=${OMDB_API_KEY} - - CAMPUS_API_TOKEN=${CAMPUS_API_TOKEN} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_URL=${SMTP_URL:-postout.lrz.de} - SMTP_USERNAME=${SMTP_USERNAME:-bot@tum.app} From 593658bdb3f5b5e7afa53b2c2fc20c545bbc4226 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 1 Apr 2024 03:09:23 +0200 Subject: [PATCH 16/16] made sure that the labels of the backend are synced with the ones of other services --- docker-compose.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6d38ea03..4126acc1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,10 +4,16 @@ services: restart: unless-stopped labels: - "traefik.enable=true" + - "traefik.http.routers.backend.entrypoints=webs" + - "traefik.http.routers.backend.tls.certresolver=leacme" - "traefik.http.routers.backend.rule=Host(`api.tum.app`)" + - "traefik.http.services.backend.loadbalancer.server.port=50051" + - "traefik.http.routers.backend_h2.entrypoints=webs" + - "traefik.http.routers.backend_h2.tls.certresolver=leacme" - "traefik.http.routers.backend_h2.rule=Host(`api-grpc.tum.app`) && Headers(`Content-Type`, `application/grpc`)" - "traefik.http.routers.backend_h2.scheme=h2c" + - "traefik.http.services.backend_h2.loadbalancer.server.port=50051" networks: - traefik_traefik - campus_db @@ -71,11 +77,15 @@ services: #- "9901" # admin interface, not very useful labels: - "traefik.enable=true" - - "traefik.http.routers.backend.rule=Host(`api.tum.app`)" + - "traefik.http.routers.grpc-web.entrypoints=webs" + - "traefik.http.routers.grpc-web.tls.certresolver=leacme" + - "traefik.http.routers.grpc-web.rule=Host(`api.tum.app`)" + - "traefik.http.services.grpc-web.loadbalancer.server.port=8081" volumes: - ./config/envoy.yaml:/etc/envoy/envoy.yaml:ro depends_on: - - backend + backend: + condition: service_healthy volumes: campus-db-data: