diff --git a/.env b/.env index 9bc6cc7..0ee4b1b 100644 --- a/.env +++ b/.env @@ -1,9 +1,14 @@ -IMAGE_REPO=zammad/zammad-docker-compose +ELASTICSEARCH_VERSION=8.8.0 +IMAGE_REPO=ghcr.io/zammad/zammad MEMCACHE_SERVERS=zammad-memcached:11211 -POSTGRES_VERSION=15.1-alpine +MEMCACHE_VERSION=1.6.20-alpine +POSTGRES_DB=zammad_production POSTGRES_PASS=zammad POSTGRES_USER=zammad -POSTGRES_DB=zammad_production +POSTGRES_HOST=zammad-postgresql +POSTGRES_PORT=5432 +POSTGRES_VERSION=15.3-alpine REDIS_URL=redis://zammad-redis:6379 +REDIS_VERSION=7.0.5-alpine RESTART=always -VERSION=5.4.1-29 +VERSION=6.0.0-27 diff --git a/.github/tests.sh b/.github/tests.sh index 96fafc0..bfd2337 100755 --- a/.github/tests.sh +++ b/.github/tests.sh @@ -23,16 +23,28 @@ echo echo "Execute autowizard..." echo -docker exec zammad-docker-compose_zammad-railsserver_1 rake zammad:setup:auto_wizard +docker exec --env=AUTOWIZARD_RELATIVE_PATH=var/auto_wizard.json --env=DATABASE_URL=postgres://zammad:zammad@zammad-postgresql:5432/zammad_production zammad-docker-compose_zammad-railsserver_1 rake zammad:setup:auto_wizard echo echo "Autowizard executed successful :)" echo +echo +echo "Check DB for AutoWizard user" +echo + +docker exec --env=DATABASE_URL=postgres://zammad:zammad@zammad-postgresql:5432/zammad_production zammad-docker-compose_zammad-railsserver_1 rails r "p User.find_by(email: 'info@zammad.org')" | grep 'info@zammad.org' + +echo +echo "Check DB for AutoWizard user successfull :)" +echo + echo echo "Fill DB with some random data" -docker exec zammad-docker-compose_zammad-railsserver_1 rails r "FillDb.load(agents: 1,customers: 1,groups: 1,organizations: 1,overviews: 1,tickets: 1)" +echo + +docker exec --env=DATABASE_URL=postgres://zammad:zammad@zammad-postgresql:5432/zammad_production zammad-docker-compose_zammad-railsserver_1 rails r "FillDb.load(agents: 1,customers: 1,groups: 1,organizations: 1,overviews: 1,tickets: 1)" echo echo "DB fill successful :)" diff --git a/.github/workflows/ci-remote-image.yaml b/.github/workflows/ci-remote-image.yaml index e57f5c7..585affe 100644 --- a/.github/workflows/ci-remote-image.yaml +++ b/.github/workflows/ci-remote-image.yaml @@ -19,7 +19,7 @@ jobs: run: docker-compose up --detach - name: add autowizard file - run: docker cp .github/auto_wizard.json zammad-docker-compose_zammad-railsserver_1:/opt/zammad + run: docker cp .github/auto_wizard.json zammad-docker-compose_zammad-railsserver_1:/opt/zammad/var - name: run tests run: .github/tests.sh diff --git a/docker-compose.yml b/docker-compose.yml index 8f0836d..b1640d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ --- -version: '3' +version: '3.8' services: @@ -20,11 +20,11 @@ services: restart: ${RESTART} volumes: - zammad-backup:/var/tmp/zammad - - zammad-data:/opt/zammad:ro + - zammad-var:/opt/zammad/var:ro - ./scripts/backup.sh:/usr/local/bin/backup.sh:ro zammad-elasticsearch: - image: bitnami/elasticsearch:8.5.1 + image: bitnami/elasticsearch:${ELASTICSEARCH_VERSION} restart: ${RESTART} volumes: - elasticsearch-data:/bitnami/elasticsearch/data @@ -35,18 +35,17 @@ services: - zammad-postgresql environment: - MEMCACHE_SERVERS=${MEMCACHE_SERVERS} - - POSTGRESQL_DB=${POSTGRES_DB} - - POSTGRESQL_USER=${POSTGRES_USER} - - POSTGRESQL_PASS=${POSTGRES_PASS} - REDIS_URL=${REDIS_URL} image: ${IMAGE_REPO}:${VERSION} restart: on-failure + user: 0:0 volumes: - - zammad-data:/opt/zammad + - zammad-config-nginx:/etc/nginx/sites-enabled + - zammad-var:/opt/zammad/var zammad-memcached: command: memcached -m 256M - image: memcached:1.6.17-alpine + image: memcached:${MEMCACHE_VERSION} restart: ${RESTART} zammad-nginx: @@ -58,7 +57,8 @@ services: image: ${IMAGE_REPO}:${VERSION} restart: ${RESTART} volumes: - - zammad-data:/opt/zammad + - zammad-config-nginx:/etc/nginx/sites-enabled:ro + - zammad-var:/opt/zammad/var:ro zammad-postgresql: environment: @@ -82,11 +82,13 @@ services: image: ${IMAGE_REPO}:${VERSION} restart: ${RESTART} volumes: - - zammad-data:/opt/zammad + - zammad-var:/opt/zammad/var zammad-redis: - image: redis:7.0.5-alpine + image: redis:${REDIS_VERSION} restart: ${RESTART} + volumes: + - redis-data:/data zammad-scheduler: command: ["zammad-scheduler"] @@ -100,7 +102,7 @@ services: image: ${IMAGE_REPO}:${VERSION} restart: ${RESTART} volumes: - - zammad-data:/opt/zammad + - zammad-var:/opt/zammad/var zammad-websocket: command: ["zammad-websocket"] @@ -114,14 +116,18 @@ services: image: ${IMAGE_REPO}:${VERSION} restart: ${RESTART} volumes: - - zammad-data:/opt/zammad + - zammad-var:/opt/zammad/var volumes: elasticsearch-data: driver: local postgresql-data: driver: local + redis-data: + driver: local zammad-backup: driver: local - zammad-data: + zammad-config-nginx: + driver: local + zammad-var: driver: local diff --git a/scripts/backup.sh b/scripts/backup.sh index 9821c18..6256374 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -2,7 +2,7 @@ set -e -: "${ZAMMAD_DIR:=/opt/zammad}" +: "${ZAMMAD_DIR:=/opt/zammad/var}" : "${BACKUP_DIR:=/var/tmp/zammad}" : "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}" : "${ZAMMAD_RAILSSERVER_PORT:=3000}"