InnoLink commited on
Commit
7a22e65
·
verified ·
1 Parent(s): 79f511f

Update docker-entrypoint-wrapper.sh

Browse files

Commented out the postgresql
It probably won’t work until it has an endpoint anyway

Files changed (1) hide show
  1. docker-entrypoint-wrapper.sh +66 -66
docker-entrypoint-wrapper.sh CHANGED
@@ -1,81 +1,81 @@
1
  #!/bin/sh
2
 
3
- # Create necessary directories in the persistent /data volume
4
- echo "Creating necessary directories in the persistent /data volume..."
5
- mkdir -p /data/postgresql/data /data/postgresql/run
6
- chmod 0700 /data/postgresql/data
7
- chmod 0755 /data/postgresql/run
8
 
9
- # Initialize PostgreSQL if not already initialized
10
- echo "Initializing PostgreSQL if not already initialized..."
11
- if [ ! -f "/data/postgresql/data/PG_VERSION" ]; then
12
- # Initialize database
13
- echo "Initializing database..."
14
- initdb -D /data/postgresql/data
15
 
16
- # Modify pg_hba.conf to allow local connections
17
- echo "local all all trust" > /data/postgresql/data/pg_hba.conf
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
25
- echo "Starting PostgreSQL..."
26
- pg_ctl -D /data/postgresql/data -o "-c listen_addresses='*' -c unix_socket_directories='/data/postgresql/run'" start
27
 
28
- # Wait for PostgreSQL to be ready
29
- echo "Waiting for PostgreSQL to be ready..."
30
- until pg_isready -h localhost; do
31
- echo "Waiting for PostgreSQL to be ready..."
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
- createdb -h /data/postgresql/run node || true
39
 
40
- # Set NEXTAUTH_URL based on SPACE_HOST if available
41
- if [ -n "$SPACE_ID" ]; then
42
- echo "Setting NEXTAUTH_URL to https://huggingface.co/spaces/${SPACE_ID}"
43
- # export NEXTAUTH_URL="https://huggingface.co/spaces/${SPACE_ID}"
44
- export NEXTAUTH_URL="https://${SPACE_HOST}"
45
- else
46
- echo "WARNING: SPACE_ID not found"
47
- fi
48
 
49
- # Update DATABASE_URL to use TCP connection
50
- export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/node"
51
 
52
- # Export these environment variables to influence Next.js binding
53
- export HOSTNAME="0.0.0.0"
54
- export HOST="0.0.0.0"
55
- export PORT=3000
56
 
57
- # Disable CSP headers to allow for embedded use within HF
58
- export LANGFUSE_CSP_DISABLE="true"
59
 
60
- # Preset oauth env vars based on injected space variables
61
- # See https://huggingface.co/docs/hub/en/spaces-oauth#create-an-oauth-app
62
- export AUTH_CUSTOM_CLIENT_ID=$OAUTH_CLIENT_ID
63
- export AUTH_CUSTOM_CLIENT_SECRET=$OAUTH_CLIENT_SECRET
64
- export AUTH_CUSTOM_ISSUER=$OPENID_PROVIDER_URL
65
- export AUTH_CUSTOM_SCOPE=$OAUTH_SCOPES
66
- export AUTH_CUSTOM_NAME="Hugging Face"
67
 
68
- # Disable authentication via username/password to enforce authentication via HF
69
- export AUTH_DISABLE_USERNAME_PASSWORD="true"
70
 
71
- # Pass through AUTH_DISABLE_SIGNUP value if set, default to false if not set
72
- if [ -n "$AUTH_DISABLE_SIGNUP" ]; then
73
- export AUTH_DISABLE_SIGNUP="$AUTH_DISABLE_SIGNUP"
74
- else
75
- export AUTH_DISABLE_SIGNUP="false"
76
- fi
77
 
78
- # Start Next.js in the background
79
- echo "Starting Next.js..."
80
- ./web/entrypoint.sh node ./web/server.js \
81
- --keepAliveTimeout 110000
 
