From eb848af0ad7e1f90ca622b19864be566c126fd1f Mon Sep 17 00:00:00 2001 From: knoflook Date: Thu, 20 Jun 2024 15:36:08 +0200 Subject: [PATCH 1/6] add mariadb support --- .env.sample | 3 +++ abra.sh | 1 + compose.yml | 46 +++++++++++++++++++++++++++++++++++++++++++++- entrypoint.sh.tmpl | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 abra.sh create mode 100644 entrypoint.sh.tmpl diff --git a/.env.sample b/.env.sample index 5df1894..30e2966 100644 --- a/.env.sample +++ b/.env.sample @@ -5,4 +5,7 @@ DOMAIN=uptime-kuma.example.com ## Domain aliases #EXTRA_DOMAINS=', `www.uptime-kuma.example.com`' +SECRET_DB_PASSWORD_VERSION=v1 +SECRET_DB_ROOT_PASSWORD_VERSION=v1 + LETS_ENCRYPT_ENV=production diff --git a/abra.sh b/abra.sh new file mode 100644 index 0000000..7c5fe57 --- /dev/null +++ b/abra.sh @@ -0,0 +1 @@ +export APP_ENTRYPOINT_VERSION=v1 diff --git a/compose.yml b/compose.yml index 77a0efc..45a3291 100644 --- a/compose.yml +++ b/compose.yml @@ -3,11 +3,25 @@ version: "3.8" services: app: - image: louislam/uptime-kuma:1.23.11 + image: kn0fl00k/uptime-kuma:unstable volumes: - data:/app/data networks: + - internal - proxy + environment: + - UPTIME_KUMA_GH_REPO=louislam:uptime-kuma + - UPTIME_KUMA_DB_TYPE=mariadb + - UPTIME_KUMA_DB_HOSTNAME=db + - UPTIME_KUMA_DB_PORT=3306 + - UPTIME_KUMA_DB_NAME=kuma + - UPTIME_KUMA_DB_USERNAME=kuma + - UPTIME_KUMA_DB_PASSWORD_FILE=/run/secrets/db_password + configs: + - source: app_entrypoint + target: /docker-entrypoint.sh + mode: 0555 + entrypoint: /docker-entrypoint.sh deploy: update_config: failure_action: rollback @@ -29,10 +43,40 @@ services: timeout: 10s retries: 5 start_period: 2m + db: + image: mariadb:10.8 + environment: + - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password + - MYSQL_PASSWORD_FILE=/run/secrets/db_password + - MYSQL_USER=kuma + - MYSQL_DATABASE=kuma + volumes: + - mariadb:/var/lib/mysql + networks: + - internal + secrets: + - db_password + - db_root_password volumes: + mariadb: data: networks: proxy: external: true + internal: + +secrets: + db_password: + external: true + name: ${STACK_NAME}_db_password_${DB_PASSWORD_VERSION} + db_root_password: + external: true + name: ${STACK_NAME}_db_root_password_${DB_ROOT_PASSWORD_VERSION} + +configs: + app_entrypoint: + name: ${STACK_NAME}_app_entrypoint_${APP_ENTRYPOINT_VERSION} + file: entrypoint.sh.tmpl + template_driver: golang diff --git a/entrypoint.sh.tmpl b/entrypoint.sh.tmpl new file mode 100644 index 0000000..dd0a3a0 --- /dev/null +++ b/entrypoint.sh.tmpl @@ -0,0 +1,32 @@ + +#!/bin/bash + +set -e + +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + + local val="$def" + + if [ "${!var:-}" ]; then + val="${!var}" + elif [ "${!fileVar:-}" ]; then + val="$(< "${!fileVar}")" + fi + + export "$var"="$val" + unset "$fileVar" +} + +file_env "UPTIME_KUMA_DB_PASSWORD" + +# upstream startup command +cd /app +node server/server.js From 6dd9c279700983cc4b02202affd82c17187f87ca Mon Sep 17 00:00:00 2001 From: knoflook Date: Thu, 20 Jun 2024 15:37:31 +0200 Subject: [PATCH 2/6] fix: invalid secret name --- compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compose.yml b/compose.yml index 45a3291..d275045 100644 --- a/compose.yml +++ b/compose.yml @@ -70,10 +70,10 @@ networks: secrets: db_password: external: true - name: ${STACK_NAME}_db_password_${DB_PASSWORD_VERSION} + name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION} db_root_password: external: true - name: ${STACK_NAME}_db_root_password_${DB_ROOT_PASSWORD_VERSION} + name: ${STACK_NAME}_db_root_password_${SECRET_DB_ROOT_PASSWORD_VERSION} configs: app_entrypoint: From c755e8e0e24bb8a9ccc74efa0a293a4440c58b58 Mon Sep 17 00:00:00 2001 From: knoflook Date: Tue, 9 Jul 2024 16:21:04 +0200 Subject: [PATCH 3/6] chore: bump entrypoint version --- abra.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/abra.sh b/abra.sh index 7c5fe57..4877365 100644 --- a/abra.sh +++ b/abra.sh @@ -1 +1 @@ -export APP_ENTRYPOINT_VERSION=v1 +export APP_ENTRYPOINT_VERSION=v2 From 0d32e289b3684222a58de869fe457e131694a0c1 Mon Sep 17 00:00:00 2001 From: knoflook Date: Tue, 1 Oct 2024 15:51:04 +0200 Subject: [PATCH 4/6] dirty commit for mariadb --- abra.sh | 2 +- compose.yml | 4 +++- entrypoint.sh.tmpl | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/abra.sh b/abra.sh index 4877365..7c5fe57 100644 --- a/abra.sh +++ b/abra.sh @@ -1 +1 @@ -export APP_ENTRYPOINT_VERSION=v2 +export APP_ENTRYPOINT_VERSION=v1 diff --git a/compose.yml b/compose.yml index d275045..49831cd 100644 --- a/compose.yml +++ b/compose.yml @@ -3,9 +3,11 @@ version: "3.8" services: app: - image: kn0fl00k/uptime-kuma:unstable + image: kn0fl00k/uptime-kuma:unstable003 volumes: - data:/app/data + secrets: + - db_password networks: - internal - proxy diff --git a/entrypoint.sh.tmpl b/entrypoint.sh.tmpl index dd0a3a0..d632eab 100644 --- a/entrypoint.sh.tmpl +++ b/entrypoint.sh.tmpl @@ -1,4 +1,3 @@ - #!/bin/bash set -e @@ -29,4 +28,4 @@ file_env "UPTIME_KUMA_DB_PASSWORD" # upstream startup command cd /app -node server/server.js +node server/server.js From e927d30f741f2aec52daf9f7394faf6bf5c54fdd Mon Sep 17 00:00:00 2001 From: knoflook Date: Thu, 10 Oct 2024 18:03:24 +0200 Subject: [PATCH 5/6] feat: fully working mariadb --- compose.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compose.yml b/compose.yml index 49831cd..addf5f6 100644 --- a/compose.yml +++ b/compose.yml @@ -3,7 +3,7 @@ version: "3.8" services: app: - image: kn0fl00k/uptime-kuma:unstable003 + image: kn0fl00k/uptime-kuma:unstable004 volumes: - data:/app/data secrets: @@ -19,6 +19,8 @@ services: - UPTIME_KUMA_DB_NAME=kuma - UPTIME_KUMA_DB_USERNAME=kuma - UPTIME_KUMA_DB_PASSWORD_FILE=/run/secrets/db_password + depends_on: + - db configs: - source: app_entrypoint target: /docker-entrypoint.sh @@ -38,7 +40,7 @@ services: #- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect" #- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true" #- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}" - - "coop-cloud.${STACK_NAME}.version=0.5.0+1.23.11" + - "coop-cloud.${STACK_NAME}.version=0.6.0+unstable004" healthcheck: test: 'curl -L localhost:3001' interval: 30s @@ -46,7 +48,7 @@ services: retries: 5 start_period: 2m db: - image: mariadb:10.8 + image: mariadb:11.5 environment: - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password - MYSQL_PASSWORD_FILE=/run/secrets/db_password From a8930db62c7ab972fa4a63cb03a2162857b08209 Mon Sep 17 00:00:00 2001 From: knoflook Date: Fri, 11 Oct 2024 11:52:02 +0200 Subject: [PATCH 6/6] fix: change image --- compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compose.yml b/compose.yml index addf5f6..0c098cf 100644 --- a/compose.yml +++ b/compose.yml @@ -3,7 +3,7 @@ version: "3.8" services: app: - image: kn0fl00k/uptime-kuma:unstable004 + image: git.coopcloud.tech/coop-cloud-chaos-patchs/uptime-kuma:latest volumes: - data:/app/data secrets: @@ -40,7 +40,7 @@ services: #- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect" #- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true" #- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}" - - "coop-cloud.${STACK_NAME}.version=0.6.0+unstable004" + - "coop-cloud.${STACK_NAME}.version=0.6.0+latest" healthcheck: test: 'curl -L localhost:3001' interval: 30s