use only one zammad image for all zammad services- fixes #45

This commit is contained in:
André Bauer 2017-10-02 23:41:16 +02:00
parent 1e3084dffa
commit 9d4dad8de5
12 changed files with 63 additions and 145 deletions

View File

@ -1,4 +1,4 @@
FROM zammad/zammad-docker-compose:zammad
FROM debian
MAINTAINER Zammad <info@zammad.org>
ARG BUILD_DATE
@ -17,10 +17,11 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \
org.label-schema.schema-version="1.2" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
RUN wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add - \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" >> /etc/apt/sources.list.d/postgres.list \
&& apt-get update;apt-get -y install postgresql-client \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update;apt-get -y wget gnupg2 \
&& wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add - \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" >> /etc/apt/sources.list.d/postgres.list \
&& apt-get update;apt-get -y install postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# create entrypoint
COPY containers/zammad-backup/docker-entrypoint.sh /

View File

@ -1,23 +0,0 @@
FROM zammad/zammad-docker-compose:zammad
MAINTAINER Zammad <info@zammad.org>
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 - Rails server" \
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="1.2" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
# Expose ports
EXPOSE 3000
# docker init
COPY containers/zammad-railsserver/docker-entrypoint.sh /
RUN chown ${ZAMMAD_USER}:${ZAMMAD_USER} /docker-entrypoint.sh;chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["zammad-railsserver"]

View File

@ -1,20 +0,0 @@
FROM zammad/zammad-docker-compose:zammad
MAINTAINER Zammad <info@zammad.org>
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 - Scheduler" \
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="1.2" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
# docker init
COPY containers/zammad-scheduler/docker-entrypoint.sh /
RUN chown ${ZAMMAD_USER}:${ZAMMAD_USER} /docker-entrypoint.sh;chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["zammad-scheduler"]

View File

@ -1,15 +0,0 @@
#!/bin/bash
if [ "$1" = 'zammad-scheduler' ]; then
# wait for zammad process coming up
until (echo > /dev/tcp/zammad-railsserver/3000) &> /dev/null; do
echo "scheduler waiting for zammads railsserver to be ready..."
sleep 2
done
echo "scheduler can access raillsserver now..."
# start scheduler
cd ${ZAMMAD_DIR}
exec gosu ${ZAMMAD_USER}:${ZAMMAD_USER} bundle exec script/scheduler.rb run
fi

View File

@ -1,23 +0,0 @@
FROM zammad/zammad-docker-compose:zammad
MAINTAINER Zammad <info@zammad.org>
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 - Websocket server" \
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="1.2" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
# Expose ports
EXPOSE 6042
# docker init
COPY containers/zammad-websocket/docker-entrypoint.sh /
RUN chown ${ZAMMAD_USER}:${ZAMMAD_USER} /docker-entrypoint.sh && chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["zammad-websocket"]

View File

@ -1,14 +0,0 @@
#!/bin/bash
if [ "$1" = 'zammad-websocket' ]; then
# wait for zammad process coming up
until (echo > /dev/tcp/zammad-railsserver/3000) &> /dev/null; do
echo "websocket server waiting for zammads railsserver to be ready..."
sleep 5
done
echo "websocket server can access raillsserver now..."
cd ${ZAMMAD_DIR}
exec gosu ${ZAMMAD_USER}:${ZAMMAD_USER} bundle exec script/websocket-server.rb -b 0.0.0.0 start
fi

View File

@ -47,4 +47,9 @@ RUN BUILD_DEPENDENCIES="git build-essential libffi-dev libpq5 libpq-dev rsync" \
&& rm -r tmp/cache \
&& chown -R ${ZAMMAD_USER}:${ZAMMAD_USER} ${ZAMMAD_TMP_DIR}
# docker init
COPY containers/zammad/docker-entrypoint.sh /
RUN chown ${ZAMMAD_USER}:${ZAMMAD_USER} /docker-entrypoint.sh && chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
WORKDIR ${ZAMMAD_DIR}

View File

@ -1,7 +1,7 @@
#!/bin/bash
# zammad-railsserver
if [ "$1" = 'zammad-railsserver' ]; then
# wait for postgres process coming up on zammad-postgresql
until (echo > /dev/tcp/zammad-postgresql/5432) &> /dev/null; do
echo "zammad railsserver waiting for postgresql server to be ready..."
@ -43,5 +43,35 @@ if [ "$1" = 'zammad-railsserver' ]; then
elif [ "${RAILS_SERVER}" == "unicorn" ]; then
exec gosu ${ZAMMAD_USER}:${ZAMMAD_USER} bundle exec unicorn -p 3000 -c config/unicorn.rb -E ${RAILS_ENV}
fi
fi
# zammad-scheduler
if [ "$1" = 'zammad-scheduler' ]; then
# wait for zammad process coming up
until (echo > /dev/tcp/zammad-railsserver/3000) &> /dev/null; do
echo "scheduler waiting for zammads railsserver to be ready..."
sleep 2
done
echo "scheduler can access raillsserver now..."
# start scheduler
cd ${ZAMMAD_DIR}
exec gosu ${ZAMMAD_USER}:${ZAMMAD_USER} bundle exec script/scheduler.rb run
fi
# zammad-websocket
if [ "$1" = 'zammad-websocket' ]; then
# wait for zammad process coming up
until (echo > /dev/tcp/zammad-railsserver/3000) &> /dev/null; do
echo "websocket server waiting for zammads railsserver to be ready..."
sleep 5
done
echo "websocket server can access raillsserver now..."
cd ${ZAMMAD_DIR}
exec gosu ${ZAMMAD_USER}:${ZAMMAD_USER} bundle exec script/websocket-server.rb -b 0.0.0.0 start
fi

