Changes for Zammad 5 (#219)

* 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 <andre.bauer@staffbase.com>

* update memcached

Signed-off-by: André Bauer <andre.bauer@staffbase.com>

* fix image

Signed-off-by: André Bauer <andre.bauer@staffbase.com>

* remove nginx duplicate

Signed-off-by: André Bauer <andre.bauer@staffbase.com>

* added nodejs

Signed-off-by: André Bauer <andre.bauer@staffbase.com>

* added cache clear and removed links

Signed-off-by: André Bauer <andre.bauer@staffbase.com>

* fix typo

Signed-off-by: André Bauer <andre.bauer@staffbase.com>

Co-authored-by: André Bauer <monotek@users.noreply.github.com>
Co-authored-by: André Bauer <andre.bauer@staffbase.com>
This commit is contained in:
Martin Gruner 2021-10-05 21:25:26 +02:00 committed by GitHub
parent db7ca4b92d
commit 9aad202b60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 34 deletions

2
.github/tests.sh vendored
View File

@ -32,7 +32,7 @@ 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 :)"

View File

@ -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 <http://localhost:8080> instead of <http://localhost> 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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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