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> MAINTAINER Zammad <info@zammad.org>
ARG BUILD_DATE 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.schema-version="1.2" \
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 wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add - \ RUN apt-get update;apt-get -y wget gnupg2 \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" >> /etc/apt/sources.list.d/postgres.list \ && wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add - \
&& apt-get update;apt-get -y install postgresql-client \ && echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" >> /etc/apt/sources.list.d/postgres.list \
&& rm -rf /var/lib/apt/lists/* && apt-get update;apt-get -y install postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# create entrypoint # create entrypoint
COPY containers/zammad-backup/docker-entrypoint.sh / 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 \ && rm -r tmp/cache \
&& chown -R ${ZAMMAD_USER}:${ZAMMAD_USER} ${ZAMMAD_TMP_DIR} && 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} WORKDIR ${ZAMMAD_DIR}

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# zammad-railsserver
if [ "$1" = 'zammad-railsserver' ]; then if [ "$1" = 'zammad-railsserver' ]; then
# wait for postgres process coming up on zammad-postgresql # wait for postgres process coming up on zammad-postgresql
until (echo > /dev/tcp/zammad-postgresql/5432) &> /dev/null; do until (echo > /dev/tcp/zammad-postgresql/5432) &> /dev/null; do
echo "zammad railsserver waiting for postgresql server to be ready..." echo "zammad railsserver waiting for postgresql server to be ready..."
@ -43,5 +43,35 @@ if [ "$1" = 'zammad-railsserver' ]; then
elif [ "${RAILS_SERVER}" == "unicorn" ]; then elif [ "${RAILS_SERVER}" == "unicorn" ]; then
exec gosu ${ZAMMAD_USER}:${ZAMMAD_USER} bundle exec unicorn -p 3000 -c config/unicorn.rb -E ${RAILS_ENV} exec gosu ${ZAMMAD_USER}:${ZAMMAD_USER} bundle exec unicorn -p 3000 -c config/unicorn.rb -E ${RAILS_ENV}
fi 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 fi

View File

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

View File

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

View File

@ -3,4 +3,4 @@
# build hooks config # 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: services:
zammad:
scale: 1
start_on_create: true
zammad-backup: zammad-backup:
scale: 1 scale: 1
start_on_create: true start_on_create: true