From 9aad202b600600f02964c29ffdb22c539da99297 Mon Sep 17 00:00:00 2001 From: Martin Gruner Date: Tue, 5 Oct 2021 21:25:26 +0200 Subject: [PATCH] Changes for Zammad 5 (#219) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FillDB was renamed to FillDb for Zammad 5. * Changed Ruby dependency to 2.7.3. * Update containers/zammad/Dockerfile * added redis / changed memcached Signed-off-by: André Bauer * update memcached Signed-off-by: André Bauer * fix image Signed-off-by: André Bauer * remove nginx duplicate Signed-off-by: André Bauer * added nodejs Signed-off-by: André Bauer * added cache clear and removed links Signed-off-by: André Bauer * fix typo Signed-off-by: André Bauer Co-authored-by: André Bauer Co-authored-by: André Bauer --- .github/tests.sh | 10 ++++----- README.md | 5 +++++ containers/zammad/Dockerfile | 4 ++-- containers/zammad/docker-entrypoint.sh | 8 +++---- containers/zammad/setup.sh | 2 +- docker-compose.yml | 31 +++++++++----------------- 6 files changed, 26 insertions(+), 34 deletions(-) diff --git a/.github/tests.sh b/.github/tests.sh index 1f633f8..96fafc0 100755 --- a/.github/tests.sh +++ b/.github/tests.sh @@ -19,20 +19,20 @@ echo echo "Success - Zammad is up :)" echo -echo +echo echo "Execute autowizard..." echo docker exec zammad-docker-compose_zammad-railsserver_1 rake zammad:setup:auto_wizard -echo +echo echo "Autowizard executed successful :)" -echo +echo -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)" +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 echo "DB fill successful :)" diff --git a/README.md b/README.md index 2c7542b..6844c51 100644 --- a/README.md +++ b/README.md @@ -75,3 +75,8 @@ ALTER USER zammad WITH SUPERUSER CREATEDB; To be able to run Zammad container with an unprivileged user we had to change the port Nginx uses from 80 to 8080, so Zammad needs to be accessed via instead of now! This change will also affect you, if you use a reverse proxy, like Traefik or Haproxy, in front of Zammad as your reverse proxy configuration needs to be adapted to point to port 8080 now. + +### From =< 4.0.0 to 5.0.0 + +Memchached config changed. If you use the old env vars `MEMCACHED_HOST` & `MEMCACHED_PORT` adapt to `MEMCACHE_SERVERS`. +Redis is a dependency for the Websocket server now. diff --git a/containers/zammad/Dockerfile b/containers/zammad/Dockerfile index ef28b61..d599e1b 100644 --- a/containers/zammad/Dockerfile +++ b/containers/zammad/Dockerfile @@ -1,6 +1,6 @@ -FROM ruby:2.6.8-slim AS builder # note: zammad is currently incompatible to alpine because of: # https://github.com/docker-library/ruby/issues/113 +FROM ruby:2.7.4-slim AS builder ARG BUILD_DATE ARG DEBIAN_FRONTEND=noninteractive @@ -24,7 +24,7 @@ RUN chmod +x /tmp/setup.sh; \ /tmp/setup.sh builder -FROM ruby:2.6.8-slim +FROM ruby:2.7.4-slim ARG BUILD_DATE ARG DEBIAN_FRONTEND=noninteractive diff --git a/containers/zammad/docker-entrypoint.sh b/containers/zammad/docker-entrypoint.sh index 619cbd1..b3d467a 100755 --- a/containers/zammad/docker-entrypoint.sh +++ b/containers/zammad/docker-entrypoint.sh @@ -10,8 +10,7 @@ set -e : "${ELASTICSEARCH_NAMESPACE:=zammad}" : "${ELASTICSEARCH_REINDEX:=true}" : "${ELASTICSEARCH_SSL_VERIFY:=true}" -: "${MEMCACHED_HOST:=zammad-memcached}" -: "${MEMCACHED_PORT:=11211}" +: "${MEMCACHE_SERVERS:=zammad-memcached:11211}" : "${NGINX_PORT:=8080}" : "${NGINX_SERVER_NAME:=_}" : "${NGINX_SERVER_SCHEME:=\$scheme}" @@ -22,6 +21,7 @@ set -e : "${POSTGRESQL_DB:=zammad_production}" : "${POSTGRESQL_DB_CREATE:=true}" : "${RAILS_TRUSTED_PROXIES:=['127.0.0.1', '::1']}" +: "${REDIS_URL:=redis://zammad-redis:6379}" : "${RSYNC_ADDITIONAL_PARAMS:=--no-perms --no-owner}" : "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}" : "${ZAMMAD_RAILSSERVER_PORT:=3000}" @@ -58,9 +58,6 @@ if [ "$1" = 'zammad-init' ]; then ESCAPED_POSTGRESQL_PASS=$(echo "$POSTGRESQL_PASS" | sed -e 's/[\/&]/\\&/g') sed -e "s#.*adapter:.*# adapter: postgresql#g" -e "s#.*database:.*# database: ${POSTGRESQL_DB}#g" -e "s#.*username:.*# username: ${POSTGRESQL_USER}#g" -e "s#.*password:.*# password: ${ESCAPED_POSTGRESQL_PASS}\\n host: ${POSTGRESQL_HOST}\\n port: ${POSTGRESQL_PORT}#g" < contrib/packager.io/database.yml.pkgr > config/database.yml - # configure memcache - sed -i -e "s/.*config.cache_store.*file_store.*cache_file_store.*/ config.cache_store = :dalli_store, '${MEMCACHED_HOST}:${MEMCACHED_PORT}'\\n config.session_store = :dalli_store, '${MEMCACHED_HOST}:${MEMCACHED_PORT}'/" config/application.rb - # configure trusted proxies sed -i -e "s#config.action_dispatch.trusted_proxies =.*#config.action_dispatch.trusted_proxies = ${RAILS_TRUSTED_PROXIES}#" config/environments/production.rb @@ -78,6 +75,7 @@ if [ "$1" = 'zammad-init' ]; then echo "${AUTOWIZARD_JSON}" | base64 -d > auto_wizard.json fi else + bundle exec rails r "Cache.clear" bundle exec rake db:migrate fi diff --git a/containers/zammad/setup.sh b/containers/zammad/setup.sh index 47160f3..fb41642 100755 --- a/containers/zammad/setup.sh +++ b/containers/zammad/setup.sh @@ -3,7 +3,7 @@ set -e # install dependencies if [ "$1" = 'builder' ]; then - PACKAGES="build-essential curl git libimlib2-dev libpq-dev shared-mime-info" + PACKAGES="build-essential curl git libimlib2-dev libpq-dev nodejs shared-mime-info" elif [ "$1" = 'runner' ]; then PACKAGES="curl libimlib2 libpq5 nginx rsync" fi diff --git a/docker-compose.yml b/docker-compose.yml index 7c3b90d..a3a1393 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '2' +version: '3' services: @@ -6,6 +6,7 @@ services: command: ["zammad-backup"] depends_on: - zammad-railsserver + - zammad-postgresql entrypoint: /usr/local/bin/backup.sh environment: - BACKUP_SLEEP=86400 @@ -13,8 +14,6 @@ services: - POSTGRESQL_USER=${POSTGRES_USER} - POSTGRESQL_PASSWORD=${POSTGRES_PASS} image: ${IMAGE_REPO}:zammad-postgresql${VERSION} - links: - - zammad-postgresql restart: ${RESTART} volumes: - zammad-backup:/var/tmp/zammad @@ -36,16 +35,13 @@ services: - POSTGRESQL_USER=${POSTGRES_USER} - POSTGRESQL_PASS=${POSTGRES_PASS} image: ${IMAGE_REPO}:zammad${VERSION} - links: - - zammad-elasticsearch - - zammad-postgresql restart: on-failure volumes: - zammad-data:/opt/zammad zammad-memcached: command: memcached -m 256M - image: memcached:1.6.9-alpine + image: memcached:1.6.10-alpine restart: ${RESTART} zammad-nginx: @@ -55,9 +51,6 @@ services: depends_on: - zammad-railsserver image: ${IMAGE_REPO}:zammad${VERSION} - links: - - zammad-railsserver - - zammad-websocket restart: ${RESTART} volumes: - zammad-data:/opt/zammad @@ -76,25 +69,23 @@ services: depends_on: - zammad-memcached - zammad-postgresql + - zammad-redis image: ${IMAGE_REPO}:zammad${VERSION} - links: - - zammad-elasticsearch - - zammad-memcached - - zammad-postgresql restart: ${RESTART} volumes: - zammad-data:/opt/zammad + zammad-redis: + image: redis:6.2.5-alpine + restart: ${RESTART} + zammad-scheduler: command: ["zammad-scheduler"] depends_on: - zammad-memcached - zammad-railsserver + - zammad-redis image: ${IMAGE_REPO}:zammad${VERSION} - links: - - zammad-elasticsearch - - zammad-memcached - - zammad-postgresql restart: ${RESTART} volumes: - zammad-data:/opt/zammad @@ -104,10 +95,8 @@ services: depends_on: - zammad-memcached - zammad-railsserver + - zammad-redis image: ${IMAGE_REPO}:zammad${VERSION} - links: - - zammad-postgresql - - zammad-memcached restart: ${RESTART} volumes: - zammad-data:/opt/zammad