modified: README.md modified: compose.yml modified: configuration.py new file: haproxy.cfg new file: init-patroni-users.sql renamed: entrypoint.sh -> netbox-entrypoint.sh renamed: Containerfile -> netbox.Containerfile modified: nginx.conf new file: patroni-entrypoint.sh new file: patroni.Containerfile new file: patroni.yml
23 lines
798 B
Bash
23 lines
798 B
Bash
#!/bin/bash
|
||
# ============================================================
|
||
# /patroni-entrypoint.sh – Patroni container entrypoint
|
||
# Ensures permissions then starts Patroni as the postgres user
|
||
# ============================================================
|
||
set -euo pipefail
|
||
|
||
DATA_DIR="${PATRONI_POSTGRESQL_DATA_DIR:-/var/lib/postgresql/data}"
|
||
|
||
# Ensure data and socket directories exist with correct ownership
|
||
mkdir -p "$DATA_DIR" /var/run/postgresql
|
||
chown -R postgres:postgres "$DATA_DIR" /var/run/postgresql
|
||
# PostgreSQL requires data dir mode 0700 or 0750
|
||
chmod 700 "$DATA_DIR"
|
||
|
||
# Ensure pgpass file is writable by postgres
|
||
touch /tmp/pgpass
|
||
chown postgres:postgres /tmp/pgpass
|
||
chmod 600 /tmp/pgpass
|
||
|
||
# Start Patroni (manages PostgreSQL lifecycle) as postgres user
|
||
exec su-exec postgres "$@"
|