diff --git a/.env b/.env index 9d517b8..7c6fdec 100644 --- a/.env +++ b/.env @@ -3,4 +3,4 @@ POSTGRES_PASS=zammad POSTGRES_USER=zammad RESTART=always # don't forget to add the minus before the version -VERSION=-3.6.0-63c +VERSION=-4.0.0-25c \ No newline at end of file diff --git a/.github/docker-image-build.sh b/.github/docker-image-build.sh index f9c09e4..d119540 100755 --- a/.github/docker-image-build.sh +++ b/.github/docker-image-build.sh @@ -9,6 +9,6 @@ DOCKER_IMAGES="zammad zammad-elasticsearch zammad-postgresql" # shellcheck disable=SC2153 for DOCKER_IMAGE in ${DOCKER_IMAGES}; do - echo "Build Zammad Docker image ${DOCKER_IMAGE} for local test" - docker build --pull --no-cache --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" -t "${DOCKER_IMAGE}" -f "containers/${DOCKER_IMAGE}/Dockerfile" . + echo "Build Zammad Docker image ${DOCKER_IMAGE} for local or ci tests" + docker build --pull --no-cache --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" -t "${DOCKER_IMAGE}-local" -f "containers/${DOCKER_IMAGE}/Dockerfile" . done diff --git a/.github/tests.sh b/.github/tests.sh index f143eb7..1f633f8 100755 --- a/.github/tests.sh +++ b/.github/tests.sh @@ -8,7 +8,7 @@ set -o pipefail docker-compose logs --timestamps --follow & -until (curl -I --silent --fail localhost | grep -iq "HTTP/1.1 200 OK"); do +until (curl -I --silent --fail localhost:8080 | grep -iq "HTTP/1.1 200 OK"); do echo "wait for zammad to be ready..." sleep 15 done diff --git a/.github/workflows/ci-remote-image.yaml b/.github/workflows/ci-remote-image.yaml new file mode 100644 index 0000000..9ed0dc4 --- /dev/null +++ b/.github/workflows/ci-remote-image.yaml @@ -0,0 +1,26 @@ +name: ci-remote-image + +on: + pull_request: + paths: + - '.env' + +jobs: + run-remote-image-docker-compose: + timeout-minutes: 20 + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: pull docker-compose images + run: docker-compose pull + + - name: run docker-compose up + run: docker-compose up --detach + + - name: add autowizard file + run: docker cp .github/auto_wizard.json zammad-docker-compose_zammad-railsserver_1:/opt/zammad + + - name: run tests + run: .github/tests.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 70030b3..ff9ea53 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,6 +10,7 @@ jobs: steps: - name: Checkout Code uses: actions/checkout@v2 + - name: Codespell uses: codespell-project/actions-codespell@master with: @@ -21,7 +22,8 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v2 + - name: lint zammad docker-compose file run: docker-compose config @@ -30,6 +32,7 @@ jobs: steps: - name: Checkout Code uses: actions/checkout@v2 + - name: Lint Code Base uses: github/super-linter@v3 env: @@ -45,33 +48,16 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v2 + - name: build docker containers run: .github/docker-image-build.sh - - name: use images build by ci - run: sed -i -e 's#${IMAGE_REPO}:##g' -e 's#${VERSION}##g' docker-compose.yml - - name: run docker-compose up - run: docker-compose up --detach - - name: add autowizard file - run: docker cp .github/auto_wizard.json zammad-docker-compose_zammad-railsserver_1:/opt/zammad - - name: run tests - run: .github/tests.sh - run-remote-image-docker-compose: - needs: - - codespell - - lint-docker-compose-file - - super-linter - timeout-minutes: 10 - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v1 - - name: pull docker-compose images - run: docker-compose pull - name: run docker-compose up - run: docker-compose up --detach + run: docker-compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.override-local.yml up --detach + - name: add autowizard file run: docker cp .github/auto_wizard.json zammad-docker-compose_zammad-railsserver_1:/opt/zammad + - name: run tests run: .github/tests.sh diff --git a/Dockerfile b/Dockerfile index 9492c92..ea5d3d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,5 +8,5 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \ org.label-schema.vcs-url="https://github.com/colpari/zammad" \ org.label-schema.vcs-type="Git" \ org.label-schema.vendor="colpari" \ - org.label-schema.schema-version="3.6.0" \ + org.label-schema.schema-version="4.0.0" \ org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" diff --git a/README.md b/README.md index d948951..2814831 100644 --- a/README.md +++ b/README.md @@ -70,3 +70,9 @@ CREATE USER zammad; ALTER USER zammad WITH PASSWORD 'zammad'; ALTER USER zammad WITH SUPERUSER CREATEDB; ``` + +### From =< 3.6.0-65 + +To be able to run Zammad container with an unprivileged user we had to change the port Nginx uses from 80 to 8080, so Zammad needs to be accessed via instead of now! + +This change will also affect you, if you use a reverse proxy, like Traefik or Haproxy, in front of Zammad as your reverse proxy configuration needs to be adapted to point to port 8080 now. diff --git a/containers/zammad-elasticsearch/Dockerfile b/containers/zammad-elasticsearch/Dockerfile index 5bead15..6292169 100644 --- a/containers/zammad-elasticsearch/Dockerfile +++ b/containers/zammad-elasticsearch/Dockerfile @@ -9,7 +9,7 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \ org.label-schema.vcs-url="https://github.com/colpari/zammad" \ org.label-schema.vcs-type="Git" \ org.label-schema.vendor="colpari" \ - org.label-schema.schema-version="3.6.0" \ + org.label-schema.schema-version="4.0.0" \ org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"] diff --git a/containers/zammad-postgresql/Dockerfile b/containers/zammad-postgresql/Dockerfile index 2566ae0..3e75d51 100644 --- a/containers/zammad-postgresql/Dockerfile +++ b/containers/zammad-postgresql/Dockerfile @@ -10,7 +10,7 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \ org.label-schema.vcs-url="https://github.com/colpari/zammad" \ org.label-schema.vcs-type="Git" \ org.label-schema.vendor="colpari" \ - org.label-schema.schema-version="3.6.0" \ + org.label-schema.schema-version="4.0.0" \ org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"] diff --git a/containers/zammad-postgresql/backup.sh b/containers/zammad-postgresql/backup.sh index 6774d76..6c570ee 100755 --- a/containers/zammad-postgresql/backup.sh +++ b/containers/zammad-postgresql/backup.sh @@ -24,7 +24,7 @@ function zammad_backup { # delete old backups if [ -d "${BACKUP_DIR}" ] && [ -n "$(ls "${BACKUP_DIR}")" ]; then - find "${BACKUP_DIR}"/*_zammad_*.gz -type f -mtime +"${HOLD_DAYS}" -exec rm {} \; + find "${BACKUP_DIR}"/*_zammad_*.gz -type f -mtime +"${HOLD_DAYS}" -delete fi if [ "${NO_FILE_BACKUP}" != "yes" ]; then diff --git a/containers/zammad/Dockerfile b/containers/zammad/Dockerfile index b20dde1..ec3cc48 100644 --- a/containers/zammad/Dockerfile +++ b/containers/zammad/Dockerfile @@ -9,6 +9,7 @@ ENV GIT_BRANCH colpari-develop ENV GIT_URL ${PROJECT_URL}.git ENV PROJECT_URL https://github.com/colpari/zammad ENV RAILS_ENV production +ENV RAILS_LOG_TO_STDOUT true ENV TAR_GZ_URL ${PROJECT_URL}/archive/${GIT_BRANCH}.tar.gz ENV ZAMMAD_DIR /opt/zammad ENV ZAMMAD_READY_FILE ${ZAMMAD_DIR}/tmp/zammad.ready @@ -36,11 +37,12 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \ org.label-schema.vcs-url="https://github.com/colpari/zammad" \ org.label-schema.vcs-type="Git" \ org.label-schema.vendor="colpari" \ - org.label-schema.schema-version="3.6.0" \ + org.label-schema.schema-version="4.0.0" \ org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" ENV GIT_BRANCH colpari-develop ENV RAILS_ENV production +ENV RAILS_LOG_TO_STDOUT true ENV ZAMMAD_DIR /opt/zammad ENV ZAMMAD_READY_FILE ${ZAMMAD_DIR}/tmp/zammad.ready ENV ZAMMAD_TMP_DIR /tmp/zammad-${GIT_BRANCH} diff --git a/containers/zammad/docker-entrypoint.sh b/containers/zammad/docker-entrypoint.sh index d1faf87..2c0e850 100755 --- a/containers/zammad/docker-entrypoint.sh +++ b/containers/zammad/docker-entrypoint.sh @@ -12,6 +12,7 @@ set -e : "${ELASTICSEARCH_SSL_VERIFY:=true}" : "${MEMCACHED_HOST:=zammad-memcached}" : "${MEMCACHED_PORT:=11211}" +: "${NGINX_PORT:=8080}" : "${NGINX_SERVER_NAME:=_}" : "${NGINX_SERVER_SCHEME:=\$scheme}" : "${POSTGRESQL_HOST:=zammad-postgresql}" @@ -120,7 +121,8 @@ if [ "$1" = 'zammad-nginx' ]; then check_zammad_ready # configure nginx - sed -e "s#proxy_set_header X-Forwarded-Proto .*;#proxy_set_header X-Forwarded-Proto ${NGINX_SERVER_SCHEME};#g" \ + sed -e "s#\(listen\)\(.*\)80#\1\2${NGINX_PORT}#g" \ + -e "s#proxy_set_header X-Forwarded-Proto .*;#proxy_set_header X-Forwarded-Proto ${NGINX_SERVER_SCHEME};#g" \ -e "s#server .*:3000#server ${ZAMMAD_RAILSSERVER_HOST}:${ZAMMAD_RAILSSERVER_PORT}#g" \ -e "s#server .*:6042#server ${ZAMMAD_WEBSOCKET_HOST}:${ZAMMAD_WEBSOCKET_PORT}#g" \ -e "s#server_name .*#server_name ${NGINX_SERVER_NAME};#g" \ diff --git a/containers/zammad/setup.sh b/containers/zammad/setup.sh index 3bbf654..47160f3 100755 --- a/containers/zammad/setup.sh +++ b/containers/zammad/setup.sh @@ -3,7 +3,7 @@ set -e # install dependencies if [ "$1" = 'builder' ]; then - PACKAGES="build-essential curl git libimlib2-dev libpq-dev" + PACKAGES="build-essential curl git libimlib2-dev libpq-dev shared-mime-info" elif [ "$1" = 'runner' ]; then PACKAGES="curl libimlib2 libpq5 nginx rsync" fi @@ -28,7 +28,6 @@ if [ "$1" = 'builder' ]; then contrib/packager.io/fetch_locales.rb sed -e 's#.*adapter: postgresql# adapter: nulldb#g' -e 's#.*username:.*# username: postgres#g' -e 's#.*password:.*# password: \n host: zammad-postgresql\n#g' < contrib/packager.io/database.yml.pkgr > config/database.yml sed -i "/require 'rails\/all'/a require\ 'nulldb'" config/application.rb - sed -i '/# Use a different logger for distributed setups./a \ \ config.logger = Logger.new(STDOUT)' config/environments/production.rb sed -i 's/.*scheduler_\(err\|out\).log.*//g' script/scheduler.rb touch db/schema.rb bundle exec rake assets:precompile diff --git a/docker-compose.override-local.yml b/docker-compose.override-local.yml new file mode 100644 index 0000000..26a0ebf --- /dev/null +++ b/docker-compose.override-local.yml @@ -0,0 +1,27 @@ +version: '2' + +services: + + zammad-backup: + image: zammad-postgresql-local + + zammad-elasticsearch: + image: zammad-elasticsearch-local + + zammad-init: + image: zammad-local + + zammad-nginx: + image: zammad-local + + zammad-postgresql: + image: zammad-postgresql-local + + zammad-railsserver: + image: zammad-local + + zammad-scheduler: + image: zammad-local + + zammad-websocket: + image: zammad-local diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 22e5cc4..c685a51 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -3,4 +3,4 @@ services: zammad-nginx: ports: - - "80:80" + - "8080:8080" diff --git a/docker-compose.yml b/docker-compose.yml index 3b5fff6..7c3b90d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -51,7 +51,7 @@ services: zammad-nginx: command: ["zammad-nginx"] expose: - - "80" + - "8080" depends_on: - zammad-railsserver image: ${IMAGE_REPO}:zammad${VERSION}