From 9709f21c2b1e256a00a77a49e63168a7eb84424f Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 8 Jul 2023 09:58:45 +0200 Subject: [PATCH] improve docker-compose --- .env | 14 +++++++++-- backend/src/main.rs | 2 +- docker-compose.yml | 57 +++++++++++++++++++++++++-------------------- 3 files changed, 45 insertions(+), 28 deletions(-) diff --git a/.env b/.env index e90a555742..5eda4fcc8a 100644 --- a/.env +++ b/.env @@ -1,9 +1,19 @@ DB_PASSWORD=changeme +DATABASE_URL=postgres://postgres:changeme@db/windmill?sslmode=disable + +WML_IMAGE=ghcr.io/windmill-labs/windmill:main +WM_LICENSE_KEY="" + +# For Enterprise Edition, comment the 2 lines above and uncomment below +# WINDMILL_IMAGE=ghcr.io/windmill-labs/windmill-ee:main +# WM_LICENSE_KEY=".." + # this is the url that your instance is publicly exposed to WM_BASE_URL=http://localhost # To use another port than :80, setup the Caddyfile and the caddy section of the docker-compose to your needs: https://caddyserver.com/docs/getting-started +# To have caddy take care of automatic TLS -# License key for enterprise edition -# WM_LICENSE_KEY=".." \ No newline at end of file + +WM_REQUEST_SIZE_LIMIT=50097152 # 50MB (The size limit for any requests, including script/flow args inputs) diff --git a/backend/src/main.rs b/backend/src/main.rs index 902503ae4e..13e4e1b850 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -299,7 +299,7 @@ pub async fn run_workers 0 and not need any separate worker service but not recommended - NUM_WORKERS=0 - DISABLE_SERVER=false - METRICS_ADDR=false - - REQUEST_SIZE_LIMIT=2097152 # 2MB (The size limit for any requests, including script/flow args inputs) + - REQUEST_SIZE_LIMIT=${WM_REQUEST_SIZE_LIMIT} # LICENSE_KEY is only needed for the enterprise edition - # - LICENSE_KEY=${WM_LICENSE_KEY} + - LICENSE_KEY=${WM_LICENSE_KEY} depends_on: db: condition: service_healthy - # volumes: - # uncomment if using OAuth (https://docs.windmill.dev/docs/misc/setup_oauth) - # - ./oauth.json/:/usr/src/app/oauth.json + volumes: + # See Oauth (https://docs.windmill.dev/docs/misc/setup_oauth) + - ./oauth.json:/usr/src/app/oauth.json windmill_worker: # Use ghcr.io/windmill-labs/windmill-ee:main for the ee - image: ghcr.io/windmill-labs/windmill:main + image: ${WM_IMAGE} pull_policy: always deploy: replicas: 3 restart: unless-stopped environment: - - DATABASE_URL=postgres://postgres:${DB_PASSWORD}@db/windmill?sslmode=disable + - DATABASE_URL=${DATABASE_URL} - BASE_URL=${WM_BASE_URL} - RUST_LOG=info - DISABLE_SERVER=true @@ -61,27 +64,27 @@ services: # To handle all tags, remove the env variable altogether. If you do so, you can remove the windmill_worker_native containers. - WORKER_TAGS=deno,python3,go,bash,dependency,flow,hub,other,bun # LICENSE_KEY is only needed for the enterprise edition - # - LICENSE_KEY=${WM_LICENSE_KEY} + - LICENSE_KEY=${WM_LICENSE_KEY} depends_on: db: condition: service_healthy # to mount the worker folder to debug, KEEP_JOB_DIR=true and mount /tmp/windmill volumes: - # mount the docker socket to allow to run docker containers from within the workers - - /var/run/docker.sock:/var/run/docker.sock - # uncomment if using OAuth (https://docs.windmill.dev/docs/misc/setup_oauth) - # - ./oauth.json/:/usr/src/app/oauth.json + # mount the docker socket to allow to run docker containers from within the workers + - /var/run/docker.sock:/var/run/docker.sock + # See Oauth (https://docs.windmill.dev/docs/misc/setup_oauth) + - ./oauth.json:/usr/src/app/oauth.json ## This worker is specialized for "native" jobs. Jobs that are lightweight and run "in-process" and can thus be parallelized to more than 1 at a time on a given worker windmill_worker_native: # Use ghcr.io/windmill-labs/windmill-ee:main for the ee - image: ghcr.io/windmill-labs/windmill:main + image: ${WM_IMAGE} pull_policy: always deploy: replicas: 1 restart: unless-stopped environment: - - DATABASE_URL=postgres://postgres:${DB_PASSWORD}@db/windmill?sslmode=disable + - DATABASE_URL=${DATABASE_URL} - BASE_URL=${WM_BASE_URL} - RUST_LOG=info - DISABLE_SERVER=true @@ -94,9 +97,9 @@ services: depends_on: db: condition: service_healthy - # volumes: - # uncomment if using OAuth (https://docs.windmill.dev/docs/misc/setup_oauth) - # - ./oauth.json/:/usr/src/app/oauth.json + volumes: + # See Oauth (https://docs.windmill.dev/docs/misc/setup_oauth) + - ./oauth.json:/usr/src/app/oauth.json lsp: @@ -106,12 +109,14 @@ services: - 3001 volumes: - lsp_cache:/root/.cache - # Uncomment to enable multiplayer on the enterprise edition - # multiplayer: - # image: ghcr.io/windmill-labs/windmill-multiplayer:latest - # restart: unless-stopped - # expose: - # - 3002 + + multiplayer: + image: ghcr.io/windmill-labs/windmill-multiplayer:latest + deploy: + replicas: 0 # Set to 1 to enable multiplayer, only available on Enterprise Edition + restart: unless-stopped + expose: + - 3002 caddy: image: caddy:2.5.2-alpine @@ -123,8 +128,10 @@ services: ports: # To change the exposed port, simply change 80:80 to :80. No other changes needed - 80:80 + #- 443:443 # Uncomment to enable HTTPS handling by Caddy environment: - BASE_URL=":80" + #- BASE_URL=mydomain.com # Uncomment and comment line above to enable HTTPS handling by Caddy volumes: db_data: null