From f2d05909e0cff2e8855e6bdaeff8b16e007bb2f4 Mon Sep 17 00:00:00 2001 From: Alexander Petric Date: Fri, 14 Feb 2025 14:48:33 -0500 Subject: [PATCH] feat: adding docker log rotation by default in docker compose (#5295) * feat: adding docker log rotation by default in docker compose * add newline * add compression --- .env | 4 ++++ docker-compose.yml | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.env b/.env index d4a48661cd..da41f78d5c 100644 --- a/.env +++ b/.env @@ -7,3 +7,7 @@ WM_IMAGE=ghcr.io/windmill-labs/windmill:main # 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 + +# To rotate logs, set the following variables: +#LOG_MAX_SIZE=10m +#LOG_MAX_FILE=3 diff --git a/docker-compose.yml b/docker-compose.yml index df2a99b38d..a8ac7ba565 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,12 @@ 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: @@ -22,6 +29,7 @@ services: interval: 10s timeout: 5s retries: 5 + logging: *default-logging windmill_server: image: ${WM_IMAGE} @@ -40,6 +48,7 @@ services: condition: service_healthy volumes: - worker_logs:/tmp/windmill/logs + logging: *default-logging windmill_worker: image: ${WM_IMAGE} @@ -65,6 +74,7 @@ services: - /var/run/docker.sock:/var/run/docker.sock - worker_dependency_cache:/tmp/windmill/cache - worker_logs:/tmp/windmill/logs + 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: @@ -90,6 +100,7 @@ services: 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} @@ -135,6 +146,7 @@ services: volumes: - windmill_index:/tmp/windmill/search - worker_logs:/tmp/windmill/logs + logging: *default-logging lsp: image: ghcr.io/windmill-labs/windmill-lsp:latest @@ -144,6 +156,7 @@ services: - 3001 volumes: - lsp_cache:/pyls/.cache + logging: *default-logging multiplayer: image: ghcr.io/windmill-labs/windmill-multiplayer:latest @@ -152,6 +165,7 @@ services: restart: unless-stopped expose: - 3002 + logging: *default-logging caddy: image: ghcr.io/windmill-labs/caddy-l4:latest @@ -170,6 +184,7 @@ services: - 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