fixes for postgres / use official memcached container (#130)

* use fixed postgres & memcached versions & fix missing postgres env var

* remove memcached contaienr build

* fixed another version label

* added postgres password to backup command

* set postgres user & pass in .env file

* fixed postgres in backup container

* use zammad repo
This commit is contained in:
André Bauer 2020-02-24 17:50:19 +01:00 committed by GitHub
parent 9b81b9f544
commit 607fa4a02a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 26 additions and 50 deletions

5
.env
View File

@ -1,5 +1,8 @@
# don't forget to add the minus before the version # 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 IMAGE_REPO=zammad/zammad-docker-compose
VERSION= VERSION=
RESTART=always RESTART=always
POSTGRES_USER=zammad
POSTGRES_PASS=zammad
POSTGRES_DB=zammad_production

View File

@ -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-url="https://github.com/zammad/zammad" \
org.label-schema.vcs-type="Git" \ org.label-schema.vcs-type="Git" \
org.label-schema.vendor="Zammad" \ 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" org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"

View File

@ -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-url="https://github.com/zammad/zammad" \
org.label-schema.vcs-type="Git" \ org.label-schema.vcs-type="Git" \
org.label-schema.vendor="Zammad" \ 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" 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 RUN yes | /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment

View File

@ -1,23 +0,0 @@
FROM memcached:alpine
MAINTAINER Zanmmad <info@zammad.org>
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"]

View File

@ -1,9 +0,0 @@
#!/bin/sh
set -e
if [ "$1" = 'zammad-memcached' ]; then
echo "starting memcached..."
exec memcached -m "${MEMCACHED_SIZE}"
fi

View File

@ -1,12 +1,8 @@
FROM postgres:9.6-alpine FROM postgres:9.6.17-alpine
MAINTAINER Zammad <info@zammad.org> MAINTAINER Zammad <info@zammad.org>
ARG BUILD_DATE 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" \ LABEL org.label-schema.build-date="$BUILD_DATE" \
org.label-schema.name="Zammad" \ org.label-schema.name="Zammad" \
org.label-schema.license="AGPL-3.0" \ 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-url="https://github.com/zammad/zammad" \
org.label-schema.vcs-type="Git" \ org.label-schema.vcs-type="Git" \
org.label-schema.vendor="Zammad" \ 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" org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
# copy backup script # copy backup script

View File

@ -2,9 +2,10 @@
set -e set -e
: "${ZAMMAD_DIR:=/opt/zammad}"
: "${BACKUP_DIR:=/var/tmp/zammad}"
: "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}" : "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}"
: "${ZAMMAD_RAILSSERVER_PORT:=3000}" : "${ZAMMAD_RAILSSERVER_PORT:=3000}"
: "${POSTGRESQL_USER:=postgres}"
: "${POSTGRESQL_HOST:=zammad-postgresql}" : "${POSTGRESQL_HOST:=zammad-postgresql}"
: "${POSTGRESQL_PORT:=5432}" : "${POSTGRESQL_PORT:=5432}"
: "${POSTGRESQL_DB:=zammad_production}" : "${POSTGRESQL_DB:=zammad_production}"
@ -32,7 +33,7 @@ function zammad_backup {
fi fi
#db backup #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 if [ "$1" = 'zammad-backup' ]; then

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-url="https://github.com/zammad/zammad" \
org.label-schema.vcs-type="Git" \ org.label-schema.vcs-type="Git" \
org.label-schema.vendor="Zammad" \ 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" org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
ENV GIT_BRANCH stable ENV GIT_BRANCH stable

View File

@ -11,8 +11,8 @@ set -e
: "${MEMCACHED_PORT:=11211}" : "${MEMCACHED_PORT:=11211}"
: "${POSTGRESQL_HOST:=zammad-postgresql}" : "${POSTGRESQL_HOST:=zammad-postgresql}"
: "${POSTGRESQL_PORT:=5432}" : "${POSTGRESQL_PORT:=5432}"
: "${POSTGRESQL_USER:=postgres}" : "${POSTGRESQL_USER:=zammad}"
: "${POSTGRESQL_PASS:=}" : "${POSTGRESQL_PASS:=zammad}"
: "${POSTGRESQL_DB:=zammad_production}" : "${POSTGRESQL_DB:=zammad_production}"
: "${POSTGRESQL_DB_CREATE:=true}" : "${POSTGRESQL_DB_CREATE:=true}"
: "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}" : "${ZAMMAD_RAILSSERVER_HOST:=zammad-railsserver}"

View File

@ -14,6 +14,11 @@ services:
volumes: volumes:
- zammad-backup:/var/tmp/zammad - zammad-backup:/var/tmp/zammad
- zammad-data:/opt/zammad - zammad-data:/opt/zammad
environment:
- BACKUP_SLEEP=86400
- HOLD_DAYS=10
- POSTGRESQL_USER=${POSTGRES_USER}
- POSTGRESQL_PASSWORD=${POSTGRES_PASS}
zammad-elasticsearch: zammad-elasticsearch:
image: ${IMAGE_REPO}:zammad-elasticsearch${VERSION} image: ${IMAGE_REPO}:zammad-elasticsearch${VERSION}
@ -36,8 +41,8 @@ services:
- zammad-data:/opt/zammad - zammad-data:/opt/zammad
zammad-memcached: zammad-memcached:
command: ["zammad-memcached"] command: memcached -m 256M
image: ${IMAGE_REPO}:zammad-memcached${VERSION} image: memcached:1.5.22-alpine
restart: ${RESTART} restart: ${RESTART}
zammad-nginx: zammad-nginx:
@ -59,6 +64,9 @@ services:
restart: ${RESTART} restart: ${RESTART}
volumes: volumes:
- postgresql-data:/var/lib/postgresql/data - postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASS}
zammad-railsserver: zammad-railsserver:
command: ["zammad-railsserver"] command: ["zammad-railsserver"]

View File

@ -3,4 +3,4 @@
# build hooks config # build hooks config
# #
DOCKER_IMAGES="zammad zammad-elasticsearch zammad-memcached zammad-postgresql" DOCKER_IMAGES="zammad zammad-elasticsearch zammad-postgresql"