When the Postgres container initialises itself it does so without binding any TCP ports, only allowing
connections on the Unix socket. Only after it restarts after running the entrypoint scripts/SQL does it
bind TCP ports. Make the liveness/readiness/startup probes only use the TCP port so that we don't mark
Postgres as being ready and available too early.
```
...
2025-11-25 16:56:15.588 UTC [32] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-11-25 16:56:15.597 UTC [35] LOG: database system was shut down at 2025-11-25 16:56:15 UTC
2025-11-25 16:56:15.606 UTC [32] LOG: database system is ready to accept connections
done
server started
/usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/init-ess-dbs.sh
Password:
Password:
CREATE ROLE
Password:
Password:
Password:
CREATE ROLE
Password:
2025-11-25 16:56:15.934 UTC [32] LOG: received fast shutdown request
waiting for server to shut down....2025-11-25 16:56:15.938 UTC [32] LOG: aborting any active transactions
2025-11-25 16:56:15.946 UTC [32] LOG: background worker "logical replication launcher" (PID 38) exited with exit code 1
2025-11-25 16:56:15.954 UTC [33] LOG: shutting down
2025-11-25 16:56:15.958 UTC [33] LOG: checkpoint starting: shutdown immediate
2025-11-25 16:56:16.042 UTC [33] LOG: checkpoint complete: wrote 1853 buffers (1.4%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.071 s, sync=0.008 s, total=0.088 s; sync files=604, longest=0.003 s, average=0.001 s; distance=8515 kB, estimate=8515 kB; lsn=0/1D3DDC0, redo lsn=0/1D3DDC0
2025-11-25 16:56:16.070 UTC [32] LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
2025-11-25 16:56:16.189 UTC [1] LOG: starting PostgreSQL 17.7 on x86_64-pc-linux-musl, compiled by gcc (Alpine 14.2.0) 14.2.0, 64-bit
2025-11-25 16:56:16.189 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2025-11-25 16:56:16.189 UTC [1] LOG: listening on IPv6 address "::", port 5432
2025-11-25 16:56:16.194 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-11-25 16:56:16.202 UTC [87] LOG: database system was shut down at 2025-11-25 16:56:16 UTC
2025-11-25 16:56:16.257 UTC [1] LOG: database system is ready to accept connections
/usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/init-ess-dbs.sh
Password:
Password:
CREATE ROLE
Password:
Password:
Password:
CREATE ROLE
Password:
2025-11-25 16:56:15.934 UTC [32] LOG: received fast shutdown request
...
2025-11-25 16:56:30.082 UTC [129] ERROR: deadlock detected
2025-11-25 16:56:30.082 UTC [129] DETAIL: Process 129 waits for ShareLock on virtual transaction 22/5; blocked by process 130.
Process 130 waits for ExclusiveLock on advisory lock [16385,438033630,3765090638,1]; blocked by process 129.
Process 129: -- no-transaction
-- Copyright 2025 New Vector Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only
-- Please see LICENSE in the repository root for full details.
CREATE INDEX CONCURRENTLY
compat_access_tokens_session_fk
ON compat_access_tokens (compat_session_id);
Process 130: SELECT pg_advisory_lock($1)
...
```