Compare commits

..

1 Commits

Author SHA1 Message Date
André Bauer
db3b8c0cc4 add release drafter, remove container & rework ci
Signed-off-by: André Bauer <andre.bauer@staffbase.com>
2022-11-08 11:44:17 +01:00
8 changed files with 119 additions and 82 deletions

12
.env
View File

@ -1,14 +1,8 @@
ELASTICSEARCH_VERSION=8.8.0 IMAGE_REPO=zammad/zammad-docker-compose
IMAGE_REPO=ghcr.io/zammad/zammad
MEMCACHE_SERVERS=zammad-memcached:11211 MEMCACHE_SERVERS=zammad-memcached:11211
MEMCACHE_VERSION=1.6.20-alpine
POSTGRES_DB=zammad_production
POSTGRES_PASS=zammad POSTGRES_PASS=zammad
POSTGRES_USER=zammad POSTGRES_USER=zammad
POSTGRES_HOST=zammad-postgresql
POSTGRES_PORT=5432
POSTGRES_VERSION=15.3-alpine
REDIS_URL=redis://zammad-redis:6379 REDIS_URL=redis://zammad-redis:6379
REDIS_VERSION=7.0.5-alpine
RESTART=always RESTART=always
VERSION=6.0.0-66 # don't forget to add the minus before the version
VERSION=-5.2.3-32

View File

@ -1,5 +1,5 @@
name-template: "v$RESOLVED_VERSION" name-template: "$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION" tag-template: "$RESOLVED_VERSION"
categories: categories:
- title: "🚀 Features" - title: "🚀 Features"
labels: labels:
@ -33,5 +33,3 @@ template: |
## Changes ## Changes
$CHANGES $CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION

16
.github/tests.sh vendored
View File

@ -23,28 +23,16 @@ echo
echo "Execute autowizard..." echo "Execute autowizard..."
echo echo
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 docker exec zammad-docker-compose_zammad-railsserver_1 rake zammad:setup:auto_wizard
echo echo
echo "Autowizard executed successful :)" echo "Autowizard executed successful :)"
echo 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
echo "Fill DB with some random data" echo "Fill DB with some random data"
echo 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 --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
echo "DB fill successful :)" echo "DB fill successful :)"

View File

@ -19,7 +19,7 @@ jobs:
run: docker-compose up --detach run: docker-compose up --detach
- name: add autowizard file - name: add autowizard file
run: docker cp .github/auto_wizard.json zammad-docker-compose_zammad-railsserver_1:/opt/zammad/var run: docker cp .github/auto_wizard.json zammad-docker-compose_zammad-railsserver_1:/opt/zammad
- name: run tests - name: run tests
run: .github/tests.sh run: .github/tests.sh

View File

