meltedchoco commited on
Commit
f3060d7
Β·
verified Β·
1 Parent(s): 09ba47f

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +8 -1
entrypoint.sh CHANGED
@@ -12,9 +12,16 @@ if [ ! -f "${PGDATA}/PG_VERSION" ]; then
12
  initdb --auth=trust --no-locale --encoding=UTF8 "${PGDATA}"
13
  fi
14
 
 
 
 
15
  # ── Start Postgres ───────────────────────────────────────────────────
16
  pg_ctl start -l "${PGDATA}/postgres.log" \
17
- -o "-k ${PGHOST} -p ${PG_PORT}" -w
 
 
 
 
18
 
19
  # ── Create user and database if they don't exist ─────────────────────
20
  if ! psql -h "${PGHOST}" -p "${PG_PORT}" -U sekai -d sekai -c '\q' 2>/dev/null; then
 
12
  initdb --auth=trust --no-locale --encoding=UTF8 "${PGDATA}"
13
  fi
14
 
15
+ # ── Cleanup stale pid if container restarted uncleanly ───────────────
16
+ rm -f "${PGDATA}/postmaster.pid"
17
+
18
  # ── Start Postgres ───────────────────────────────────────────────────
19
  pg_ctl start -l "${PGDATA}/postgres.log" \
20
+ -o "-k ${PGHOST} -p ${PG_PORT}" -w || {
21
+ echo "--- postgres.log ---"
22
+ cat "${PGDATA}/postgres.log"
23
+ exit 1
24
+ }
25
 
26
  # ── Create user and database if they don't exist ─────────────────────
27
  if ! psql -h "${PGHOST}" -p "${PG_PORT}" -U sekai -d sekai -c '\q' 2>/dev/null; then