moved bundle install to Dockerfile, removed unneeded volumes, updated README

This commit is contained in:
André Bauer 2017-01-06 15:11:05 +01:00
parent b2386ddacb
commit 005fb5a07b
10 changed files with 32 additions and 46 deletions

View File

@ -10,4 +10,4 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \
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="1.0" \ org.label-schema.schema-version="1.0" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up --build" org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"

View File

@ -11,6 +11,6 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \
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="1.0" \ org.label-schema.schema-version="1.0" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up --build" org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
RUN yes | /usr/share/elasticsearch/bin/elasticsearch-plugin install mapper-attachments RUN yes | /usr/share/elasticsearch/bin/elasticsearch-plugin install mapper-attachments

View File

@ -11,7 +11,7 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \
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="1.0" \ org.label-schema.schema-version="1.0" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up --build" org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
ADD nginx-zammad.conf /etc/nginx/conf.d/zammad.conf ADD nginx-zammad.conf /etc/nginx/conf.d/zammad.conf

View File

@ -11,5 +11,5 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \
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="1.0" \ org.label-schema.schema-version="1.0" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up --build" org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"

View File

@ -11,7 +11,7 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \
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="1.0" \ org.label-schema.schema-version="1.0" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up --build" org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
# Expose ports # Expose ports
EXPOSE 3000 EXPOSE 3000
@ -20,6 +20,10 @@ EXPOSE 6042
# add zammad user # add zammad user
RUN useradd -m -d /home/zammad -s /bin/bash zammad;chown -R zammad:zammad /home/zammad RUN useradd -m -d /home/zammad -s /bin/bash zammad;chown -R zammad:zammad /home/zammad
# install zammad
COPY install-zammad.sh /tmp
RUN chmod +x /tmp/install-zammad.sh;/bin/bash -l -c /tmp/install-zammad.sh
# docker init # docker init
COPY docker-entrypoint.sh / COPY docker-entrypoint.sh /
RUN chown zammad:zammad /docker-entrypoint.sh;chmod +x /docker-entrypoint.sh RUN chown zammad:zammad /docker-entrypoint.sh;chmod +x /docker-entrypoint.sh

View File

@ -27,7 +27,7 @@ If you like to run zammad in production you should use one of the DEB or RPM pac
### Building locally ### Building locally
* docker-compose -f docker-compose-build.yml up --build * docker-compose -f docker-compose-build.yml up
## Docs ## Docs

View File

@ -4,8 +4,6 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile.elasticsearch dockerfile: Dockerfile.elasticsearch
volumes:
- data-elasticsearch:/var/lib/elasticsearch
nginx: nginx:
build: build:
context: . context: .
@ -22,8 +20,6 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile.postgresql dockerfile: Dockerfile.postgresql
volumes:
- data-postgresql:/var/lib/postgresql
zammad: zammad:
build: build:
context: . context: .
@ -38,10 +34,6 @@ services:
- data-zammad:/home/zammad - data-zammad:/home/zammad
- data-ruby:/usr/local - data-ruby:/usr/local
volumes: volumes:
data-elasticsearch:
driver: local
data-postgresql:
driver: local
data-ruby: data-ruby:
driver: local driver: local
data-zammad: data-zammad:

View File

@ -2,8 +2,6 @@ version: '2'
services: services:
elasticsearch: elasticsearch:
image: monotek/zammad-docker-compose:elasticsearch image: monotek/zammad-docker-compose:elasticsearch
volumes:
- data-elasticsearch:/var/lib/elasticsearch
nginx: nginx:
image: monotek/zammad-docker-compose:nginx image: monotek/zammad-docker-compose:nginx
ports: ports:
@ -16,8 +14,6 @@ services:
- data-zammad:/home/zammad - data-zammad:/home/zammad
postgresql: postgresql:
image: monotek/zammad-docker-compose:postgresql image: monotek/zammad-docker-compose:postgresql
volumes:
- data-postgresql:/var/lib/postgresql
zammad: zammad:
image: monotek/zammad-docker-compose:zammad image: monotek/zammad-docker-compose:zammad
links: links:
@ -30,10 +26,6 @@ services:
- data-zammad:/home/zammad - data-zammad:/home/zammad
- data-ruby:/usr/local - data-ruby:/usr/local
volumes: volumes:
data-elasticsearch:
driver: local
data-postgresql:
driver: local
data-ruby: data-ruby:
driver: local driver: local
data-zammad: data-zammad:

View File

@ -7,36 +7,17 @@ GIT_BRANCH="develop"
#GIT_BRANCH="unicorn" #GIT_BRANCH="unicorn"
RAILS_SERVER="puma" RAILS_SERVER="puma"
RAILS_ENV="production" RAILS_ENV="production"
FRESH_INSTALL="no"
DEBUG="no" DEBUG="no"
if [ "$1" = 'zammad' ]; then if [ "$1" = 'zammad' ]; then
export RAILS_ENV=${RAILS_ENV} export RAILS_ENV=${RAILS_ENV}
shopt -s dotglob cd ${ZAMMAD_DIR}
rake db:migrate &> /dev/null
if [ "${FRESH_INSTALL}" == "yes" ]; then if [ $? != 0 ]; then
echo "fresh install requested. deleting everything in ${ZAMMAD_DIR}" echo "creating db, assets, searchindex..."
rm -rf ${ZAMMAD_DIR}/*
fi
# get zammad
if [ -f ${ZAMMAD_DIR}/config/database.yml ]; then
echo "updating zammad..."
cd ${ZAMMAD_DIR}
git pull
bundle update
rake db:migrate
else
echo "installing zammad..."
cd /tmp
git clone --depth 1 -b ${GIT_BRANCH} ${GIT_URL}
mv -f /tmp/zammad/* ${ZAMMAD_DIR}/
cd ${ZAMMAD_DIR}
bundle install --without test development
sed -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: postgresql\n#g' < config/database.yml.pkgr > config/database.yml
rake db:drop
rake db:create rake db:create
rake db:migrate rake db:migrate
rake db:seed rake db:seed
@ -45,7 +26,7 @@ if [ "$1" = 'zammad' ]; then
rake searchindex:rebuild rake searchindex:rebuild
fi fi
# delte logs & pids # delete logs & pids
rm ${ZAMMAD_DIR}/log/* rm ${ZAMMAD_DIR}/log/*
rm ${ZAMMAD_DIR}/tmp/pids/* rm ${ZAMMAD_DIR}/tmp/pids/*

17
install-zammad.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
ZAMMAD_DIR="/home/zammad"
GIT_URL="https://github.com/zammad/zammad.git"
GIT_BRANCH="develop"
# install zammad
echo "installing zammad..."
cd /tmp
git clone --depth 1 -b ${GIT_BRANCH} ${GIT_URL}
cp -R /tmp/zammad/* ${ZAMMAD_DIR}
cp -R /tmp/zammad/.[!.]* ${ZAMMAD_DIR}
cd ${ZAMMAD_DIR}
rm -rf /tmp/zammad
bundle install --without test development mysql
sed -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: postgresql\n#g' < config/database.yml.pkgr > config/database.yml
chown -R zammad:zammad /home/zammad/