Stefan-Sanger ef8c0292d6 fix: convert conditional DO rules on prosody table to triggers
PostgreSQL rejects INSERT ... ON CONFLICT ... DO UPDATE on any table
that has a conditional (WHERE) DO/DO ALSO rule or a non-NOTHING DO
INSTEAD rule, erroring with 'INSERT with ON CONFLICT clause cannot be
used with table that has INSERT or UPDATE rules'. Prosody 13's
mod_storage_sql uses ON CONFLICT upserts against the prosody kv table
whenever prosody_unique_index exists (created by these scripts), so the
five inherited conditional DO rules on prosody (cache_group_avatarids,
update_profile_queue_from_insert/_update, update_muc_remote_name,
update_room_nick_jid_map_remote) broke every kv upsert (vcard, vcard_muc,
muc_remote, config, fcmtoken, ...).

Replace those rules with AFTER INSERT / AFTER INSERT OR UPDATE
row-level triggers, which do not block ON CONFLICT. The two profile-queue
rules merge into one AFTER INSERT OR UPDATE trigger so the UPDATE branch
of an ON CONFLICT upsert is also covered (it fires AFTER UPDATE triggers,
not AFTER INSERT, when the conflict is taken).

Also drop the legacy 0.11.6 update_group_owners rule. It is logically
dead under 13.0.6 (fires on key='_affiliations', which is never written)
but PostgreSQL checks rule existence at plan time, so even a dead
conditional rule blocks ON CONFLICT. Dropping it is mandatory, not
optional as the README previously claimed.

Conversion is added to both prosody-13-new-deployment.sql (fresh
deployments, and the run_new_deployment branch of migrate.sh) and
prosody-13-rules-triggers.sql (the run_rules_triggers branch for
0.11.6->13.0 upgrades), so every helm pre/post-upgrade hook path
reaches the fix. Derived-table INSTEAD upsert rules are unchanged.

Verified against postgres:16: both scripts apply cleanly, pg_rewrite
for prosody returns 0 rows, ON CONFLICT upserts succeed, and triggers
fire on both INSERT and conflict-UPDATE branches; reproduced the
production error by re-adding the legacy rules, then confirmed the
incremental script resolves it. Idempotent re-run safe.

Part-of: <http://gitlab.vnc.biz/uxf/vnctalk-prosody/-/merge_requests/10>
2026-07-16 06:49:46 +00:00

VNCtalk Prosody

Dockerized Prosody 13.0.6 XMPP server for VNCtalk, built from source against Lua 5.4 on Alpine. The Dockerfile compiles Prosody, applies source patches, and layers on custom Lua modules — producing a single image deployed to Kubernetes via the bundled Helm chart and ArgoCD.

Repository layout

Path Purpose
Dockerfile Multi-stage build: builder applies patches/*.patch to the extracted Prosody source, then ./configure --idn-library=idn --lua-version=5.4 && make install. Final stage copies the built tree + vnctalk/ modules + config/.
patches/ Unified diffs against upstream Prosody core files, applied with patch -p1 --fuzz=0 before configure. Adding/removing a .patch needs no Dockerfile change (glob-based). See patches/README.md for per-patch intent.
vnctalk/ VNCtalk-specific Prosody modules (mod_vnc_*, mod_http_rest, mod_alias, mod_webpresence, …), copied wholesale to /usr/local/lib/prosody/modules/.
config/ Runtime config template (prosody.cfg.lua.template), startup.sh (renders config via envsubst, writes certs, launches Prosody), healthcheck.sh, and startup-sidecar.sh (static-file/redirect sidecar).
helm/prosody/ Helm chart for Kubernetes deployment (Chart.yaml, values.yaml, templates/).
argo/prosody.yaml ArgoCD Application manifest — the canonical deploy config (image tag, ingress, env vars).
db-customization/ PostgreSQL schema/migration SQL for the Prosody 13 database (applied out-of-band, not by the container).
tests/ pytest + slixmpp integration suite (~86 tests) with aiohttp mocks and a compose test harness.

Deployment

The only intended deployment method is the Helm chart in helm/prosody/, synced to the cluster by ArgoCD via argo/prosody.yaml.

argo/prosody.yaml  →  helm/prosody/  →  Docker image (release-13.0.6-vnc)
  • ArgoCD (argo/prosody.yaml) is the source of truth for the live image tag, ingress annotations, TLS, and environment variables. It references the Helm chart and overrides values as needed.
  • Helm chart (helm/prosody/) defines the Deployment, Service, Ingress, HPA, PDB, and ServiceAccount templates.
  • Docker image is built by GitLab CI from the Dockerfile, pushed to eu.gcr.io, and referenced by tag in argo/prosody.yaml.

No other deployment method is supported. The test.sh / docker-compose.yml files are for local testing only.

Build & test

# Build the image
docker build -t vnctalk-prosody .

# Run the compose test harness (postgres + mocks + prosody)
make up
source tests/venv/bin/activate
pip install -r tests/requirements.txt
pytest tests/ -v -c tests/pytest.ini
make down

For full details see AGENTS.md and tests/README.md.

S
Description
VNCtalk Prosody (XMPP server) config
Readme
694 KiB
Languages
Python 43.5%
Lua 41.5%
Shell 6.5%
PLpgSQL 4.8%
PHP 1.3%
Other 2.4%