1
  #!/bin/sh
2
 
3
+ ### Create necessary directories in the persistent /data volume
4
+ #echo "Creating necessary directories in the persistent /data volume..."
5
+ #mkdir -p /data/postgresql/data /data/postgresql/run
6
+ #chmod 0700 /data/postgresql/data
7
+ #chmod 0755 /data/postgresql/run
8
 
9
+ ### Initialize PostgreSQL if not already initialized
10
+ #echo "Initializing PostgreSQL if not already initialized..."
11
+ #if [ ! -f "/data/postgresql/data/PG_VERSION" ]; then
12
+ ### Initialize database
13
+ #echo "Initializing database..."
14
+ #initdb -D /data/postgresql/data
15
 
16
+ ### Modify pg_hba.conf to allow local connections
17
+ #echo "local all all trust" > /data/postgresql/data/pg_hba.conf
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
25
+ #echo "Starting PostgreSQL..."
26
+ #pg_ctl -D /data/postgresql/data -o "-c listen_addresses='*' -c unix_socket_directories='/data/postgresql/run'" start
27
 
28
+ ### Wait for PostgreSQL to be ready
29
+ #echo "Waiting for PostgreSQL to be ready..."
30
+ #until pg_isready -h localhost; do
31
+ #echo "Waiting for PostgreSQL to be ready..."
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
+ #createdb -h /data/postgresql/run node || true
39
 
40
+ ### Set NEXTAUTH_URL based on SPACE_HOST if available
41
+ #if [ -n "$SPACE_ID" ]; then
42
+ #echo "Setting NEXTAUTH_URL to https://huggingface.co/spaces/${SPACE_ID}"
43
+ ### export NEXTAUTH_URL="https://huggingface.co/spaces/${SPACE_ID}"
44
+ #export NEXTAUTH_URL="https://${SPACE_HOST}"
45
+ #else
46
+ #echo "WARNING: SPACE_ID not found"
47
+ #fi
48
 
49
+ ### Update DATABASE_URL to use TCP connection
50
+ #export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/node"
51
 
52
+ ### Export these environment variables to influence Next.js binding
53
+ #export HOSTNAME="0.0.0.0"
54
+ #export HOST="0.0.0.0"
55
+ #export PORT=3000
56
 
57
+ ### Disable CSP headers to allow for embedded use within HF
58
+ #export LANGFUSE_CSP_DISABLE="true"
59
 
60
+ ### Preset oauth env vars based on injected space variables
61
+ ### See https://huggingface.co/docs/hub/en/spaces-oauth#create-an-oauth-app
62
+ #export AUTH_CUSTOM_CLIENT_ID=$OAUTH_CLIENT_ID
63
+ #export AUTH_CUSTOM_CLIENT_SECRET=$OAUTH_CLIENT_SECRET
64
+ #export AUTH_CUSTOM_ISSUER=$OPENID_PROVIDER_URL
65
+ #export AUTH_CUSTOM_SCOPE=$OAUTH_SCOPES
66
+ #export AUTH_CUSTOM_NAME="Hugging Face"
67
 
68
+ ### Disable authentication via username/password to enforce authentication via HF
69
+ #export AUTH_DISABLE_USERNAME_PASSWORD="true"
70
 
71
+ ### Pass through AUTH_DISABLE_SIGNUP value if set, default to false if not set
72
+ #if [ -n "$AUTH_DISABLE_SIGNUP" ]; then
73
+ #export AUTH_DISABLE_SIGNUP="$AUTH_DISABLE_SIGNUP"
74
+ #else
75
+ #export AUTH_DISABLE_SIGNUP="false"
76
+ #fi
77
 
78
+ ### Start Next.js in the background
79
+ #echo "Starting Next.js..."
80
+ #./web/entrypoint.sh node ./web/server.js \
81
+ #--keepAliveTimeout 110000