@ -23,7 +23,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Lint Code Base - name: Lint Code Base
uses: github/super-linter/slim@v5 uses: github/super-linter/slim@v4
env: env:
DEFAULT_BRANCH: master DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -6,24 +6,17 @@ twitter, chat and emails. It is distributed under the GNU AFFERO General Public
License (AGPL). Do you receive many emails and want to answer them with a team of agents? License (AGPL). Do you receive many emails and want to answer them with a team of agents?
You're going to love Zammad! You're going to love Zammad!
## Use cases ## Use case for this repository
This repository is the starting point if you want to: This repository is meant to be the starting point for somebody who likes to use dockerized multi-container Zammad in production.
- deploy Zammad in a containerized production environment ## Getting started with zammad-docker-compose
- test the current `stable` or `develop` versions of Zammad
## Getting started [Learn more on Zammads documentation](https://docs.zammad.org/en/latest/install/docker-compose.html)
[Learn more on Zammads documentation](https://docs.zammad.org/en/latest/install/docker-compose.html)
## Upgrading
For upgrading instructions see our [Releases](https://github.com/zammad/zammad-docker-compose/releases).
## Status ## Status
[![ci-remote-image](https://github.com/zammad/zammad-docker-compose/actions/workflows/ci-remote-image.yaml/badge.svg)](https://github.com/zammad/zammad-docker-compose/actions/workflows/ci-remote-image.yaml) [![Dockerhub Pulls](https://badgen.net/docker/pulls/zammad/zammad-docker-compose?icon=docker&label=pulls)](https://hub.docker.com/r/zammad/zammad-docker-compose/) [![CI Status](https://github.com/zammad/zammad-docker-compose/workflows/ci/badge.svg)](https://github.com/zammad/zammad-docker-compose/actions) [![Docker Pulls](https://badgen.net/docker/pulls/zammad/zammad-docker-compose?icon=docker&label=pulls)](https://hub.docker.com/r/zammad/zammad-docker-compose/)
## Using a reverse proxy ## Using a reverse proxy
@ -49,4 +42,83 @@ RANCHER_URL=http://RANCHER_HOST:8080 rancher-compose --env-file=.env up
Elasticsearch is an optional, but strongly recommended dependency for Zammad. More details can be found in the [documentation](https://docs.zammad.org/en/latest/prerequisites/software.html#elasticsearch-optional). There are however certain scenarios when running without Elasticsearch may be desired, e.g. for very small teams, for teams with limited budget or as a temporary solution for an unplanned Elasticsearch downtime or planned cluster upgrade. Elasticsearch is an optional, but strongly recommended dependency for Zammad. More details can be found in the [documentation](https://docs.zammad.org/en/latest/prerequisites/software.html#elasticsearch-optional). There are however certain scenarios when running without Elasticsearch may be desired, e.g. for very small teams, for teams with limited budget or as a temporary solution for an unplanned Elasticsearch downtime or planned cluster upgrade.
Elasticsearch is enabled by default in the example `docker-compose.yml` file. It is also by default required to run the "zammad-init" command. Disabling Elasticsearch is possible by setting a special environment variable: `ELASTICSEARCH_ENABLED=false` for the `zammad-init` container and removing all references to Elasticsearch everywhere else: the `zammad-elasticsearch` container, its volume and links to it. Elasticsearch is enabled by default in the example `docker-compose.yml` file. It is also by default required to run the "zammad-init" command. Disabling Elasticsearch is possible by setting a special environment variable: `ELASTICSEARCH_ENABLED=false` for the `zammad-init` container and removing all references to Elasticsearch everywhere else: the `zammad-elasticsearch` container, it's volume and links to 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.
As there is no direct upgrade path we have to delete all Elasticsearch indices and rebuild them.
This will depend on the name of your docker container and volume, which depends on the checkout directory (`zammad-docker-compose` by default):
```console
docker-compose stop
docker container rm zammad-docker-compose_zammad-elasticsearch_1
docker volume rm zammad-docker-compose_elasticsearch-data
docker-compose up --no-recreate
```
To workaround the [changes in the PostgreSQL 9.6 container](https://github.com/docker-library/postgres/commit/f1bc8782e7e57cc403d0b32c0e24599535859f76) do the following:
```console
docker-compose start
docker exec -it zammaddockercompose_zammad-postgresql_1 bash
psql --username postgres --dbname zammad_production
CREATE USER zammad;
ALTER USER zammad WITH PASSWORD 'zammad';
ALTER USER zammad WITH SUPERUSER CREATEDB;
```

View File

@ -1,5 +1,5 @@
--- ---
version: '3.8' version: '3'
services: services:
@ -10,21 +10,19 @@ services:
- zammad-postgresql - zammad-postgresql
entrypoint: /usr/local/bin/backup.sh entrypoint: /usr/local/bin/backup.sh
environment: environment:
- BACKUP_TIME=03:00 - BACKUP_SLEEP=86400
- HOLD_DAYS=10 - HOLD_DAYS=10
- POSTGRESQL_DB=${POSTGRES_DB}
- POSTGRESQL_USER=${POSTGRES_USER} - POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASSWORD=${POSTGRES_PASS} - POSTGRESQL_PASSWORD=${POSTGRES_PASS}
- TZ=Europe/Berlin image: postgres:15.0-alpine
image: postgres:${POSTGRES_VERSION}
restart: ${RESTART} restart: ${RESTART}
volumes: volumes:
- zammad-backup:/var/tmp/zammad - zammad-backup:/var/tmp/zammad
- zammad-var:/opt/zammad/var:ro - zammad-data:/opt/zammad:ro
- ./scripts/backup.sh:/usr/local/bin/backup.sh:ro - ./scripts/backup.sh:/usr/local/bin/backup.sh:ro
zammad-elasticsearch: zammad-elasticsearch:
image: bitnami/elasticsearch:${ELASTICSEARCH_VERSION} image: bitnami/elasticsearch:8.5.0
restart: ${RESTART} restart: ${RESTART}
volumes: volumes:
- elasticsearch-data:/bitnami/elasticsearch/data - elasticsearch-data:/bitnami/elasticsearch/data
@ -35,17 +33,17 @@ services:
- zammad-postgresql - zammad-postgresql
environment: environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS} - MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASS=${POSTGRES_PASS}
- REDIS_URL=${REDIS_URL} - REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION} image: ${IMAGE_REPO}:zammad${VERSION}
restart: on-failure restart: on-failure
user: 0:0
volumes: volumes:
- zammad-config-nginx:/etc/nginx/sites-enabled - zammad-data:/opt/zammad
- zammad-var:/opt/zammad/var
zammad-memcached: zammad-memcached:
command: memcached -m 256M command: memcached -m 256M
image: memcached:${MEMCACHE_VERSION} image: memcached:1.6.17-alpine
restart: ${RESTART} restart: ${RESTART}
zammad-nginx: zammad-nginx:
@ -54,18 +52,16 @@ services:
- "8080" - "8080"
depends_on: depends_on:
- zammad-railsserver - zammad-railsserver
image: ${IMAGE_REPO}:${VERSION} image: ${IMAGE_REPO}:zammad${VERSION}
restart: ${RESTART} restart: ${RESTART}
volumes: volumes:
- zammad-config-nginx:/etc/nginx/sites-enabled:ro - zammad-data:/opt/zammad
- zammad-var:/opt/zammad/var:ro
zammad-postgresql: zammad-postgresql:
environment: environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER} - POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASS} - POSTGRES_PASSWORD=${POSTGRES_PASS}
image: postgres:${POSTGRES_VERSION} image: postgres:15.0-alpine
restart: ${RESTART} restart: ${RESTART}
volumes: volumes:
- postgresql-data:/var/lib/postgresql/data - postgresql-data:/var/lib/postgresql/data
@ -79,16 +75,14 @@ services:
environment: environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS} - MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- REDIS_URL=${REDIS_URL} - REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION} image: ${IMAGE_REPO}:zammad${VERSION}
restart: ${RESTART} restart: ${RESTART}
volumes: volumes:
- zammad-var:/opt/zammad/var - zammad-data:/opt/zammad
zammad-redis: zammad-redis:
image: redis:${REDIS_VERSION} image: redis:6.2.5-alpine
restart: ${RESTART} restart: ${RESTART}
volumes:
- redis-data:/data
zammad-scheduler: zammad-scheduler:
command: ["zammad-scheduler"] command: ["zammad-scheduler"]
@ -99,10 +93,10 @@ services:
environment: environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS} - MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- REDIS_URL=${REDIS_URL} - REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION} image: ${IMAGE_REPO}:zammad${VERSION}
restart: ${RESTART} restart: ${RESTART}
volumes: volumes:
- zammad-var:/opt/zammad/var - zammad-data:/opt/zammad
zammad-websocket: zammad-websocket:
command: ["zammad-websocket"] command: ["zammad-websocket"]
@ -113,21 +107,17 @@ services:
environment: environment:
- MEMCACHE_SERVERS=${MEMCACHE_SERVERS} - MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
- REDIS_URL=${REDIS_URL} - REDIS_URL=${REDIS_URL}
image: ${IMAGE_REPO}:${VERSION} image: ${IMAGE_REPO}:zammad${VERSION}
restart: ${RESTART} restart: ${RESTART}
volumes: volumes:
- zammad-var:/opt/zammad/var - zammad-data:/opt/zammad
volumes: volumes:
elasticsearch-data: elasticsearch-data:
driver: local driver: local
postgresql-data: postgresql-data:
driver: local driver: local
redis-data:
driver: local
zammad-backup: zammad-backup:
driver: local driver: local
zammad-config-nginx: zammad-data:
driver: local
zammad-var:
driver: local driver: local

