Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance: Refactor YAML for better maintainability. #369

Merged
merged 2 commits into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 25 additions & 69 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
---
version: '3.8'

x-shared:
zammad-service: &zammad-service
environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_HOST=${POSTGRES_HOST}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
- REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION}
restart: ${RESTART}
volumes:
- zammad-var:/opt/zammad/var
depends_on:
- zammad-memcached
- zammad-postgresql
- zammad-redis

services:

zammad-backup:
<<: *zammad-service
command: ["zammad-backup"]
depends_on:
- zammad-railsserver
Expand All @@ -18,8 +38,6 @@ services:
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
image: postgres:${POSTGRES_VERSION}
restart: ${RESTART}
volumes:
- zammad-backup:/var/tmp/zammad
- zammad-var:/opt/zammad/var:ro
Expand All @@ -32,18 +50,10 @@ services:
- elasticsearch-data:/bitnami/elasticsearch/data

zammad-init:
<<: *zammad-service
command: ["zammad-init"]
depends_on:
- zammad-postgresql
environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_HOST=${POSTGRES_HOST}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
- REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION}
restart: on-failure
user: 0:0
volumes:
Expand All @@ -56,21 +66,12 @@ services:
restart: ${RESTART}

zammad-nginx:
<<: *zammad-service
command: ["zammad-nginx"]
expose:
- "8080"
depends_on:
- zammad-railsserver
environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_HOST=${POSTGRES_HOST}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
- REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION}
restart: ${RESTART}
volumes:
- zammad-config-nginx:/etc/nginx/sites-enabled:ro
- zammad-var:/opt/zammad/var:ro
Expand All @@ -86,23 +87,8 @@ services:
- postgresql-data:/var/lib/postgresql/data

zammad-railsserver:
<<: *zammad-service
command: ["zammad-railsserver"]
depends_on:
- zammad-memcached
- zammad-postgresql
- zammad-redis
environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_HOST=${POSTGRES_HOST}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
- REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION}
restart: ${RESTART}
volumes:
- zammad-var:/opt/zammad/var

zammad-redis:
image: redis:${REDIS_VERSION}
Expand All @@ -111,42 +97,12 @@ services:
- redis-data:/data

zammad-scheduler:
<<: *zammad-service
command: ["zammad-scheduler"]
depends_on:
- zammad-memcached
- zammad-railsserver
- zammad-redis
environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_HOST=${POSTGRES_HOST}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
- REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION}
restart: ${RESTART}
volumes:
- zammad-var:/opt/zammad/var

zammad-websocket:
<<: *zammad-service
command: ["zammad-websocket"]
depends_on:
- zammad-memcached
- zammad-railsserver
- zammad-redis
environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_HOST=${POSTGRES_HOST}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- POSTGRESQL_PORT=${POSTGRES_PORT}
- REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION}
restart: ${RESTART}
volumes:
- zammad-var:/opt/zammad/var

volumes:
elasticsearch-data:
Expand Down