Files
vnctalk-prosody/docker-compose.yml
Stefan-Sanger 35161b9b6d fix: resolve 3 in-container test failures in CI compose run
1. REST 404 "Unknown host: prosody": the tester reaches prosody by
   service name (http://prosody:5280), so aiohttp sends Host: prosody,
   which Prosody rejects as an unknown vhost. The auto host-header
   heuristic only overrides for IP/localhost. Set REST_HOST_HEADER=
   example.com explicitly in the tester env so HTTP routing lands on the
   example.com VirtualHost that serves mod_http_rest /rest.

2. healthcheck.sh not found: the static test_04_infra checks resolve
   ../config/healthcheck.sh (= /config/healthcheck.sh) but the tester
   image only ships /tests. Mount ./config:/config:ro so the path
   resolves inside the container.

3. telnet non-loopback banner: read only 256 bytes, capturing just the
   ASCII-art top and never the literal "Prosody" text. Bump to 1024 to
   match test_04_infra.test_telnet_banner, which passes with the larger
   read.

Part-of: <http://gitlab.vnc.biz/uxf/vnctalk-prosody/-/merge_requests/3>
2026-07-15 17:59:12 +02:00

115 lines
4.3 KiB
YAML

# Test harness for vnctalk-prosody end-to-end verification.
#
# Brings up Prosody (built from this repo's Dockerfile), a local PostgreSQL,
# and a single aiohttp mock service that stands in for every external HTTP
# backend (auth, FCM, file-share, avatar upload). The optional `tester`
# service runs the pytest suite inside the compose network; for local dev the
# host can run pytest directly against the published ports.
#
# docker compose up -d --build postgres mocks prosody
# docker compose run --rm tester pytest . -v -c pytest.ini
#
# Env-var names below use the EXACT placeholders found in
# config/prosody.cfg.lua.template (snake_case ${fcm_api_url} / ${del_api_url}).
# test.sh historically passed camelCase fcmApiUrl/fcmDelUrl, which envsubst
# silently leaves unsubstituted — see test-improvement.md §1.2.
services:
postgres:
image: postgres:15-alpine
environment:
POSTGRES_DB: prosody
POSTGRES_USER: prosody
POSTGRES_PASSWORD: prosody
ports: ["5434:5432"] # 5434 on host (5433 often taken by a local PG)
volumes: [pgdata:/var/lib/postgresql/data]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U prosody"]
interval: 2s
retries: 30
mocks:
build: ./tests/mocks
ports: ["8092:8080"] # host inspection of /__requests (8090 often taken)
environment:
AUTH_USERS: "user1@example.com:pass1,user2@example.com:pass2,admin@example.com:adminpw"
prosody:
build: .
# The image declares USER prosody, but startup.sh writes certs and the
# rendered config into /etc/prosody (root-owned). Production runs as root
# (run_as_root = true); mirror that here so the harness is self-contained.
user: "0:0"
depends_on:
postgres: { condition: service_healthy }
mocks: { condition: service_started }
ports:
- "5222:5222" # C2S
- "5280:5280" # HTTP (BOSH/WS/REST/admin)
- "${TELNET_HOST_PORT:-5582}:5582" # admin telnet
environment:
prosodyDomain: example.com
prosodyDBhost: postgres
prosodyDBname: prosody
prosodyDBuser: prosody
prosodyDBpass: prosody
hybridaAuthUrl: http://mocks:8080/auth
fcm_api_url: http://mocks:8080/fcm/notify
del_api_url: http://mocks:8080/delfile
fcmApiKey: test-fcm-key
fileShareBaseUrl: http://mocks:8080/share/
fileShareSecret: test-share-secret
avatarUploadUrl: http://mocks:8080/avatar/
avatarUploadUser: avatar
avatarUploadPass: avpw
DEFAULT_JITSI_CONFERENCE: conference.jitsi.test
log_slow_events_threshold: "1.5"
# Lower SMACKS hibernation window so test_10 can exercise expiry without
# waiting 5 minutes. startup.sh appends this to the rendered config when set.
SMACKS_HIBERNATION_TIME: "10"
C2S_STANZA_SIZE_LIMIT: "5242880"
S2S_STANZA_SIZE_LIMIT: "5242880"
healthcheck:
test: ["CMD", "/vnc/config/healthcheck.sh"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
tester:
build: ./tests
profiles: ["ci"] # only started with --profile ci
depends_on: [prosody]
environment:
XMPP_HOST: prosody
XMPP_PORT: "5222"
XMPP_DOMAIN: example.com
MUC_DOMAIN: conference.example.com
XMPP_JID: user1@example.com
XMPP_PASSWORD: pass1
XMPP_JID2: user2@example.com
XMPP_PASSWORD2: pass2
REST_URL: http://prosody:5280/rest
BOSH_URL: http://prosody:5280/http-bind
WS_URL: ws://prosody:5280/xmpp-websocket
ADMIN_TELNET_HOST: prosody
PG_HOST: postgres
PG_USER: prosody
PG_PASSWORD: prosody
PG_DB: prosody
MOCK_URL: http://mocks:8080 # for side-effect assertions
# The tester reaches prosody directly by service name (http://prosody:5280),
# so aiohttp sends Host: prosody — which Prosody rejects as an unknown
# vhost (404 "Unknown host"). Send the real XMPP domain so HTTP routing
# lands on the example.com VirtualHost that serves mod_http_rest /rest.
REST_HOST_HEADER: example.com
volumes:
- ./tests:/tests
# Surface the repo config/ dir so static tests (test_04_infra
# healthcheck source checks) can resolve ../config/healthcheck.sh
# from inside the container.
- ./config:/config:ro
volumes:
pgdata: