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.yaml b/.github/workflows/ci.yaml index 70030b3..3243b98 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -48,10 +48,8 @@ jobs: uses: actions/checkout@v1 - 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 + 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 @@ -62,7 +60,7 @@ jobs: - codespell - lint-docker-compose-file - super-linter - timeout-minutes: 10 + timeout-minutes: 20 runs-on: ubuntu-20.04 steps: - name: Checkout diff --git a/containers/zammad/Dockerfile b/containers/zammad/Dockerfile index b2368fb..6a61f3f 100644 --- a/containers/zammad/Dockerfile +++ b/containers/zammad/Dockerfile @@ -8,6 +8,7 @@ ARG DEBIAN_FRONTEND=noninteractive ENV GIT_BRANCH stable ENV GIT_URL ${PROJECT_URL}.git ENV PROJECT_URL https://github.com/zammad/zammad +ENV RAILS_LOG_TO_STDOUT true ENV RAILS_ENV production ENV TAR_GZ_URL ${PROJECT_URL}/archive/${GIT_BRANCH}.tar.gz ENV ZAMMAD_DIR /opt/zammad diff --git a/containers/zammad/docker-entrypoint.sh b/containers/zammad/docker-entrypoint.sh index d1faf87..9cc0c6c 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 .*#listen ${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..21e1715 100755 --- a/containers/zammad/setup.sh +++ b/containers/zammad/setup.sh @@ -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}