From e5e9212332835cdf2c577ace069121624937d59c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 21 Aug 2026 08:52:51 +0000 Subject: [PATCH 1/4] Remove redundant hardcoded GRANT in db/data.sql The GRANT SYSTEM_USER statement hardcoded 'mysql_user' as the username, breaking any fresh install that uses a different MYSQL_USER value (fails with 'You are not allowed to create a user with GRANT' on MySQL 8.4 since that literal user doesn't exist). db/init-grants.sh already does this exact grant correctly and dynamically via ${MYSQL_USER}, so the line in data.sql was both redundant and the actual cause of the bug. Removing it lets a fresh install use any DB username. --- db/data.sql | 4 ---- 1 file changed, 4 deletions(-) diff --git a/db/data.sql b/db/data.sql index 135fba0e..5b5a7840 100644 --- a/db/data.sql +++ b/db/data.sql @@ -5,10 +5,6 @@ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; --- Ensure app DB user has SYSTEM_USER dynamic privilege -GRANT SYSTEM_USER ON *.* TO 'mysql_user'@'%'; -FLUSH PRIVILEGES; - -- ============================================================ -- Table: migrations -- Stores migration history From 87cec4c439e4a182c683dba76239c44d9038e5f1 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 21 Aug 2026 09:01:30 +0000 Subject: [PATCH 2/4] Add standalone db/docker-compose.yml for a shared MySQL instance Extracted the database+phpmyadmin services from the root docker-compose.yml into their own file, meant to be deployed once and shared across every app instead of bundling a dedicated MySQL into each app's own stack. Reaches consumers over the external dokploy-network. --- db/docker-compose.yml | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 db/docker-compose.yml diff --git a/db/docker-compose.yml b/db/docker-compose.yml new file mode 100644 index 00000000..0c982436 --- /dev/null +++ b/db/docker-compose.yml @@ -0,0 +1,44 @@ +version: "3" + +# Standalone MySQL + phpMyAdmin, meant to be deployed on its own (not +# bundled into an app's stack) and shared across every app that needs it. +# Each app gets its own database + dedicated user created on this one +# server (see README below) and reaches it over the `dokploy-network` +# external network. +services: + database: + container_name: database + restart: unless-stopped + build: + context: . + cap_add: + - SYS_NICE + command: --mysql-native-password=ON + environment: + MYSQL_DATABASE: $MYSQL_DATABASE + MYSQL_USER: $MYSQL_USER + MYSQL_PASSWORD: $MYSQL_PASSWORD + MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD + volumes: + - "db_data:/var/lib/mysql" + networks: + - dokploy-network + + phpmyadmin: + container_name: php-myadmin + restart: unless-stopped + depends_on: + - database + image: phpmyadmin + environment: + PMA_HOST: database + MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD + networks: + - dokploy-network + +volumes: + db_data: + +networks: + dokploy-network: + external: true From 8f3f3302ffc2937e392c1bbedf755ebb3cda0ed3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 22 Aug 2026 18:17:21 +0000 Subject: [PATCH 3/4] Add docker-compose-dokploy.yml for the Dokploy deployment path Mirrors docker-compose-swarm.yml (client+server, prebuilt ghcr images) but targets dokploy-network instead of the Coolify-specific caddy/elknet/private-network/backend-network networks, so it can be deployed via Dokploy's git-based compose without editing (and risking) the file the existing Coolify deployment relies on. --- docker-compose-dokploy.yml | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 docker-compose-dokploy.yml diff --git a/docker-compose-dokploy.yml b/docker-compose-dokploy.yml new file mode 100644 index 00000000..8ad2bdf4 --- /dev/null +++ b/docker-compose-dokploy.yml @@ -0,0 +1,56 @@ +version: "3.8" + +# client+server only, pointed at an external shared MySQL (see +# db/docker-compose.yml) over Dokploy's dokploy-network. Mirrors +# docker-compose-swarm.yml but targets Dokploy instead of Coolify — +# that file's caddy/elknet/private-network/backend-network networks +# are Coolify-specific and don't exist under Dokploy, so it can't be +# reused as-is without breaking the deployment(s) that already rely +# on it. +services: + client: + image: 'ghcr.io/buzz-code/react-admin-nestjs-client:latest' + container_name: client + restart: unless-stopped + depends_on: + - server + healthcheck: + test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80/"] + interval: 30s + timeout: 10s + start_period: 60s + retries: 3 + environment: + PORT: 80 + REACT_APP_API_URL: 'https://api.$DOMAIN_NAME' + networks: + - dokploy-network + + server: + image: 'ghcr.io/buzz-code/react-admin-nestjs-server:latest' + container_name: server + restart: unless-stopped + healthcheck: + test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"] + interval: 30s + timeout: 10s + start_period: 60s + retries: 3 + environment: + DOMAIN_NAME: $DOMAIN_NAME + MYSQL_HOST: $MYSQL_HOST + MYSQL_USER: $MYSQL_USER + MYSQL_PASSWORD: $MYSQL_PASSWORD + MYSQL_DATABASE: $MYSQL_DATABASE + JWT_SECRET: $JWT_SECRET + ADMIN_USER: $ADMIN_USER + SMTP_USER: $SMTP_USER + SMTP_PASSWORD: $SMTP_PASSWORD + MAINTENANCE_MODE: $MAINTENANCE_MODE + MAINTENANCE_MESSAGE: $MAINTENANCE_MESSAGE + networks: + - dokploy-network + +networks: + dokploy-network: + external: true From ec09d3ec34bf9e1dd8a471b03bd952c042213d34 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 22 Aug 2026 20:27:52 +0000 Subject: [PATCH 4/4] Fix client healthcheck: use 127.0.0.1 instead of localhost The client container was reporting unhealthy indefinitely -- nginx's own access log never showed a single hit from the healthcheck itself, meaning the wget exec was failing before ever reaching nginx, not after. Docker-unhealthy containers get excluded from Traefik's routing pool entirely, which is why the client's domain returned a bare 404 with no route at all, unlike the server (healthy, routed fine). --- docker-compose-dokploy.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose-dokploy.yml b/docker-compose-dokploy.yml index 8ad2bdf4..41f7b059 100644 --- a/docker-compose-dokploy.yml +++ b/docker-compose-dokploy.yml @@ -15,7 +15,11 @@ services: depends_on: - server healthcheck: - test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80/"] + # 127.0.0.1, not localhost -- localhost resolution is + # unreliable in this image and silently fails the wget + # exec, which Traefik then reads as unhealthy and refuses + # to route to at all. + test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:80/"] interval: 30s timeout: 10s start_period: 60s