mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 08:01:26 +00:00
2f6c35b15b
* fix(self-host): accept pre-2.11 Caddyfiles in the caddy-l4 image The Caddyfile is a bind-mounted file the user owns, so `docker compose pull` updates the image but never their config. #10106 and #10113 changed the syntax the image requires (native caddy-l4 `route { proxy { upstream } }`, and a non-empty `bind`), which strands every existing self-host on their next pull: Error: adapting config using caddyfile: parsing caddyfile tokens for 'layer4': wrong argument count or unexpected line ending after 'proxy', at line 4 Normalize legacy Caddyfiles in the entrypoint instead. Only rewrite when the config cannot be used as-is, and on any failure exec caddy against the user's original file so it reports a real error against what they wrote. The bind rewrite is not cosmetic: an empty `bind {$ADDRESS}` adapts and validates cleanly on caddy >= 2.9 but drops the whole HTTP site, so a syntax-only shim would trade a restart loop for a container that boots clean and serves nothing on :80. The reference for correctness is the image published before #10106 (sha-989c9e6): whatever it adapts today is what self-hosters run, so the shim must reproduce it byte for byte. docker/test-caddy-compat.sh asserts that over five legacy variants, plus the :80 listener under an unset ADDRESS, every --config spelling, relative and glob imports, and the no-op on the current Caddyfile. Details worth knowing: - `to a b` becomes one `upstream` per address; `upstream a b` would be a single upstream with two dials, which is a different load-balancing topology. - The rewrite lands next to the original, because caddy resolves `import` relative to the importing file and a glob import would otherwise silently expand to nothing. - The image has no ENTRYPOINT and CMD ["caddy", ...], so an existing `command:` override starts with a `caddy` token the entrypoint absorbs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(self-host): route ws_mp and ws_debug to the extra gateway reverse_proxy only reads its first argument as a matcher, so reverse_proxy /ws/* /ws_mp/* /ws_debug/* http://windmill_extra:3000 adapts to a single /ws/* route whose upstreams are `ws_mp/*:80`, `ws_debug/*:80` and `windmill_extra:3000`. LSP therefore round-robins across two garbage hostnames and connects only one time in three, while /ws_mp/* and /ws_debug/* match no route at all and fall through to windmill_server:8000. Use a named matcher so all three paths reach the gateway. Verified with traffic against separate windmill_server and windmill_extra backends: before, /ws/lsp fails and /ws_mp/room reaches windmill_server; after, all three reach the gateway with the path preserved and /user/login still reaches windmill_server. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore(self-host): pin the caddy-l4 image to an explicit version :latest and the bind-mounted ./Caddyfile it has to agree with are updated by different mechanisms, so they drift. Publish an explicit version alongside :latest and pin docker-compose.yml to it, so a checkout is self-consistent: compose, Caddyfile and image version now move together in one commit. CI fails the build when docker/caddy-l4.version and the docker-compose.yml pin disagree, and runs the compatibility-shim tests before publishing. The path filter now covers the entrypoint, the normalizer, the Caddyfile and docker-compose.yml, so a change to any guarded input actually triggers the workflow rather than leaving the check unrun. :latest keeps being published, since existing deployments reference it and that is how they pick up the compatibility shim. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(self-host): make the caddy-l4 version tag publishable before the pin merges docker-compose.yml pins an exact tag, but the version tag was gated on the default branch, so the tag only appeared after the pin had already merged. Between the merge and the build finishing, a fresh `docker compose up -d` off main fails with "manifest unknown", and a failed build leaves main permanently referencing an image that does not exist. Drop the gate so the tag can be published from the branch via workflow_dispatch before merging the pin. The version is immutable, so republishing it from main is a no-op, and only pushes to main and manual dispatch run this workflow, so a branch cannot claim the tag by accident. :latest stays gated on main. Also check the version file against the caddy version the Dockerfile pins. Without it, a caddy bump that forgets the version file publishes a tag naming the wrong caddy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(self-host): do not log Caddyfile contents from the compat shim The shim logged a unified diff of the rewrite, which carries three lines of context around each change. A Caddyfile is user-owned and can hold basic_auth hashes, proxy Authorization headers or TLS provider tokens, and container logs are routinely shipped off the host, so normalizing a customized config could copy secrets into them. Reproduced with a basic_auth bcrypt hash landing in the log as context around the bind rewrite. Log the number of rewritten lines and the path to the rewritten file instead. It sits next to the original, so an operator can diff it themselves. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
222 lines
7.7 KiB
YAML
222 lines
7.7 KiB
YAML
version: "3.7"
|
|
|
|
x-logging: &default-logging
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "${LOG_MAX_SIZE:-20m}"
|
|
max-file: "${LOG_MAX_FILE:-10}"
|
|
compress: "true"
|
|
|
|
services:
|
|
db:
|
|
deploy:
|
|
# To use an external database, set replicas to 0 and set DATABASE_URL to the external database url in the .env file
|
|
replicas: 1
|
|
image: postgres:16
|
|
shm_size: 1g
|
|
restart: unless-stopped
|
|
volumes:
|
|
- db_data:/var/lib/postgresql/data
|
|
expose:
|
|
- 5432
|
|
environment:
|
|
POSTGRES_PASSWORD: changeme
|
|
POSTGRES_DB: windmill
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
logging: *default-logging
|
|
|
|
windmill_server:
|
|
image: ${WM_IMAGE}
|
|
pull_policy: always
|
|
deploy:
|
|
replicas: 1
|
|
restart: unless-stopped
|
|
expose:
|
|
- 8000
|
|
- 2525
|
|
environment:
|
|
- DATABASE_URL=${DATABASE_URL}
|
|
- MODE=server
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
volumes:
|
|
- worker_logs:/tmp/windmill/logs
|
|
|
|
logging: *default-logging
|
|
|
|
windmill_worker:
|
|
image: ${WM_IMAGE}
|
|
pull_policy: always
|
|
deploy:
|
|
replicas: 3
|
|
resources:
|
|
limits:
|
|
memory: 2048M
|
|
# for GB, use syntax '2Gi'
|
|
restart: unless-stopped
|
|
# Uncomment to enable PID namespace isolation (recommended for security)
|
|
# Requires privileged mode for --mount-proc flag
|
|
# See: https://www.windmill.dev/docs/advanced/security_isolation
|
|
privileged: true
|
|
environment:
|
|
- DATABASE_URL=${DATABASE_URL}
|
|
- MODE=worker
|
|
- WORKER_GROUP=default
|
|
# If running with non-root/non-windmill UID (e.g., user: "1001:1001"),
|
|
# add: - HOME=/tmp
|
|
- FAVOR_UNSHARE_PID=true
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
# to mount the worker folder to debug, KEEP_JOB_DIR=true and mount /tmp/windmill
|
|
volumes:
|
|
- worker_dependency_cache:/tmp/windmill/cache
|
|
- worker_logs:/tmp/windmill/logs
|
|
## Sandboxed containers (`# sandbox <image>`) run daemonless via crane + nsjail
|
|
## inside the worker itself — no Docker socket or dind sidecar required.
|
|
## For the legacy full-compat docker (a bare `# docker`, trusted users only),
|
|
## mount the host Docker socket by uncommenting the line below. WARNING: this
|
|
## grants user scripts full access to the host Docker daemon (host filesystem
|
|
## access and privilege escalation) — only use it if you fully trust all users.
|
|
# - /var/run/docker.sock:/var/run/docker.sock
|
|
|
|
logging: *default-logging
|
|
|
|
## This worker is specialized for "native" jobs. Native jobs run in-process and thus are much more lightweight than other jobs
|
|
windmill_worker_native:
|
|
# Use ghcr.io/windmill-labs/windmill-ee:main for the ee
|
|
image: ${WM_IMAGE}
|
|
pull_policy: always
|
|
deploy:
|
|
replicas: 1
|
|
resources:
|
|
limits:
|
|
memory: 2048M
|
|
# for GB, use syntax '2Gi'
|
|
restart: unless-stopped
|
|
# Uncomment to enable PID namespace isolation (recommended for security)
|
|
# Requires privileged mode for --mount-proc flag
|
|
# See: https://www.windmill.dev/docs/advanced/security_isolation
|
|
environment:
|
|
- DATABASE_URL=${DATABASE_URL}
|
|
- MODE=worker
|
|
- WORKER_GROUP=native
|
|
- NATIVE_MODE=true
|
|
- SLEEP_QUEUE=200
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
volumes:
|
|
- worker_logs:/tmp/windmill/logs
|
|
logging: *default-logging
|
|
# This worker is specialized for reports or scraping jobs. It is assigned the "reports" worker group which has an init script that installs chromium and can be targeted by using the "chromium" worker tag.
|
|
# windmill_worker_reports:
|
|
# image: ${WM_IMAGE}
|
|
# pull_policy: always
|
|
# deploy:
|
|
# replicas: 1
|
|
# resources:
|
|
# limits:
|
|
# memory: 2048M
|
|
# # for GB, use syntax '2Gi'
|
|
# restart: unless-stopped
|
|
# # Uncomment to enable PID namespace isolation (recommended for security)
|
|
# # Requires privileged mode for --mount-proc flag
|
|
# # See: https://www.windmill.dev/docs/advanced/security_isolation
|
|
# privileged: true
|
|
# environment:
|
|
# - DATABASE_URL=${DATABASE_URL}
|
|
# - MODE=worker
|
|
# - WORKER_GROUP=reports
|
|
# - FAVOR_UNSHARE_PID=true
|
|
# depends_on:
|
|
# db:
|
|
# condition: service_healthy
|
|
# # to mount the worker folder to debug, KEEP_JOB_DIR=true and mount /tmp/windmill
|
|
# volumes:
|
|
# - worker_dependency_cache:/tmp/windmill/cache
|
|
# - worker_logs:/tmp/windmill/logs
|
|
|
|
# The indexer powers full-text job and log search, an EE feature.
|
|
windmill_indexer:
|
|
image: ${WM_IMAGE}
|
|
pull_policy: always
|
|
deploy:
|
|
replicas: 0 # set to 1 to enable full-text job and log search
|
|
restart: unless-stopped
|
|
expose:
|
|
- 8002
|
|
environment:
|
|
- PORT=8002
|
|
- DATABASE_URL=${DATABASE_URL}
|
|
- MODE=indexer
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
volumes:
|
|
- windmill_index:/tmp/windmill/search
|
|
- worker_logs:/tmp/windmill/logs
|
|
logging: *default-logging
|
|
|
|
# Combined extra services: LSP, Multiplayer, and Debugger
|
|
# Each service can be enabled/disabled via environment variables:
|
|
# - ENABLE_LSP=true (default) - Language Server Protocol for code intelligence
|
|
# - ENABLE_MULTIPLAYER=false - Real-time collaboration (Enterprise Edition)
|
|
# - ENABLE_DEBUGGER=false - Interactive debugging via DAP WebSocket
|
|
windmill_extra:
|
|
image: ghcr.io/windmill-labs/windmill-extra:latest
|
|
pull_policy: always
|
|
restart: unless-stopped
|
|
expose:
|
|
- 3001 # LSP
|
|
- 3002 # Multiplayer
|
|
- 3003 # Debugger
|
|
environment:
|
|
- ENABLE_LSP=true
|
|
- ENABLE_MULTIPLAYER=false # Set to true to enable multiplayer (Enterprise Edition)
|
|
- ENABLE_DEBUGGER=true # Set to true to enable debugger
|
|
- DEBUGGER_PORT=3003 # Debugger service port
|
|
- ENABLE_NSJAIL=false # Set to true for nsjail sandboxing (requires privileged: true)
|
|
- REQUIRE_SIGNED_DEBUG_REQUESTS=true # Require backend-signed JWT tokens for debug sessions. Do NOT set to false on any internet-reachable deployment: it exposes an unauthenticated code-execution debugger.
|
|
- WINDMILL_BASE_URL=http://windmill_server:8000
|
|
# - DEBUG_ALLOWED_ORIGINS=https://your-windmill-host # Optional CSWSH hardening: comma-separated allowlist of browser Origins permitted to open debug WebSockets
|
|
volumes:
|
|
- lsp_cache:/pyls/.cache
|
|
logging: *default-logging
|
|
|
|
caddy:
|
|
# Pinned: this image and the ./Caddyfile next to it are version-coupled, so
|
|
# they have to move together. Bump docker/caddy-l4.version in the same
|
|
# commit as any Caddyfile change.
|
|
image: ghcr.io/windmill-labs/caddy-l4:2.11.4-1
|
|
restart: unless-stopped
|
|
# Configure the mounted Caddyfile and the exposed ports or use another reverse proxy if needed
|
|
volumes:
|
|
- ./Caddyfile:/etc/caddy/Caddyfile
|
|
- caddy_data:/data
|
|
# - ./certs:/certs # Provide custom certificate files like cert.pem and key.pem to enable HTTPS - See the corresponding section in the Caddyfile
|
|
ports:
|
|
# To change the exposed port, simply change 80:80 to <desired_port>:80. No other changes needed
|
|
- 80:80
|
|
- 25:25
|
|
# - 443:443 # Uncomment to enable HTTPS handling by Caddy
|
|
environment:
|
|
- BASE_URL=":80"
|
|
# - BASE_URL=":443" # uncomment and comment line above to enable HTTPS via custom certificate and key files
|
|
# - BASE_URL=mydomain.com # Uncomment and comment line above to enable HTTPS handling by Caddy
|
|
logging: *default-logging
|
|
|
|
volumes:
|
|
db_data: null
|
|
worker_dependency_cache: null
|
|
worker_logs: null
|
|
worker_memory: null
|
|
windmill_index: null
|
|
lsp_cache: null
|
|
caddy_data: null
|