prole/scripts/docker-run-prole-db.sh
chrisfu f2c9012cce Refactor installation and initialization logic, and expand test coverage
- install.py: Major update including configuration variable expansion, improved k3s/k3d handling, and enhanced installation logic.

- etc/ scripts: Significant refactoring of initialization scripts (Kerberos, Port Forwards, Garage Store, etc.).

- Port Forwards: Transitioned from XML to port-mappings.conf for managing kubectl port-forwards.

- Status Reporting: Improved status checking for common services.

- Infrastructure: Updated Ansible inventory and rsyslog role configurations.

- Tests: Added a comprehensive suite of tests for 'etc' initialization scripts in prole/tests/etc/.

- Documentation: Added prole-db-documentation-mcp-architecture.md.

- General: Updated Dockerfiles and various helper scripts.
2026-02-13 21:36:39 -08:00

24 lines
948 B
Bash
Executable File

set -eux
# export POSTGRES_PASSWORD=$(openssl rand -base64 32)
if [[ -z "${POSTGRES_PASSWORD:-}" ]]; then
echo "ERROR: POSTGRES_PASSWORD is required. Store it in OpenBao (kv/prole/<namespace>/db#password) or export it." >&2
exit 1
fi
PROLE_HOME="${PROLE_HOME:-$HOME/dev/prole}"
PROLE_DATA="${PROLE_DATA:-$PROLE_HOME/data}"
PROLE_DATA="${PROLE_DATA%/}"
PG_VERSION=$(cat "$PROLE_HOME/conf/postgresql/.version" 2>/dev/null | tr -d '[:space:]')
RELEASE=$(cat "$PROLE_HOME/prole-db/.version" 2>/dev/null | tr -d '[:space:]')
if [[ "$RELEASE" =~ ^[0-9]+$ ]]; then RELEASE=$(printf "%03d" "$RELEASE"); fi
IMAGE="prole-db:${PG_VERSION:-17.7}-${RELEASE:-043}"
docker run --rm -it --hostname=prole-db-00n \
-e POSTGRES_PASSWORD="$POSTGRES_PASSWORD" \
--env=PATH=/usr/lib/postgresql/17/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
--volume="${PROLE_DATA}:/data" \
--network=bridge \
--entrypoint bash \
--restart=no \
$IMAGE