update zammad & components (#307)

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

Signed-off-by: André Bauer <andre.bauer@staffbase.com>
This commit is contained in:
André Bauer 2022-11-04 19:30:32 +01:00 committed by GitHub
parent 0af24d791f
commit c5c1db541a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 71 additions and 91 deletions

2
.env
View File

@ -5,4 +5,4 @@ POSTGRES_USER=zammad
REDIS_URL=redis://zammad-redis:6379
RESTART=always
# don't forget to add the minus before the version
VERSION=-5.2.3-18
VERSION=-5.2.3-32

View File

@ -8,20 +8,6 @@ updates:
time: "09:00"
timezone: "Europe/Berlin"
- package-ecosystem: "docker"
directory: "/containers/zammad-elasticsearch"
schedule:
interval: "weekly"
time: "09:00"
timezone: "Europe/Berlin"
- package-ecosystem: "docker"
directory: "/containers/zammad-postgresql"
schedule:
interval: "weekly"
time: "09:00"
timezone: "Europe/Berlin"
- package-ecosystem: "github-actions"
directory: "/"
schedule:

View File

@ -5,10 +5,7 @@
set -o errexit
set -o pipefail
DOCKER_IMAGES="zammad zammad-elasticsearch zammad-postgresql"
DOCKER_IMAGE="zammad"
# shellcheck disable=SC2153
for DOCKER_IMAGE in ${DOCKER_IMAGES}; do
echo "Build Zammad Docker image ${DOCKER_IMAGE} for local or ci tests"
docker build --pull --no-cache --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" -t "${DOCKER_IMAGE}-local" -f "containers/${DOCKER_IMAGE}/Dockerfile" .
done
echo "Build Zammad Docker image ${DOCKER_IMAGE} for local or ci tests"
docker build --pull --no-cache --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" -t "${DOCKER_IMAGE}-local" -f "containers/${DOCKER_IMAGE}/Dockerfile" .

View File

@ -9,7 +9,7 @@ on:
jobs:
run-remote-image-docker-compose:
timeout-minutes: 20
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

View File

@ -6,7 +6,7 @@ on:
jobs:
lint-docker-compose-file:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
@ -15,7 +15,7 @@ jobs:
run: docker-compose config
super-linter:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
@ -36,7 +36,7 @@ jobs:
- lint-docker-compose-file
- super-linter
timeout-minutes: 20
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3

View File

@ -46,6 +46,59 @@ Elasticsearch is enabled by default in the example `docker-compose.yml` file. It
## Upgrading
### From =< to 5.0.0 to 5.2.3-32
* Elasticsearch was updated from 7.17.3 to 8.5.0 using the Bitnami image
* We don't use a custom build of the docker image anymore as ingest-attachment is no longer a plugin but instead a module packaged with this distribution of Elasticsearch
* ELASTICSEARCH_REINDEX var should be set to true
* PostgreSql was updated from 9.6.24 to 15.0.0
* We don't use a custom build of the docker image anymore as we just mount the backup script to the postgres container now
* backup / restore ins needed to update
* you can create a new backup (with your old postgres 9.6 version / still in previous git version) by:
* if you already have checked out the newest commit
* `git checkout cd424e98689b8dc49878a37b9aab67192c36fd24`
* docker-compose stop
* docker-compose up
* check docker logs until "backup finished :)" is shown as last(!) entry
* `docker logs -f zammad-docker-compose_zammad-backup_1`
* `docker-compose stop`
* you can restore the backup in postgres 15 like
* update git epository
* `git checkout master`
* `git pull`
* stop docker-compose if it's running
* `docker-compose stop`
* delete old zammad postgre container and volume (data is lost! get sure your backups are in place!)
* `docker container rm zammad-docker-compose_zammad-postgresql_1`
* `docker volume rm zammad-docker-compose_postgresql-data`
* recreate zammads postgres volume
* `docker volume create zammad-docker-compose_postgresql-data`
* start a temporary restore container (adjust username & password vars if needed)
* `docker run -it --rm --name postgres-restore -v zammad-docker-compose_zammad-backup:/var/tmp/zammad:ro -v zammad-docker-compose_postgresql-data:/var/lib/postgresql/data -e POSTGRES_USER=zammad -e POSTGRES_PASSWORD=zammad postgres:15.0-alpine`
* in a second bash shell run:
* show available backups
* `docker exec -it postgres-restore bash -c "ls -al /var/tmp/zammad/"`
* create zammad_production db
* `docker exec -it postgres-restore bash -c "psql -U zammad --command='CREATE DATABASE zammad_production'"`
* restore old data with adjusted filename you got from the ls command above
* `docker exec -it postgres-restore bash -c "gunzip -kc /var/tmp/zammad/!!!ENTER_PSQL_FILE_NAME_FROM_COMMAND_ABOVE!!!_zammad_db.psql.gz | psql -U zammad" -d zammad_production`
* stop the restore container
* `docker stop postgres-restore`
* in your first bash shell
* `docker-compose up`
### 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.
### From =< 3.6.0-65
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 =< 3.3.0-12
We've updated the Elasticsearch image from 5.6 to 7.6.
@ -69,14 +122,3 @@ CREATE USER zammad;
ALTER USER zammad WITH PASSWORD 'zammad';
ALTER USER zammad WITH SUPERUSER CREATEDB;
```
### From =< 3.6.0-65
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,17 +0,0 @@
FROM docker.elastic.co/elasticsearch/elasticsearch:7.17.3
ARG BUILD_DATE
LABEL org.label-schema.build-date="$BUILD_DATE" \
org.label-schema.name="Zammad" \
org.label-schema.license="AGPL-3.0" \
org.label-schema.description="Docker container for Zammad - Elasticsearch" \
org.label-schema.url="https://zammad.org" \
org.label-schema.vcs-url="https://github.com/zammad/zammad" \
org.label-schema.vcs-type="Git" \
org.label-schema.vendor="Zammad" \
org.label-schema.schema-version="5.2.1" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch ingest-attachment

View File

@ -1,20 +0,0 @@
FROM postgres:15.0-alpine
ARG BUILD_DATE
LABEL org.label-schema.build-date="$BUILD_DATE" \
org.label-schema.name="Zammad" \
org.label-schema.license="AGPL-3.0" \
org.label-schema.description="Docker container for Zammad - Postgresql" \
org.label-schema.url="https://zammad.org" \
org.label-schema.vcs-url="https://github.com/zammad/zammad" \
org.label-schema.vcs-type="Git" \
org.label-schema.vendor="Zammad" \
org.label-schema.schema-version="5.2.1" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
# copy backup script
COPY containers/zammad-postgresql/backup.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/backup.sh

View File

@ -37,7 +37,7 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \
org.label-schema.vcs-url="https://github.com/zammad/zammad" \
org.label-schema.vcs-type="Git" \
org.label-schema.vendor="Zammad" \
org.label-schema.schema-version="5.2.1" \
org.label-schema.schema-version="5.2.3" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
ENV GIT_BRANCH stable

View File

@ -3,21 +3,12 @@ version: '3'
services:
zammad-backup:
image: zammad-postgresql-local
zammad-elasticsearch:
image: zammad-elasticsearch-local
zammad-init:
image: zammad-local
zammad-nginx:
image: zammad-local
zammad-postgresql:
image: zammad-postgresql-local
zammad-railsserver:
image: zammad-local

View File

@ -14,19 +14,18 @@ services:
- HOLD_DAYS=10
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASSWORD=${POSTGRES_PASS}
image: ${IMAGE_REPO}:zammad-postgresql${VERSION}
image: postgres:15.0-alpine
restart: ${RESTART}
volumes:
- zammad-backup:/var/tmp/zammad
- zammad-data:/opt/zammad
- zammad-data:/opt/zammad:ro
- ./scripts/backup.sh:/usr/local/bin/backup.sh:ro
zammad-elasticsearch:
environment:
- discovery.type=single-node
image: ${IMAGE_REPO}:zammad-elasticsearch${VERSION}
image: bitnami/elasticsearch:8.5.0
restart: ${RESTART}
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
- elasticsearch-data:/bitnami/elasticsearch/data
zammad-init:
command: ["zammad-init"]
@ -44,7 +43,7 @@ services:
zammad-memcached:
command: memcached -m 256M
image: memcached:1.6.10-alpine
image: memcached:1.6.17-alpine
restart: ${RESTART}
zammad-nginx:
@ -62,7 +61,7 @@ services:
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASS}
image: ${IMAGE_REPO}:zammad-postgresql${VERSION}
image: postgres:15.0-alpine
restart: ${RESTART}
volumes:
- postgresql-data:/var/lib/postgresql/data

View File

@ -34,6 +34,8 @@ function zammad_backup {
#db backup
pg_dump --dbname=postgresql://"${POSTGRESQL_USER}:${POSTGRESQL_PASSWORD}@${POSTGRESQL_HOST}:${POSTGRESQL_PORT}/${POSTGRESQL_DB}" | gzip > "${BACKUP_DIR}"/"${TIMESTAMP}"_zammad_db.psql.gz
echo "backup finished :)"
}
if [ "$1" = 'zammad-backup' ]; then