Compare commits

...
Author SHA1 Message Date
knoflook 80334f05f3 chore: publish 1.0.0+latest release 2024-11-14 13:42:48 +01:00
knoflook 616b87296d Merge branch 'mariadb' 2024-11-14 13:34:50 +01:00
knoflook a8930db62c fix: change image 2024-10-11 11:52:02 +02:00
knoflook e927d30f74 feat: fully working mariadb 2024-10-10 18:03:24 +02:00
knoflook f82019e24b chore: bump entrypoint version 2024-10-08 14:41:17 +02:00
knoflook a443813998 fix: invalid secret name 2024-10-08 14:41:17 +02:00
knoflook 9ab54dbf8d add mariadb support 2024-10-08 14:41:16 +02:00
knoflook 0d32e289b3 dirty commit for mariadb 2024-10-01 15:51:04 +02:00
knoflook c755e8e0e2 chore: bump entrypoint version 2024-07-09 16:21:04 +02:00
3wordchant 96faa55289 Add db volume 2024-07-02 13:54:04 -04:00
3wordchant 1b7a48d51d chore: publish 0.5.1+1.23.11-alpine release 2024-07-02 13:04:01 -04:00
knoflook 6dd9c27970 fix: invalid secret name 2024-06-20 15:37:31 +02:00
knoflook eb848af0ad add mariadb support 2024-06-20 15:36:08 +02:00
3wordchant 99fdef2393 chore: publish 0.5.0+1.23.11 release 2024-03-04 13:23:52 -03:00
3wordchant 53b7cf592c Add healthcheck, start-first 2024-03-04 13:22:18 -03:00
6 changed files with 144 additions and 10 deletions
+3
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
export APP_ENTRYPOINT_VERSION=v2
+59 -10
View File
@@ -3,14 +3,33 @@ version: "3.8"
services:
app:
image: louislam/uptime-kuma:1.23.11
image: git.coopcloud.tech/coop-cloud-chaos-patchs/uptime-kuma:latest
volumes:
- data:/app/data
secrets:
- db_password
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
depends_on:
- db
configs:
- source: app_entrypoint
target: /docker-entrypoint.sh
mode: 0555
entrypoint: /docker-entrypoint.sh
deploy:
# restart_policy:
# condition: on-failure
update_config:
failure_action: rollback
order: start-first
labels:
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=3001"
@@ -21,17 +40,47 @@ 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.4.2+1.23.11"
# healthcheck:
# test: ["CMD-SHELL", 'curl localhost:3001']
# interval: 30s
# timeout: 10s
# retries: 5
# start_period: 2m
- "coop-cloud.${STACK_NAME}.version=1.0.0+latest"
healthcheck:
test: "wget -nv -t1 --spider 'http://localhost:3001/' || exit 1"
interval: 30s
timeout: 10s
retries: 5
start_period: 2m
db:
image: mariadb:11.5
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_${SECRET_DB_PASSWORD_VERSION}
db_root_password:
external: true
name: ${STACK_NAME}_db_root_password_${SECRET_DB_ROOT_PASSWORD_VERSION}
configs:
app_entrypoint:
name: ${STACK_NAME}_app_entrypoint_${APP_ENTRYPOINT_VERSION}
file: entrypoint.sh.tmpl
template_driver: golang
+31
View File
@@ -0,0 +1,31 @@
#!/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
+29
View File
@@ -0,0 +1,29 @@
!!BREAKING CHANGE!!
this version is using self-built docker image for uptime kuma to incorporate mariadb which is not officially supported yet. Performance with sqlite was really bad and uptime kuma became unusable at some point. Upgrading to this version requires manually exporting sqlite database and converting it to mariadb. Additionally there's been changes to the database structure between last published version in this so it's not enough to just export the tables, you actually need to add a bunch of fields. And importing groups and other tables is a big hassle, better stick to just `monitor`...
Here's some python to help you with this.
```
#!/usr/bin/python3
og = open("original.sql", "r")
new = open("ported.sql", "w")
for line in og:
newline = line
if line.startswith("INSERT INTO monitor VALUES"):
newarr = line[27:-3].split(",")
if len(newarr) == 77:
kafka_producer_ssl_and_topic = ["0", "0"]
arr = newarr[:66] + kafka_producer_ssl_and_topic + newarr[66:75] + ["'keyword'", "NULL", "NULL", "'2c'", "NULL", "0", "'{}'"]
newline = "INSERT INTO monitor VALUES(" + ",".join(arr) + ");\n"
else:
newline = "--" + line
else:
pass
new.writelines(newline)
og.close()
new.close()
```
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/python3
og = open("original.sql", "r")
new = open("ported.sql", "w")
for line in og:
newline = line
if line.startswith("INSERT INTO monitor VALUES"):
newarr = line[27:-3].split(",")
if len(newarr) == 77:
kafka_producer_ssl_and_topic = ["0", "0"]
arr = newarr[:66] + kafka_producer_ssl_and_topic + newarr[66:75] + ["'keyword'", "NULL", "NULL", "'2c'", "NULL", "0", "'{}'"]
newline = "INSERT INTO monitor VALUES(" + ",".join(arr) + ");\n"
else:
newline = "--" + line
else:
pass
new.writelines(newline)
og.close()
new.close()