View File

@ -2,7 +2,7 @@
set -e set -e
: "${ZAMMAD_DIR:=/opt/zammad/var}" : "${ZAMMAD_DIR:=/opt/zammad}"
: "${BACKUP_DIR:=/var/tmp/zammad}" : "${BACKUP_DIR:=/var/tmp/zammad}"
: "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}" : "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}"
: "${ZAMMAD_RAILSSERVER_PORT:=3000}" : "${ZAMMAD_RAILSSERVER_PORT:=3000}"
@ -11,7 +11,7 @@ set -e
: "${POSTGRESQL_DB:=zammad_production}" : "${POSTGRESQL_DB:=zammad_production}"
function check_railsserver_available { function check_railsserver_available {
until (echo > "/dev/tcp/$ZAMMAD_RAILSSERVER_HOST/$ZAMMAD_RAILSSERVER_PORT") &> /dev/null; do until (echo > /dev/tcp/${ZAMMAD_RAILSSERVER_HOST}/${ZAMMAD_RAILSSERVER_PORT}) &> /dev/null; do
echo "waiting for railsserver to be ready..." echo "waiting for railsserver to be ready..."
sleep 60 sleep 60
done done
@ -43,15 +43,10 @@ if [ "$1" = 'zammad-backup' ]; then
check_railsserver_available check_railsserver_available
while true; do while true; do
NOW_TIMESTAMP=$(date +%s)
TOMORROW_DATE=$(date -d@"$((NOW_TIMESTAMP + 24*60*60))" +%Y-%m-%d)
zammad_backup zammad_backup
NEXT_TIMESTAMP=$(date -d "$TOMORROW_DATE $BACKUP_TIME" +%s) # wait until next backup
NOW_TIMESTAMP=$(date +%s) sleep "${BACKUP_SLEEP}"
sleep $((NEXT_TIMESTAMP - NOW_TIMESTAMP))
done done
fi fi