diff --git a/docker-compose.dokploy.yml b/docker-compose.dokploy.yml index dc95ba5..eb6fa1d 100644 --- a/docker-compose.dokploy.yml +++ b/docker-compose.dokploy.yml @@ -39,8 +39,7 @@ services: condition: service_started required: true env_file: - - path: ./backend/.env - required: true + - ./backend/.env networks: default: null ports: diff --git a/generate-dokploy-compose.sh b/generate-dokploy-compose.sh index 7c1b766..1692851 100755 --- a/generate-dokploy-compose.sh +++ b/generate-dokploy-compose.sh @@ -29,6 +29,20 @@ # which is what actually works once Dokploy clones this repo to its own, # different path on the VPS. # +# A second, separate Dokploy validator limitation, also confirmed on a real +# deploy: it rejects Compose's long-form `env_file` entries too — +# `services.backend-billing.env_file.0 must be a string` — because +# `docker compose config` always expands `env_file: [./backend/.env]` to +# the long form (`- path: ./backend/.env` / `required: true`) in its output, +# with no flag to suppress it (checked: --no-normalize doesn't affect this +# either). The Python filter below collapses that structure back to the +# plain string form, for every service, not just backend-billing — safe to +# do broadly, since the short form already implies "must exist", the exact +# behavior `required: true` spells out. Left alone: `depends_on`'s own, +# unrelated `required:` field (a different Compose feature entirely, and +# not something Dokploy's validator objects to), which this filter's regex +# only matches directly beneath a `- path:` line, not there. +# # Usage: ./generate-dokploy-compose.sh # Run this any time docker-compose.yml changes, or any time frappe_docker # is repointed at a different pinned commit (see .gitmodules) — this file @@ -49,7 +63,14 @@ OUT="docker-compose.dokploy.yml" echo "# docker-compose.yml itself, which Dokploy's validator rejects (see" echo "# this script's own header comment for why)." echo "#" - docker compose -f docker-compose.yml config --no-interpolate --no-path-resolution + docker compose -f docker-compose.yml config --no-interpolate --no-path-resolution \ + | python3 -c " +import sys, re +text = sys.stdin.read() +pattern = re.compile(r'^(\s*)- path: (.+)\n\s*required: (?:true|false)\s*\$', re.MULTILINE) +text = pattern.sub(lambda m: f'{m.group(1)}- {m.group(2)}', text) +sys.stdout.write(text) +" } > "$OUT" echo "Wrote ${OUT}."