renamed containers

This commit is contained in:
André Bauer 2017-03-08 19:37:05 +01:00
parent 239443a523
commit b419b20d3f
13 changed files with 107 additions and 99 deletions

View File

@ -13,7 +13,7 @@ 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"
ADD containers/nginx/nginx-zammad.conf /etc/nginx/conf.d/zammad.conf
ADD containers/zammad-nginx/nginx-zammad.conf /etc/nginx/conf.d/zammad.conf
RUN rm /etc/nginx/conf.d/default.conf

View File

@ -2,29 +2,35 @@
if [ "$1" = 'zammad-railsserver' ]; then
cd ${ZAMMAD_DIR}
bundle exec rake db:migrate &> /dev/null
# wait for postgres process coming up on zammad-postgresql
until echo > /dev/tcp/zammad-postgresql/5432; do
echo "waiting for postgres to be ready..."
sleep 5
done
if [ $? != 0 ]; then
echo "creating db & searchindex..."
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake db:seed
bundle exec rails r "Setting.set('es_url', 'http://elasticsearch:9200')"
bundle exec rake searchindex:rebuild
fi
cd ${ZAMMAD_DIR}
bundle exec rake db:migrate &> /dev/null
# delete logs
find ${ZAMMAD_DIR}/log -iname *.log -exec rm {} \;
if [ $? != 0 ]; then
echo "creating db & searchindex..."
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake db:seed
bundle exec rails r "Setting.set('es_url', 'http://elasticsearch:9200')"
bundle exec rake searchindex:rebuild
fi
# run zammad
echo "starting zammad..."
echo "zammad will be accessable on http://localhost in some seconds"
# delete logs
find ${ZAMMAD_DIR}/log -iname *.log -exec rm {} \;
if [ "${RAILS_SERVER}" == "puma" ]; then
bundle exec puma -b tcp://0.0.0.0:3000 -e ${RAILS_ENV}
# run zammad
echo "starting zammad..."
echo "zammad will be accessable on http://localhost in some seconds"
if [ "${RAILS_SERVER}" == "puma" ]; then
bundle exec puma -b tcp://0.0.0.0:3000 -e ${RAILS_ENV}
elif [ "${RAILS_SERVER}" == "unicorn" ]; then
bundle exec unicorn -p 3000 -c config/unicorn.rb -E ${RAILS_ENV}
fi
bundle exec unicorn -p 3000 -c config/unicorn.rb -E ${RAILS_ENV}
fi
fi

View File

@ -1,9 +1,13 @@
#!/bin/bash
if [ "$1" = 'zammad-scheduler' ]; then
# wait for zammad process coming up
until echo > /dev/tcp/zammad-railsserver/3000; do
echo "waiting for zammad to be ready..."
sleep 2
done
# start scheduler
cd ${ZAMMAD_DIR}
bundle exec script/scheduler.rb run
# start scheduler
cd ${ZAMMAD_DIR}
bundle exec script/scheduler.rb run
fi

View File

@ -1,8 +1,12 @@
#!/bin/bash
if [ "$1" = 'zammad-websocket' ]; then
# wait for zammad process coming up
until echo > /dev/tcp/zammad-railsserver/3000; do
echo "waiting for zammad to be ready..."
sleep 5
done
cd ${ZAMMAD_DIR}
bundle exec script/websocket-server.rb -b 0.0.0.0 start
cd ${ZAMMAD_DIR}
bundle exec script/websocket-server.rb -b 0.0.0.0 start
fi

View File

@ -27,7 +27,6 @@ COPY containers/zammad/install-zammad.sh /tmp
RUN chmod +x /tmp/install-zammad.sh;/bin/bash -l -c /tmp/install-zammad.sh
# cleanup
RUN apt-get remove --purge -y git-core build-essential bzip2 libffi-dev libgdbm3 libssl-dev procps zlib1g-dev && \
RUN apt-get remove --purge -y build-essential bzip2 git-core libffi-dev libgdbm3 libssl-dev procps zlib1g-dev && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

View File

@ -17,13 +17,13 @@ bundle install --without test development mysql
contrib/packager.io/fetch_locales.rb
# set nulldb database adapter for assets precompile
sed -e 's#.*adapter: postgresql# adapter: nulldb#g' -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: postgresql\n#g' < config/database.yml.pkgr > config/database.yml
sed -e 's#.*adapter: postgresql# adapter: nulldb#g' -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: zammad-postgresql\n#g' < config/database.yml.pkgr > config/database.yml
# assets precompile
bundle exec rake assets:precompile
# set postgresql database adapter
sed -e 's#.*adapter: postgresql# adapter: postgresql#g' -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: postgresql\n#g' < config/database.yml.pkgr > config/database.yml
sed -e 's#.*adapter: postgresql# adapter: postgresql#g' -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: zammad-postgresql\n#g' < config/database.yml.pkgr > config/database.yml
# delete assets precompile cache
rm -r tmp/cache

