From c7b0ae8331a709e37f3b556528be2abbba590094 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 fixes there is issue with YAML output it generates. --- .dclintrc | 4 + .pre-commit-config.yaml | 11 +++ docker-compose-https.yml | 56 ++++++------- docker-compose-single-celery.yml | 38 ++++----- docker-compose-split.yml | 138 +++++++++++++++---------------- docker-compose.yml | 38 ++++----- 6 files changed, 150 insertions(+), 135 deletions(-) create mode 100644 .dclintrc diff --git a/.dclintrc b/.dclintrc new file mode 100644 index 0000000..4d2751a --- /dev/null +++ b/.dclintrc @@ -0,0 +1,4 @@ +rules: + no-unbound-port-interfaces: 0 + service-image-require-explicit-tag: 0 + require-project-name-field: 0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04145e9..649c1ef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,6 +45,17 @@ repos: rev: v3.10.0-2 hooks: - id: shfmt +- repo: local + hooks: + - id: dclint + name: Docker Compose Linter + entry: dclint . + 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..4a11652 100644 --- a/docker-compose-https.yml +++ b/docker-compose-https.yml @@ -1,47 +1,47 @@ 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..bfc7f1f 100644 --- a/docker-compose-single-celery.yml +++ b/docker-compose-single-celery.yml @@ -1,35 +1,35 @@ 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..48fcd20 100644 --- a/docker-compose-split.yml +++ b/docker-compose-split.yml @@ -1,169 +1,169 @@ 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..7dfb0f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,33 +1,33 @@ 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: {}