From a3f1c6f4ee1d7e50e51512c7d8730127fce0d1b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 20 Jan 2025 10:38:16 +0100 Subject: [PATCH] chore: apply dclint fixes Fixes applied manually. For automated inclusion there is issue with YAML output it generates. --- .dclintrc | 3 + .pre-commit-config.yaml | 12 +++ docker-compose-https.yml | 57 ++++++------- docker-compose-single-celery.yml | 39 ++++----- docker-compose-split.yml | 139 ++++++++++++++++--------------- docker-compose.yml | 39 ++++----- 6 files changed, 154 insertions(+), 135 deletions(-) create mode 100644 .dclintrc diff --git a/.dclintrc b/.dclintrc new file mode 100644 index 0000000..59eb6b2 --- /dev/null +++ b/.dclintrc @@ -0,0 +1,3 @@ +rules: + no-unbound-port-interfaces: 0 + service-image-require-explicit-tag: 0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04145e9..c396da7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,6 +45,18 @@ repos: rev: v3.10.0-2 hooks: - id: shfmt +# TODO: find a way to make it compatible with our YAML formatting +#- repo: local +# hooks: +# - id: dclint +# name: Docker Compose Linter +# entry: dclint . --fix +# language: node +# require_serial: true +# pass_filenames: false +# additional_dependencies: +# - dclint@2.2.2 + ci: autoupdate_schedule: quarterly diff --git a/docker-compose-https.yml b/docker-compose-https.yml index 723dc5b..47b150c 100644 --- a/docker-compose-https.yml +++ b/docker-compose-https.yml @@ -1,47 +1,48 @@ +name: Weblate (HTTPS) services: - weblate: - image: weblate/weblate - tmpfs: - - /run - - /tmp + cache: + image: redis:7-alpine volumes: - - weblate-data:/app/data - - weblate-cache:/app/cache - env_file: - - ./environment + - redis-data:/data + command: [redis-server, --save, '60', '1'] restart: always read_only: true - depends_on: - - database - - cache - environment: - WEBLATE_ENABLE_HTTPS: 1 - WEBLATE_IP_PROXY_HEADER: HTTP_X_FORWARDED_FOR database: image: postgres:17-alpine - env_file: - - ./environment volumes: - postgres-data:/var/lib/postgresql/data + env_file: + - ./environment restart: always - cache: - image: redis:7-alpine - restart: always - read_only: true - command: [redis-server, --save, '60', '1'] - volumes: - - redis-data:/data https-portal: image: steveltn/https-portal:1 + volumes: + - ssl-certs:/var/lib/https-portal + environment: + STAGE: production + PROXY_READ_TIMEOUT: 3600 ports: - 80:80 - 443:443 restart: always - environment: - STAGE: production - PROXY_READ_TIMEOUT: 3600 + weblate: + image: weblate/weblate + depends_on: + - cache + - database volumes: - - ssl-certs:/var/lib/https-portal + - weblate-data:/app/data + - weblate-cache:/app/cache + environment: + WEBLATE_ENABLE_HTTPS: 1 + WEBLATE_IP_PROXY_HEADER: HTTP_X_FORWARDED_FOR + env_file: + - ./environment + restart: always + read_only: true + tmpfs: + - /run + - /tmp volumes: weblate-cache: {} weblate-data: {} diff --git a/docker-compose-single-celery.yml b/docker-compose-single-celery.yml index dd4eb50..0ca8672 100644 --- a/docker-compose-single-celery.yml +++ b/docker-compose-single-celery.yml @@ -1,35 +1,36 @@ +name: Weblate (single Celery process) services: - weblate: - image: weblate/weblate - tmpfs: - - /run - - /tmp + cache: + image: redis:7-alpine volumes: - - weblate-data:/app/data - - weblate-cache:/app/cache + - redis-data:/data + command: [redis-server, --save, '60', '1'] + restart: always + read_only: true + database: + image: postgres:17-alpine + volumes: + - postgres-data:/var/lib/postgresql/data env_file: - ./environment restart: always - read_only: true + weblate: + image: weblate/weblate depends_on: - - database - cache + - database + volumes: + - weblate-data:/app/data + - weblate-cache:/app/cache environment: SINGLE_CELERY_PROCESS: 1 - database: - image: postgres:17-alpine env_file: - ./environment - volumes: - - postgres-data:/var/lib/postgresql/data - restart: always - cache: - image: redis:7-alpine restart: always read_only: true - command: [redis-server, --save, '60', '1'] - volumes: - - redis-data:/data + tmpfs: + - /run + - /tmp volumes: weblate-cache: {} weblate-data: {} diff --git a/docker-compose-split.yml b/docker-compose-split.yml index 4f9d76d..d256079 100644 --- a/docker-compose-split.yml +++ b/docker-compose-split.yml @@ -1,169 +1,170 @@ +name: Weblate (split services) services: + cache: + image: redis:7-alpine + volumes: + - redis-data:/data + command: [redis-server, --save, '60', '1'] + restart: always + read_only: true + database: + image: postgres:17-alpine + volumes: + - postgres-data:/var/lib/postgresql/data + env_file: + - ./environment + restart: always weblate: image: weblate/weblate - tmpfs: - - /run - - /tmp - - /app/cache + depends_on: + - cache + - database + - weblate-celery-beat volumes: - type: volume source: weblate-data target: /app/data + environment: + WEBLATE_SERVICE: web env_file: - ./environment restart: always read_only: true - depends_on: - - database - - cache - - weblate-celery-beat - environment: - WEBLATE_SERVICE: web - weblate-celery-backup: - image: weblate/weblate tmpfs: - /run - /tmp - /app/cache + weblate-celery-backup: + image: weblate/weblate + depends_on: + - cache + - database + - weblate-celery-beat volumes: - type: volume source: weblate-data target: /app/data volume: nocopy: true + environment: + WEBLATE_SERVICE: celery-backup env_file: - ./environment restart: always read_only: true - depends_on: - - database - - cache - - weblate-celery-beat - environment: - WEBLATE_SERVICE: celery-backup - weblate-celery-beat: - image: weblate/weblate tmpfs: - /run - /tmp - /app/cache + weblate-celery-beat: + image: weblate/weblate + depends_on: + - cache + - database volumes: - type: volume source: weblate-data target: /app/data volume: nocopy: true + environment: + WEBLATE_SERVICE: celery-beat env_file: - ./environment restart: always read_only: true - depends_on: - - database - - cache - environment: - WEBLATE_SERVICE: celery-beat - weblate-celery-celery: - image: weblate/weblate tmpfs: - /run - /tmp - /app/cache + weblate-celery-celery: + image: weblate/weblate + depends_on: + - cache + - database + - weblate-celery-beat volumes: - type: volume source: weblate-data target: /app/data volume: nocopy: true + environment: + WEBLATE_SERVICE: celery-celery env_file: - ./environment restart: always read_only: true - depends_on: - - database - - cache - - weblate-celery-beat - environment: - WEBLATE_SERVICE: celery-celery - weblate-celery-memory: - image: weblate/weblate tmpfs: - /run - /tmp - /app/cache + weblate-celery-memory: + image: weblate/weblate + depends_on: + - cache + - database + - weblate-celery-beat volumes: - type: volume source: weblate-data target: /app/data volume: nocopy: true + environment: + WEBLATE_SERVICE: celery-memory env_file: - ./environment restart: always read_only: true - depends_on: - - database - - cache - - weblate-celery-beat - environment: - WEBLATE_SERVICE: celery-memory - weblate-celery-notify: - image: weblate/weblate tmpfs: - /run - /tmp - /app/cache + weblate-celery-notify: + image: weblate/weblate + depends_on: + - cache + - database + - weblate-celery-beat volumes: - type: volume source: weblate-data target: /app/data volume: nocopy: true + environment: + WEBLATE_SERVICE: celery-notify env_file: - ./environment restart: always read_only: true - depends_on: - - database - - cache - - weblate-celery-beat - environment: - WEBLATE_SERVICE: celery-notify - weblate-celery-translate: - image: weblate/weblate tmpfs: - /run - /tmp - /app/cache + weblate-celery-translate: + image: weblate/weblate + depends_on: + - cache + - database + - weblate-celery-beat volumes: - type: volume source: weblate-data target: /app/data volume: nocopy: true - env_file: - - ./environment - restart: always - read_only: true - depends_on: - - database - - cache - - weblate-celery-beat environment: WEBLATE_SERVICE: celery-translate - database: - image: postgres:17-alpine env_file: - ./environment - volumes: - - postgres-data:/var/lib/postgresql/data - restart: always - cache: - image: redis:7-alpine restart: always read_only: true - command: [redis-server, --save, '60', '1'] - volumes: - - redis-data:/data + tmpfs: + - /run + - /tmp + - /app/cache volumes: weblate-data: {} postgres-data: {} diff --git a/docker-compose.yml b/docker-compose.yml index 032f8e6..9d61d7d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,33 +1,34 @@ +name: Weblate services: - weblate: - image: weblate/weblate - tmpfs: - - /run - - /tmp + cache: + image: redis:7-alpine volumes: - - weblate-data:/app/data - - weblate-cache:/app/cache - env_file: - - ./environment + - redis-data:/data + command: [redis-server, --save, '60', '1'] restart: always read_only: true - depends_on: - - database - - cache database: image: postgres:17-alpine - env_file: - - ./environment volumes: - postgres-data:/var/lib/postgresql/data + env_file: + - ./environment restart: always - cache: - image: redis:7-alpine + weblate: + image: weblate/weblate + depends_on: + - cache + - database + volumes: + - weblate-data:/app/data + - weblate-cache:/app/cache + env_file: + - ./environment restart: always read_only: true - command: [redis-server, --save, '60', '1'] - volumes: - - redis-data:/data + tmpfs: + - /run + - /tmp volumes: weblate-cache: {} weblate-data: {}