diff --git a/.env.dist b/.env.dist index c6524831..dcd491a5 100644 --- a/.env.dist +++ b/.env.dist @@ -116,3 +116,11 @@ # ZAMMAD_SCHEDULER_RESOURCES_LIMITS_MEMORY=500M # ZAMMAD_WEBSOCKET_RESOURCES_LIMITS_CPUS=1.0 # ZAMMAD_WEBSOCKET_RESOURCES_LIMITS_MEMORY=500M + +############################################## +# scenarios/disable-nginx-service.yml +# ############################################ + +# DOCKER_RAILS_BINDHOST=localhost +# DOCKER_RAILS_BIND_PORT=3100 + diff --git a/.github/tests/disable-nginx-service.sh b/.github/tests/disable-nginx-service.sh new file mode 100755 index 00000000..6e8827f5 --- /dev/null +++ b/.github/tests/disable-nginx-service.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# shellcheck source=/dev/null +. "$(dirname "$0")/include/functions.sh" + +check_stack_start false # do not use nginx + +print_heading "check for absence of nginx container" +docker compose ps | grep zammad-nginx +print_heading "Success - nginx container is absent" diff --git a/.github/tests/include/functions.sh b/.github/tests/include/functions.sh index 9ccd0ece..a34cbeb0 100755 --- a/.github/tests/include/functions.sh +++ b/.github/tests/include/functions.sh @@ -18,8 +18,16 @@ railsserver_run_command() { } check_stack_start() { + dont_use_nginx="$1" + print_heading "wait for zammad to be ready…" docker compose wait zammad-init - docker compose exec zammad-nginx bash -c "curl --retry 30 --retry-delay 1 --retry-connrefused http://localhost:8080 | grep 'Zammad'" + + if [ -z "$dont_use_nginx" ]; then + docker compose exec zammad-nginx bash -c "curl --retry 30 --retry-delay 1 --retry-connrefused http://localhost:8080 | grep 'Zammad'" + else + docker compose exec zammad-railsserver bash -c "curl --retry 30 --retry-delay 1 --retry-connrefused http://localhost:3000 | grep 'Zammad'" + fi + print_heading "Success - Zammad is up :)" -} \ No newline at end of file +} diff --git a/.github/tests/setup/disable-nginx-service.sh b/.github/tests/setup/disable-nginx-service.sh new file mode 100755 index 00000000..d73effc1 --- /dev/null +++ b/.github/tests/setup/disable-nginx-service.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -o errexit + +# Disable ES initialization in the test because we don't have an external ES service. +echo "NGINX_ENABLED=false" > .env + +docker compose -f docker-compose.yml -f scenarios/disable-nginx-service.yml up --pull always --quiet-pull --detach diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 172073ed..d21b34ee 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -56,6 +56,7 @@ jobs: - apply-resource-limits - disable-backup-service - disable-elasticsearch-service + - disable-nginx-service steps: - name: Checkout uses: actions/checkout@v6 diff --git a/scenarios/disable-nginx-service.yml b/scenarios/disable-nginx-service.yml new file mode 100644 index 00000000..e594cad0 --- /dev/null +++ b/scenarios/disable-nginx-service.yml @@ -0,0 +1,23 @@ +--- +version: "3.8" + +# +# Disable the nginx service, for example if there is already a reverse proxy handling +# the connections and you want connect directly to rails from this reverse proxy +# + +services: + zammad-nginx: + profiles: + - do-not-start + + zammad-railsserver: + environment: + RAILS_SERVE_STATIC_FILES: true + ports: + - "${DOCKER_RAILS_BIND_HOST:-127.0.0.1}:${DOCKER_RAILS_BIND_PORT:-3100}:${ZAMMAD_RAILSSERVER_PORT:-3000}" + + zammad-websocket: + ports: + - "${DOCKER_RAILS_BIND_HOST:-127.0.0.1}:${DOCKER_ZAMMAD_WEBSOCKET_BIND_PORT:-6042}:${ZAMMAD_WEBSOCKET_PORT:-6042}" +