View File

@ -2,16 +2,27 @@ version: '2'
services:
elasticsearch:
zammad:
build:
context: .
dockerfile: containers/elasticsearch/Dockerfile
dockerfile: containers/zammad/Dockerfile
depends_on:
- zammad-elasticsearch
- zammad-postgresql
restart: on-failure
volumes:
- data-zammad:/home/zammad
zammad-elasticsearch:
build:
context: .
dockerfile: containers/zammad-elasticsearch/Dockerfile
restart: always
nginx:
zammad-nginx:
build:
context: .
dockerfile: containers/nginx/Dockerfile
dockerfile: containers/zammad-nginx/Dockerfile
depends_on:
- zammad
links:
@ -23,31 +34,21 @@ services:
volumes:
- data-zammad:/home/zammad
postgresql:
zammad-postgresql:
build:
context: .
dockerfile: containers/postgresql/Dockerfile
dockerfile: containers/zammad-postgresql/Dockerfile
restart: always
zammad:
build:
context: .
dockerfile: containers/zammad/Dockerfile
restart: on-failure
volumes:
- data-zammad:/home/zammad
zammad-railsserver:
build:
context: .
dockerfile: containers/zammad-railsserver/Dockerfile
depends_on:
- elasticsearch
- postgresql
- zammad
links:
- elasticsearch
- postgresql
- zammad-elasticsearch
- zammad-postgresql
restart: always
zammad-scheduler:
@ -55,12 +56,10 @@ services:
context: .
dockerfile: containers/zammad-scheduler/Dockerfile
depends_on:
- elasticsearch
- postgresql
- zammad
- zammad-railsserver
links:
- elasticsearch
- postgresql
- zammad-elasticsearch
- zammad-postgresql
restart: always
zammad-websocket:
@ -68,12 +67,10 @@ services:
context: .
dockerfile: containers/zammad-websocket/Dockerfile
depends_on:
- elasticsearch
- postgresql
- zammad
- zammad-railsserver
links:
- elasticsearch
- postgresql
- zammad-elasticsearch
- zammad-postgresql
restart: always
volumes:

View File

@ -2,16 +2,28 @@ version: '2'
services:
elasticsearch:
image: zammad/zammad-docker-compose:elasticsearch
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-elasticsearch:
image: zammad/zammad-docker-compose:zammad-elasticsearch
labels:
io.rancher.container.pull_image: always
restart: always
nginx:
zammad-nginx:
depends_on:
- zammad
image: zammad/zammad-docker-compose:nginx
image: zammad/zammad-docker-compose:zammad-nginx
labels:
io.rancher.container.pull_image: always
links:
@ -23,32 +35,21 @@ services:
volumes:
- data-zammad:/home/zammad
postgresql:
image: zammad/zammad-docker-compose:postgresql
zammad-postgresql:
image: zammad/zammad-docker-compose:zammad-postgresql
labels:
io.rancher.container.pull_image: always
restart: always
zammad:
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-railsserver:
image: zammad/zammad-docker-compose:zammad-railsserver
labels:
io.rancher.container.pull_image: always
links:
- elasticsearch
- postgresql
- zammad-elasticsearch
- zammad-postgresql
- zammad
depends_on:
- elasticsearch
- postgresql
- zammad
restart: always
@ -57,13 +58,11 @@ services:
labels:
io.rancher.container.pull_image: always
links:
- elasticsearch
- postgresql
- zammad-elasticsearch
- zammad-postgresql
- zammad
depends_on:
- elasticsearch
- postgresql
- zammad
- zammad-railsserver
restart: always
zammad-websocket:
@ -71,11 +70,10 @@ services:
labels:
io.rancher.container.pull_image: always
links:
- postgresql
- zammad-postgresql
- zammad
depends_on:
- postgresql
- zammad
- zammad-railsserver
restart: always
volumes:

View File

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

View File

@ -2,22 +2,22 @@ version: '2'
services:
elasticsearch:
scale: 1
start_on_create: true
nginx:
scale: 1
start_on_create: true
postgresql:
scale: 1
start_on_create: true
zammad:
scale: 1
start_on_create: true
zammad-elasticsearch:
scale: 1
start_on_create: true
zammad-nginx:
scale: 1
start_on_create: true
zammad-postgresql:
scale: 1
start_on_create: true
zammad-scheduler:
scale: 1
start_on_create: true