andrewrreed HF staff commited on
Commit
45041ff
·
1 Parent(s): cebb886

add missing role and db creation

Browse files
Files changed (1) hide show
  1. docker-entrypoint-wrapper.sh +9 -0
docker-entrypoint-wrapper.sh CHANGED
@@ -18,6 +18,7 @@ if [ ! -f "/data/postgresql/data/PG_VERSION" ]; then
18
  echo "host all all 127.0.0.1/32 trust" >> /data/postgresql/data/pg_hba.conf
19
  echo "host all all ::1/128 trust" >> /data/postgresql/data/pg_hba.conf
20
  echo "host all all 0.0.0.0/0 trust" >> /data/postgresql/data/pg_hba.conf
 
21
  fi
22
 
23
  # Start PostgreSQL with the persistent directories
@@ -31,6 +32,13 @@ until pg_isready -h localhost; do
31
  sleep 1
32
  done
33
 
 
 
 
 
 
 
 
34
  # Set NEXTAUTH_URL based on SPACE_HOST if available
35
  if [ -n "$SPACE_ID" ]; then
36
  echo "Setting NEXTAUTH_URL to https://huggingface.co/spaces/${SPACE_ID}"
@@ -48,5 +56,6 @@ export HOST="0.0.0.0"
48
  export PORT=3000
49
 
50
  # Start Next.js in the background
 
51
  ./web/entrypoint.sh node ./web/server.js \
52
  --keepAliveTimeout 110000
 
18
  echo "host all all 127.0.0.1/32 trust" >> /data/postgresql/data/pg_hba.conf
19
  echo "host all all ::1/128 trust" >> /data/postgresql/data/pg_hba.conf
20
  echo "host all all 0.0.0.0/0 trust" >> /data/postgresql/data/pg_hba.conf
21
+ echo "host all all ::/0 trust" >> /data/postgresql/data/pg_hba.conf
22
  fi
23
 
24
  # Start PostgreSQL with the persistent directories
 
32
  sleep 1
33
  done
34
 
35
+ # Create database and roles
36
+ echo "Creating database and roles..."
37
+ createuser -h /data/postgresql/run -s postgres || true
38
+ createuser -h /data/postgresql/run -s node || true
39
+ createdb -h /data/postgresql/run postgres || true
40
+ createdb -h /data/postgresql/run node || true
41
+
42
  # Set NEXTAUTH_URL based on SPACE_HOST if available
43
  if [ -n "$SPACE_ID" ]; then
44
  echo "Setting NEXTAUTH_URL to https://huggingface.co/spaces/${SPACE_ID}"
 
56
  export PORT=3000
57
 
58
  # Start Next.js in the background
59
+ echo "Starting Next.js..."
60
  ./web/entrypoint.sh node ./web/server.js \
61
  --keepAliveTimeout 110000