Files
netbox-stack/patroni-entrypoint.sh
sven e7b53b6965 modified: .env
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
2026-08-03 15:04:38 +02:00

23 lines
798 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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 "$@"