diff --git a/.env b/.env index 56f17e2..0ee78e0 100644 --- a/.env +++ b/.env @@ -1,5 +1,8 @@ # don't forget to add the minus before the version -# example: VERSION=-2.9.0-1 +# example: VERSION=-3.2.0-12 IMAGE_REPO=zammad/zammad-docker-compose VERSION= RESTART=always +POSTGRES_USER=zammad +POSTGRES_PASS=zammad +POSTGRES_DB=zammad_production diff --git a/Dockerfile b/Dockerfile index 822e3e0..7ea740b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,5 +9,5 @@ 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="2.9.0" \ + org.label-schema.schema-version="3.2.0" \ org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" diff --git a/containers/zammad-elasticsearch/Dockerfile b/containers/zammad-elasticsearch/Dockerfile index 0963e64..3321a17 100644 --- a/containers/zammad-elasticsearch/Dockerfile +++ b/containers/zammad-elasticsearch/Dockerfile @@ -10,7 +10,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="2.9.0" \ + org.label-schema.schema-version="3.2.0" \ org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" RUN yes | /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment diff --git a/containers/zammad-memcached/Dockerfile b/containers/zammad-memcached/Dockerfile deleted file mode 100644 index 82bb04b..0000000 --- a/containers/zammad-memcached/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -FROM memcached:alpine -MAINTAINER Zanmmad - -ENV MEMCACHED_SIZE 256M - -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 - Memcached Container" \ - 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="2.9.0" \ - org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" - -# docker init -USER root -COPY containers/zammad-memcached/docker-entrypoint.sh / -RUN chmod +x /docker-entrypoint.sh -USER memcache -ENTRYPOINT ["/docker-entrypoint.sh"] -CMD ["zammad-memcached"] diff --git a/containers/zammad-memcached/docker-entrypoint.sh b/containers/zammad-memcached/docker-entrypoint.sh deleted file mode 100644 index 4143a61..0000000 --- a/containers/zammad-memcached/docker-entrypoint.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = 'zammad-memcached' ]; then - echo "starting memcached..." - - exec memcached -m "${MEMCACHED_SIZE}" -fi diff --git a/containers/zammad-postgresql/Dockerfile b/containers/zammad-postgresql/Dockerfile index aa47db6..d40260b 100644 --- a/containers/zammad-postgresql/Dockerfile +++ b/containers/zammad-postgresql/Dockerfile @@ -1,12 +1,8 @@ -FROM postgres:9.6-alpine +FROM postgres:9.6.17-alpine + MAINTAINER Zammad ARG BUILD_DATE -ENV BACKUP_SLEEP 86400 -ENV HOLD_DAYS 10 -ENV ZAMMAD_DIR /opt/zammad -ENV BACKUP_DIR /var/tmp/zammad - LABEL org.label-schema.build-date="$BUILD_DATE" \ org.label-schema.name="Zammad" \ org.label-schema.license="AGPL-3.0" \ @@ -15,7 +11,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="2.9.0" \ + org.label-schema.schema-version="3.2.0" \ org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" # copy backup script diff --git a/containers/zammad-postgresql/backup.sh b/containers/zammad-postgresql/backup.sh index 1908dd9..77793b5 100644 --- a/containers/zammad-postgresql/backup.sh +++ b/containers/zammad-postgresql/backup.sh @@ -2,9 +2,10 @@ set -e +: "${ZAMMAD_DIR:=/opt/zammad}" +: "${BACKUP_DIR:=/var/tmp/zammad}" : "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}" : "${ZAMMAD_RAILSSERVER_PORT:=3000}" -: "${POSTGRESQL_USER:=postgres}" : "${POSTGRESQL_HOST:=zammad-postgresql}" : "${POSTGRESQL_PORT:=5432}" : "${POSTGRESQL_DB:=zammad_production}" @@ -32,7 +33,7 @@ function zammad_backup { fi #db backup - pg_dump --dbname=postgresql://"${POSTGRESQL_USER}"@"${POSTGRESQL_HOST}":"${POSTGRESQL_PORT}"/"${POSTGRESQL_DB}" | gzip > "${BACKUP_DIR}"/"${TIMESTAMP}"_zammad_db.psql.gz + pg_dump --dbname=postgresql://"${POSTGRESQL_USER}:${POSTGRESQL_PASSWORD}"@"${POSTGRESQL_HOST}":"${POSTGRESQL_PORT}"/"${POSTGRESQL_DB}" | gzip > "${BACKUP_DIR}"/"${TIMESTAMP}"_zammad_db.psql.gz } if [ "$1" = 'zammad-backup' ]; then diff --git a/containers/zammad/Dockerfile b/containers/zammad/Dockerfile index 64d1e7e..0403b77 100644 --- a/containers/zammad/Dockerfile +++ b/containers/zammad/Dockerfile @@ -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="2.9.0" \ + org.label-schema.schema-version="3.2.0" \ org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" ENV GIT_BRANCH stable diff --git a/containers/zammad/docker-entrypoint.sh b/containers/zammad/docker-entrypoint.sh index f84cccc..f133f40 100755 --- a/containers/zammad/docker-entrypoint.sh +++ b/containers/zammad/docker-entrypoint.sh @@ -11,8 +11,8 @@ set -e : "${MEMCACHED_PORT:=11211}" : "${POSTGRESQL_HOST:=zammad-postgresql}" : "${POSTGRESQL_PORT:=5432}" -: "${POSTGRESQL_USER:=postgres}" -: "${POSTGRESQL_PASS:=}" +: "${POSTGRESQL_USER:=zammad}" +: "${POSTGRESQL_PASS:=zammad}" : "${POSTGRESQL_DB:=zammad_production}" : "${POSTGRESQL_DB_CREATE:=true}" : "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}" diff --git a/docker-compose.yml b/docker-compose.yml index 3a22961..8e7ef31 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,11 @@ services: volumes: - zammad-backup:/var/tmp/zammad - zammad-data:/opt/zammad + environment: + - BACKUP_SLEEP=86400 + - HOLD_DAYS=10 + - POSTGRESQL_USER=${POSTGRES_USER} + - POSTGRESQL_PASSWORD=${POSTGRES_PASS} zammad-elasticsearch: image: ${IMAGE_REPO}:zammad-elasticsearch${VERSION} @@ -36,8 +41,8 @@ services: - zammad-data:/opt/zammad zammad-memcached: - command: ["zammad-memcached"] - image: ${IMAGE_REPO}:zammad-memcached${VERSION} + command: memcached -m 256M + image: memcached:1.5.22-alpine restart: ${RESTART} zammad-nginx: @@ -59,6 +64,9 @@ services: restart: ${RESTART} volumes: - postgresql-data:/var/lib/postgresql/data + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASS} zammad-railsserver: command: ["zammad-railsserver"] diff --git a/hooks/config b/hooks/config index 7c8b77c..b05ee3b 100644 --- a/hooks/config +++ b/hooks/config @@ -3,4 +3,4 @@ # build hooks config # -DOCKER_IMAGES="zammad zammad-elasticsearch zammad-memcached zammad-postgresql" +DOCKER_IMAGES="zammad zammad-elasticsearch zammad-postgresql"