View File

@ -2,23 +2,12 @@ version: '3.3'
services:
zammad:
build:
context: .
dockerfile: containers/zammad/Dockerfile
depends_on:
- zammad-elasticsearch
- zammad-postgresql
restart: on-failure
volumes:
- data-zammad:/home/zammad
zammad-backup:
build:
context: .
dockerfile: containers/zammad-backup/Dockerfile
depends_on:
- zammad
- zammad-railsserver
links:
- zammad-postgresql
restart: always
@ -37,7 +26,7 @@ services:
context: .
dockerfile: containers/zammad-nginx/Dockerfile
depends_on:
- zammad
- zammad-railsserver
links:
- zammad-railsserver
- zammad-websocket
@ -58,39 +47,42 @@ services:
context: .
dockerfile: containers/zammad-railsserver/Dockerfile
depends_on:
- zammad
- zammad-postgresql
links:
- zammad-elasticsearch
- zammad-postgresql
restart: always
volumes:
- data-zammad:/home/zammad
command: ["zammad-railsserver"]
zammad-scheduler:
build:
context: .
dockerfile: containers/zammad-scheduler/Dockerfile
depends_on:
- zammad
- zammad-railsserver
links:
- zammad-elasticsearch
- zammad-postgresql
restart: always
volumes:
- data-zammad:/home/zammad
command: ["zammad-scheduler"]
zammad-websocket:
build:
context: .
dockerfile: containers/zammad-websocket/Dockerfile
depends_on:
- zammad
- zammad-railsserver
links:
- zammad-elasticsearch
- zammad-postgresql
restart: always
volumes:
- data-zammad:/home/zammad
command: ["zammad-websocket"]
volumes:
backup-zammad:

View File

@ -2,21 +2,9 @@ version: '3.3'
services:
zammad:
depends_on:
- zammad-elasticsearch
- zammad-postgresql
image: zammad/zammad-docker-compose:zammad
labels:
io.rancher.container.pull_image: always
io.rancher.container.start_once: 'true'
restart: on-failure
volumes:
- data-zammad:/home/zammad
zammad-backup:
depends_on:
- zammad
- zammad-railsserver
image: zammad/zammad-docker-compose:zammad-backup
labels:
io.rancher.container.pull_image: always
@ -37,7 +25,7 @@ services:
zammad-nginx:
depends_on:
- zammad
- zammad-railsserver
image: zammad/zammad-docker-compose:zammad-nginx
labels:
io.rancher.container.pull_image: always
@ -58,23 +46,22 @@ services:
zammad-railsserver:
depends_on:
- zammad
image: zammad/zammad-docker-compose:zammad-railsserver
- zammad-postgresql
image: zammad/zammad-docker-compose:zammad
labels:
io.rancher.container.pull_image: always
links:
- zammad-elasticsearch
- zammad-postgresql
depends_on:
- zammad
restart: always
volumes:
- data-zammad:/home/zammad
command: ["zammad-railsserver"]
zammad-scheduler:
depends_on:
- zammad
image: zammad/zammad-docker-compose:zammad-scheduler
- zammad-railsserver
image: zammad/zammad-docker-compose:zammad
labels:
io.rancher.container.pull_image: always
links:
@ -83,11 +70,12 @@ services:
restart: always
volumes:
- data-zammad:/home/zammad
command: ["zammad-scheduler"]
zammad-websocket:
depends_on:
- zammad
image: zammad/zammad-docker-compose:zammad-websocket
- zammad-railsserver
image: zammad/zammad-docker-compose:zammad
labels:
io.rancher.container.pull_image: always
links:
@ -96,6 +84,7 @@ services:
restart: always
volumes:
- data-zammad:/home/zammad
command: ["zammad-websocket"]
volumes:
backup-zammad:

View File

@ -3,4 +3,4 @@
# build hooks config
#
DOCKER_IMAGES="zammad zammad-backup zammad-elasticsearch zammad-nginx zammad-postgresql zammad-railsserver zammad-scheduler zammad-websocket"
DOCKER_IMAGES="zammad zammad-backup zammad-elasticsearch zammad-nginx zammad-postgresql"

View File

@ -2,10 +2,6 @@ version: '2'
services:
zammad:
scale: 1
start_on_create: true
zammad-backup:
scale: 1
start_on_create: true