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.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"
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 RUN rm /etc/nginx/conf.d/default.conf

View File

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

View File

@ -1,9 +1,13 @@
#!/bin/bash #!/bin/bash
if [ "$1" = 'zammad-scheduler' ]; then 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 # start scheduler
cd ${ZAMMAD_DIR} cd ${ZAMMAD_DIR}
bundle exec script/scheduler.rb run bundle exec script/scheduler.rb run
fi fi

View File

@ -1,8 +1,12 @@
#!/bin/bash #!/bin/bash
if [ "$1" = 'zammad-websocket' ]; then 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} cd ${ZAMMAD_DIR}
bundle exec script/websocket-server.rb -b 0.0.0.0 start bundle exec script/websocket-server.rb -b 0.0.0.0 start
fi 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 RUN chmod +x /tmp/install-zammad.sh;/bin/bash -l -c /tmp/install-zammad.sh
# cleanup # 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 && \ apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*

View File

@ -17,13 +17,13 @@ bundle install --without test development mysql
contrib/packager.io/fetch_locales.rb contrib/packager.io/fetch_locales.rb
# set nulldb database adapter for assets precompile # 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 # assets precompile
bundle exec rake assets:precompile bundle exec rake assets:precompile
# set postgresql database adapter # 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 # delete assets precompile cache
rm -r tmp/cache rm -r tmp/cache

View File

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

View File

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

View File

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