aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2019-09-14 15:59:40 -0400
committerMitch Riedstra <mitch@riedstra.us>2019-09-14 15:59:40 -0400
commit6a0aa89e3dfd7bd0755b67931532eaa173f73919 (patch)
treec3dc047ef06d878b1d9f7998369191bfd39b0549 /templates
downloadalpine-postgres-6a0aa89e3dfd7bd0755b67931532eaa173f73919.tar.gz
alpine-postgres-6a0aa89e3dfd7bd0755b67931532eaa173f73919.tar.xz
Initial
Diffstat (limited to 'templates')
-rw-r--r--templates/run.j215
1 files changed, 15 insertions, 0 deletions
diff --git a/templates/run.j2 b/templates/run.j2
new file mode 100644
index 0000000..9242dd2
--- /dev/null
+++ b/templates/run.j2
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e
+pguser="postgres"
+PGDATA="/var/postgres"
+
+if ! [ -d "$PGDATA" ] ; then
+ mkdir -p "$PGDATA"
+ chown -R "$pguser" "$PGDATA"
+ chmod 700 "$PGDATA"
+ su - postgres -m -c "pg_ctl initdb -D \"$PGDATA\""
+fi
+
+mkdir -p /run/postgresql && chown "$pguser" /run/postgresql
+exec chpst -u postgres:postgres postgres -D "$PGDATA" 2>&1
+