Add docker-compose.dokploy.yml — Dokploy rejects docker-compose.yml's include:
Confirmed on a real deploy: Dokploy's own compose validator fails with "Additional property include is not allowed" before docker compose ever runs, since it doesn't support the include: directive (open upstream issues Dokploy/dokploy#3116 and #1727, neither implemented). Added generate-dokploy-compose.sh to produce a flattened equivalent via `docker compose config --no-interpolate --no-path-resolution` — both flags load-bearing, not incidental (see the script's own header comment). Submodule fetch for frappe_docker (via Dokploy's Enable Submodules toggle) was confirmed working in the same deploy attempt. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y
This commit is contained in:
parent
016de0a78d
commit
0c1b8d7dc3
22
CLAUDE.md
22
CLAUDE.md
|
|
@ -57,7 +57,15 @@ sightbox/
|
|||
│ ├── BACKUP_RESTORE.md
|
||||
│ └── CICD_PLAYBOOK.md ← Gitea → Dokploy, gated on tests; Parts 1-2 are reusable
|
||||
│ for any other project, not just this one
|
||||
├── docker-compose.yml ← root-level launch path, see below
|
||||
├── docker-compose.yml ← root-level launch path for local dev, see below
|
||||
├── docker-compose.dokploy.yml ← GENERATED from docker-compose.yml — what Dokploy actually
|
||||
│ points at, since its validator rejects docker-compose.yml's
|
||||
│ `include:` directive (two open, unresolved upstream issues:
|
||||
│ github.com/Dokploy/dokploy/issues/3116 and /1727). Regenerate
|
||||
│ via ./generate-dokploy-compose.sh, never hand-edit.
|
||||
├── generate-dokploy-compose.sh ← produces docker-compose.dokploy.yml; see its own header
|
||||
│ comment for why --no-interpolate and --no-path-resolution
|
||||
│ are both load-bearing, not incidental flags
|
||||
├── docker-compose.data-dir.yml ← production-only: bind-mounts every volume under
|
||||
│ $SIGHTBOX_DATA_DIR — layer this on top on the real (Linux)
|
||||
│ host only, never on a macOS/Windows dev machine (see
|
||||
|
|
@ -103,8 +111,16 @@ sightbox/
|
|||
- **`backend/` gets its own `Dockerfile`**, built and run as its own
|
||||
service in the root compose file — small, independent, and easy to
|
||||
redeploy on its own if only the billing logic changes.
|
||||
- **Deployment target: Dokploy**, same as previously established — the
|
||||
root `docker-compose.yml` is what Dokploy points at.
|
||||
- **Deployment target: Dokploy** — but it points at `docker-compose.dokploy.yml`,
|
||||
**not** the root `docker-compose.yml`. Confirmed the hard way, on a real deploy:
|
||||
Dokploy's own compose validator rejects `docker-compose.yml`'s top-level
|
||||
`include:` directive outright ("Additional property include is not
|
||||
allowed") — a known, unresolved Dokploy limitation, not a mistake in this
|
||||
file. `docker-compose.dokploy.yml` is the same deployment, pre-flattened
|
||||
(`include:` resolved, `frappe_docker`'s files merged in) by
|
||||
`./generate-dokploy-compose.sh`. Regenerate it any time
|
||||
`docker-compose.yml` changes or `frappe_docker`'s pinned commit moves
|
||||
(`.gitmodules`); it's committed, generated output — never hand-edited.
|
||||
- **One VPS can host multiple clients.** `docker compose up` stands up one
|
||||
bench (the shared Frappe/ERPNext containers, MariaDB, Redis, and the
|
||||
`backend-billing` service) — it doesn't imply one client. Each client is
|
||||
|
|
|
|||
|
|
@ -0,0 +1,260 @@
|
|||
# GENERATED FILE — do not edit by hand.
|
||||
# Produced by ./generate-dokploy-compose.sh from docker-compose.yml + the
|
||||
# frappe_docker files it includes. Regenerate after changing either.
|
||||
# This is what Dokploy's Compose Path should point to — not
|
||||
# docker-compose.yml itself, which Dokploy's validator rejects (see
|
||||
# this script's own header comment for why).
|
||||
#
|
||||
name: sightbox
|
||||
networks:
|
||||
default:
|
||||
name: sightbox_default
|
||||
services:
|
||||
backend:
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
required: true
|
||||
environment:
|
||||
GUNICORN_THREADS: ${GUNICORN_THREADS:-4}
|
||||
GUNICORN_TIMEOUT: ${GUNICORN_TIMEOUT:-120}
|
||||
GUNICORN_WORKERS: ${GUNICORN_WORKERS:-2}
|
||||
image: ${CUSTOM_IMAGE:-frappe/erpnext}:${CUSTOM_TAG:-$ERPNEXT_VERSION}
|
||||
networks:
|
||||
default: null
|
||||
platform: ${FRAPPE_IMAGE_PLATFORM:-linux/amd64}
|
||||
pull_policy: ${PULL_POLICY:-always}
|
||||
restart: ${RESTART_POLICY:-unless-stopped}
|
||||
volumes:
|
||||
- source: sites
|
||||
target: /home/frappe/frappe-bench/sites
|
||||
type: volume
|
||||
volume: {}
|
||||
backend-billing:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_started
|
||||
required: true
|
||||
env_file:
|
||||
- path: ./backend/.env
|
||||
required: true
|
||||
networks:
|
||||
default: null
|
||||
ports:
|
||||
- ${BILLING_PUBLISH_PORT:-8001}:8000
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- source: billing-state
|
||||
target: /data
|
||||
type: volume
|
||||
volume: {}
|
||||
- bind:
|
||||
create_host_path: true
|
||||
read_only: true
|
||||
source: ./backend/tenants.json
|
||||
target: /app/tenants.json
|
||||
type: bind
|
||||
configurator:
|
||||
command:
|
||||
- |
|
||||
ls -1 apps > sites/apps.txt; bench set-config -g db_host $$DB_HOST; bench set-config -gp db_port $$DB_PORT; bench set-config -g redis_cache "redis://$$REDIS_CACHE"; bench set-config -g redis_queue "redis://$$REDIS_QUEUE"; bench set-config -g redis_socketio "redis://$$REDIS_QUEUE"; bench set-config -gp socketio_port $$SOCKETIO_PORT; bench set-config -g chromium_path /usr/bin/chromium-headless-shell;
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
required: true
|
||||
redis-cache:
|
||||
condition: service_started
|
||||
required: true
|
||||
redis-queue:
|
||||
condition: service_started
|
||||
required: true
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
environment:
|
||||
- DB_HOST=db
|
||||
- DB_PORT=3306
|
||||
- REDIS_CACHE=redis-cache:6379
|
||||
- REDIS_QUEUE=redis-queue:6379
|
||||
- SOCKETIO_PORT=9000
|
||||
image: ${CUSTOM_IMAGE:-frappe/erpnext}:${CUSTOM_TAG:-$ERPNEXT_VERSION}
|
||||
networks:
|
||||
default: null
|
||||
platform: ${FRAPPE_IMAGE_PLATFORM:-linux/amd64}
|
||||
pull_policy: ${PULL_POLICY:-always}
|
||||
restart: on-failure
|
||||
volumes:
|
||||
- source: sites
|
||||
target: /home/frappe/frappe-bench/sites
|
||||
type: volume
|
||||
volume: {}
|
||||
db:
|
||||
command:
|
||||
- --character-set-server=utf8mb4
|
||||
- --collation-server=utf8mb4_unicode_ci
|
||||
- --skip-character-set-client-handshake
|
||||
environment:
|
||||
MARIADB_AUTO_UPGRADE: 1
|
||||
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-123}
|
||||
healthcheck:
|
||||
interval: 5s
|
||||
retries: 5
|
||||
start_period: 5s
|
||||
test:
|
||||
- CMD
|
||||
- healthcheck.sh
|
||||
- --connect
|
||||
- --innodb_initialized
|
||||
timeout: 5s
|
||||
image: mariadb:11.8
|
||||
networks:
|
||||
default: null
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- source: db-data
|
||||
target: /var/lib/mysql
|
||||
type: volume
|
||||
volume: {}
|
||||
frontend:
|
||||
command:
|
||||
- nginx-entrypoint.sh
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_started
|
||||
required: true
|
||||
websocket:
|
||||
condition: service_started
|
||||
required: true
|
||||
environment:
|
||||
BACKEND: backend:8000
|
||||
CLIENT_MAX_BODY_SIZE: ${CLIENT_MAX_BODY_SIZE:-50m}
|
||||
FRAPPE_SITE_NAME_HEADER: ${FRAPPE_SITE_NAME_HEADER:-$$host}
|
||||
PROXY_READ_TIMEOUT: ${PROXY_READ_TIMEOUT:-120}
|
||||
SOCKETIO: websocket:9000
|
||||
UPSTREAM_REAL_IP_ADDRESS: ${UPSTREAM_REAL_IP_ADDRESS:-127.0.0.1}
|
||||
UPSTREAM_REAL_IP_HEADER: ${UPSTREAM_REAL_IP_HEADER:-X-Forwarded-For}
|
||||
UPSTREAM_REAL_IP_RECURSIVE: ${UPSTREAM_REAL_IP_RECURSIVE:-off}
|
||||
image: ${CUSTOM_IMAGE:-frappe/erpnext}:${CUSTOM_TAG:-$ERPNEXT_VERSION}
|
||||
networks:
|
||||
default: null
|
||||
platform: ${FRAPPE_IMAGE_PLATFORM:-linux/amd64}
|
||||
ports:
|
||||
- ${HTTP_PUBLISH_PORT:-8080}:8080
|
||||
pull_policy: ${PULL_POLICY:-always}
|
||||
restart: ${RESTART_POLICY:-unless-stopped}
|
||||
volumes:
|
||||
- source: sites
|
||||
target: /home/frappe/frappe-bench/sites
|
||||
type: volume
|
||||
volume: {}
|
||||
marketing:
|
||||
image: nginx:alpine
|
||||
networks:
|
||||
default: null
|
||||
ports:
|
||||
- ${MARKETING_PUBLISH_PORT:-8091}:80
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- bind:
|
||||
create_host_path: true
|
||||
read_only: true
|
||||
source: ./bettersightbox-index.html
|
||||
target: /usr/share/nginx/html/index.html
|
||||
type: bind
|
||||
queue-long:
|
||||
command: bench worker --queue long,default,short
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
required: true
|
||||
image: ${CUSTOM_IMAGE:-frappe/erpnext}:${CUSTOM_TAG:-$ERPNEXT_VERSION}
|
||||
networks:
|
||||
default: null
|
||||
platform: ${FRAPPE_IMAGE_PLATFORM:-linux/amd64}
|
||||
pull_policy: ${PULL_POLICY:-always}
|
||||
restart: ${RESTART_POLICY:-unless-stopped}
|
||||
volumes:
|
||||
- source: sites
|
||||
target: /home/frappe/frappe-bench/sites
|
||||
type: volume
|
||||
volume: {}
|
||||
queue-short:
|
||||
command: bench worker --queue short,default
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
required: true
|
||||
image: ${CUSTOM_IMAGE:-frappe/erpnext}:${CUSTOM_TAG:-$ERPNEXT_VERSION}
|
||||
networks:
|
||||
default: null
|
||||
platform: ${FRAPPE_IMAGE_PLATFORM:-linux/amd64}
|
||||
pull_policy: ${PULL_POLICY:-always}
|
||||
restart: ${RESTART_POLICY:-unless-stopped}
|
||||
volumes:
|
||||
- source: sites
|
||||
target: /home/frappe/frappe-bench/sites
|
||||
type: volume
|
||||
volume: {}
|
||||
redis-cache:
|
||||
image: redis:8.6-alpine
|
||||
networks:
|
||||
default: null
|
||||
restart: unless-stopped
|
||||
redis-queue:
|
||||
image: redis:8.6-alpine
|
||||
networks:
|
||||
default: null
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- source: redis-queue-data
|
||||
target: /data
|
||||
type: volume
|
||||
volume: {}
|
||||
scheduler:
|
||||
command: bench schedule
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
required: true
|
||||
image: ${CUSTOM_IMAGE:-frappe/erpnext}:${CUSTOM_TAG:-$ERPNEXT_VERSION}
|
||||
networks:
|
||||
default: null
|
||||
platform: ${FRAPPE_IMAGE_PLATFORM:-linux/amd64}
|
||||
pull_policy: ${PULL_POLICY:-always}
|
||||
restart: ${RESTART_POLICY:-unless-stopped}
|
||||
volumes:
|
||||
- source: sites
|
||||
target: /home/frappe/frappe-bench/sites
|
||||
type: volume
|
||||
volume: {}
|
||||
websocket:
|
||||
command:
|
||||
- node
|
||||
- /home/frappe/frappe-bench/apps/frappe/socketio.js
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
required: true
|
||||
image: ${CUSTOM_IMAGE:-frappe/erpnext}:${CUSTOM_TAG:-$ERPNEXT_VERSION}
|
||||
networks:
|
||||
default: null
|
||||
platform: ${FRAPPE_IMAGE_PLATFORM:-linux/amd64}
|
||||
pull_policy: ${PULL_POLICY:-always}
|
||||
restart: ${RESTART_POLICY:-unless-stopped}
|
||||
volumes:
|
||||
- source: sites
|
||||
target: /home/frappe/frappe-bench/sites
|
||||
type: volume
|
||||
volume: {}
|
||||
volumes:
|
||||
billing-state:
|
||||
name: sightbox_billing-state
|
||||
db-data:
|
||||
name: sightbox_db-data
|
||||
redis-queue-data:
|
||||
name: sightbox_redis-queue-data
|
||||
sites:
|
||||
name: sightbox_sites
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/env bash
|
||||
# Regenerates docker-compose.dokploy.yml from docker-compose.yml.
|
||||
#
|
||||
# Why this exists: Dokploy's own compose validator doesn't support the
|
||||
# top-level `include:` directive docker-compose.yml relies on to pull in
|
||||
# frappe_docker's compose files without duplicating them (confirmed against
|
||||
# a real deploy — "validating ...: (root) Additional property include is
|
||||
# not allowed" — and matches two open, unresolved Dokploy feature requests:
|
||||
# https://github.com/Dokploy/dokploy/issues/3116 (include support) and
|
||||
# https://github.com/Dokploy/dokploy/issues/1727 (multiple compose files).
|
||||
# Neither is implemented as of writing, so Dokploy needs one flat file with
|
||||
# no `include:` — this script produces exactly that.
|
||||
#
|
||||
# --no-interpolate is the deliberate, load-bearing flag here: it resolves
|
||||
# and flattens `include:` (merging in every frappe_docker file it
|
||||
# references) while leaving every ${VAR} reference as a literal string
|
||||
# instead of substituting today's local values into the committed file.
|
||||
# Without it, this file would bake in whatever's in the machine's .env at
|
||||
# generation time — including things like FRAPPE_IMAGE_PLATFORM=linux/arm64
|
||||
# on an Apple Silicon dev machine — permanently, defeating the entire point
|
||||
# of Dokploy's own Environment tab controlling these per deployment.
|
||||
#
|
||||
# --no-path-resolution is equally load-bearing: without it, Compose
|
||||
# resolves every relative path (`./backend`, `./bettersightbox-index.html`,
|
||||
# `./backend/tenants.json`, `./backend/.env`) to an *absolute* path on
|
||||
# whatever machine generates the file — confirmed by generating this once
|
||||
# without the flag and finding the generating machine's own home directory
|
||||
# baked into backend-billing's build context. The flag keeps them relative,
|
||||
# which is what actually works once Dokploy clones this repo to its own,
|
||||
# different path on the VPS.
|
||||
#
|
||||
# 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
|
||||
# is generated output, never hand-edited.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
OUT="docker-compose.dokploy.yml"
|
||||
|
||||
{
|
||||
echo "# GENERATED FILE — do not edit by hand."
|
||||
echo "# Produced by ./generate-dokploy-compose.sh from docker-compose.yml + the"
|
||||
echo "# frappe_docker files it includes. Regenerate after changing either."
|
||||
echo "# This is what Dokploy's Compose Path should point to — not"
|
||||
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
|
||||
} > "$OUT"
|
||||
|
||||
echo "Wrote ${OUT}."
|
||||
echo "Set Dokploy's Compose Path to ./${OUT}, not ./docker-compose.yml, and redeploy."
|
||||
|
|
@ -7,10 +7,15 @@ Sightbox-specific worked example.**
|
|||
|
||||
⚠ **Honesty check on this doc's confidence level:** every other guide in `playbook/` carries
|
||||
"confirmed the hard way" notes because it was built by breaking the real thing and fixing it live.
|
||||
This one hasn't been run against a real Gitea + Dokploy instance yet — it's built from Dokploy's
|
||||
and Gitea's own current docs, cross-checked while writing this. Treat Part 1 and 2 as the
|
||||
starting plan, not a proven runbook, until it's actually been walked end-to-end once. Update this
|
||||
file with real gotchas the first time that happens, the same way every other doc here was built.
|
||||
**Update, first real run:** the ungated route (A) — Gitea OAuth connection, manual webhook,
|
||||
Enable Submodules, Compose Path — has now been walked end-to-end for real against
|
||||
`git.bettertend.net` + a live Dokploy VPS for this project's own `sightbox` repo (see Part 3). Two
|
||||
real gotchas came out of it, both folded in below: the `include:` validator rejection (Part 3
|
||||
step 3, Known Pitfalls), and `backend/.env` needing to exist before Stage 1's first
|
||||
`docker compose up`, not deferred to Stage 9 (`INSTALLATION_PLAYBOOK.md`). **Still unconfirmed:**
|
||||
the gated route (B) — Gitea Actions, the `act_runner`, and the test-then-deploy workflow in Part
|
||||
1 Stages 2-3 and Part 2 Stages 2/5/6 — remains built from Dokploy's and Gitea's own docs, not yet
|
||||
run live. Treat those specific sections as the starting plan still, not a proven runbook.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -192,14 +197,23 @@ Applying the pattern above here, concretely:
|
|||
first `git status` before the first commit, since this is the one step where a mistake here
|
||||
ships a real secret into history permanently.
|
||||
2. Create a `sightbox` repo on Gitea, push, enable Actions on it (Part 2, Stage 2).
|
||||
3. In Dokploy, create a **Compose** application pointing at this repo's root `docker-compose.yml`
|
||||
(the same file Dokploy was already the stated deployment target for — see `CLAUDE.md`). Set
|
||||
the Compose file path if Dokploy asks, and set environment variables to match
|
||||
3. In Dokploy, create a **Compose** application pointing at this repo, **Compose Path
|
||||
`./docker-compose.dokploy.yml`** — ⚠ not `./docker-compose.yml`. Confirmed the hard way on a
|
||||
real deploy: Dokploy's own compose validator rejects `docker-compose.yml`'s top-level
|
||||
`include:` directive ("Additional property include is not allowed" — matches two open,
|
||||
unresolved Dokploy issues, [#3116](https://github.com/Dokploy/dokploy/issues/3116) and
|
||||
[#1727](https://github.com/Dokploy/dokploy/issues/1727)). `docker-compose.dokploy.yml` is the
|
||||
same deployment pre-flattened by `./generate-dokploy-compose.sh` — regenerate it any time
|
||||
`docker-compose.yml` changes, never hand-edit it. Also enable this Application's **Enable
|
||||
Submodules** toggle (confirmed working against our `frappe_docker` mirror submodule — see
|
||||
`.gitmodules`). Set environment variables to match
|
||||
`.env.example`/`backend/.env.example`/`backup/.env.example` — `SIGHTBOX_DATA_DIR`,
|
||||
`SENTRY_DSN`, `ENVIRONMENT=production`, and so on. `tenants.json` and `backup/.env` are files,
|
||||
not single env vars — those still get created directly on the VPS's filesystem per
|
||||
`INSTALLATION_PLAYBOOK.md` Stage 9/10, exactly as documented there; nothing about adding CI/CD
|
||||
changes that.
|
||||
`SENTRY_DSN`, `ENVIRONMENT=production`, and so on. `tenants.json`, `backup/.env`, and
|
||||
`backend/.env` are files, not env vars — those get created directly on the VPS's filesystem
|
||||
per `INSTALLATION_PLAYBOOK.md` Stage 1/9/10 (`backend/.env` specifically is a **Stage 1**
|
||||
requirement, not Stage 9 — it's loaded via `env_file:`, which Compose must resolve just to
|
||||
parse the config, so its absence fails the whole stack, not only `backend-billing`); nothing
|
||||
about adding CI/CD changes any of that.
|
||||
4. `.gitea/workflows/ci.yml`'s test step becomes:
|
||||
```yaml
|
||||
- name: Run backend test suite
|
||||
|
|
@ -315,6 +329,12 @@ redeploys → reachable at `https://app.example.com`.
|
|||
Stage 2 is easy to forget after Part 1, Stage 2 is already done once.
|
||||
- **OAuth-based Gitea↔Dokploy connection has an open scope bug as of writing** — prefer the manual
|
||||
webhook (or no webhook, for the gated route) over debugging it.
|
||||
- **Dokploy's compose validator rejects `include:`** — confirmed on a real deploy, not just read
|
||||
about: `docker-compose.yml`'s `include:` directive (used to pull in `frappe_docker`'s files
|
||||
without duplicating them) fails Dokploy's own pre-flight validation with "Additional property
|
||||
include is not allowed," before `docker compose` itself ever runs. Point Dokploy's Compose Path
|
||||
at `docker-compose.dokploy.yml` instead (generated via `./generate-dokploy-compose.sh`) — see
|
||||
Part 3, step 3.
|
||||
- **Secrets never travel through git, ever** — every environment variable and credential file in
|
||||
this pipeline is either typed into Dokploy's UI directly or created by hand on the VPS. If a
|
||||
step in this doc ever seems to imply committing one, that's a mistake in the doc, not a
|
||||
|
|
|
|||
Loading…
Reference in New Issue