| | #!/bin/sh |
| |
|
| | |
| | echo "Creating necessary directories in the persistent /data volume..." |
| | mkdir -p /data/postgresql/data /data/postgresql/run |
| | chmod 0700 /data/postgresql/data |
| | chmod 0755 /data/postgresql/run |
| |
|
| | |
| | echo "Initializing PostgreSQL if not already initialized..." |
| | if [ ! -f "/data/postgresql/data/PG_VERSION" ]; then |
| | |
| | echo "Initializing database..." |
| | initdb -D /data/postgresql/data |
| | |
| | |
| | echo "local all all trust" > /data/postgresql/data/pg_hba.conf |
| | echo "host all all 127.0.0.1/32 trust" >> /data/postgresql/data/pg_hba.conf |
| | echo "host all all ::1/128 trust" >> /data/postgresql/data/pg_hba.conf |
| | echo "host all all 0.0.0.0/0 trust" >> /data/postgresql/data/pg_hba.conf |
| | echo "host all all ::/0 trust" >> /data/postgresql/data/pg_hba.conf |
| | fi |
| |
|
| | |
| | echo "Starting PostgreSQL..." |
| | pg_ctl -D /data/postgresql/data -o "-c listen_addresses='*' -c unix_socket_directories='/data/postgresql/run'" start |
| |
|
| | |
| | echo "Waiting for PostgreSQL to be ready..." |
| | until pg_isready -h localhost; do |
| | echo "Waiting for PostgreSQL to be ready..." |
| | sleep 1 |
| | done |
| |
|
| | |
| | echo "Creating database and roles..." |
| | createuser -h /data/postgresql/run -s postgres || true |
| | createdb -h /data/postgresql/run node || true |
| |
|
| | |
| | if [ -n "$SPACE_ID" ]; then |
| | echo "Setting NEXTAUTH_URL to https://huggingface.co/spaces/${SPACE_ID}" |
| | |
| | export NEXTAUTH_URL="https://${SPACE_HOST}" |
| | else |
| | echo "WARNING: SPACE_ID not found" |
| | fi |
| |
|
| | |
| | export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/node" |
| |
|
| | |
| | export HOSTNAME="0.0.0.0" |
| | export HOST="0.0.0.0" |
| | export PORT=3000 |
| |
|
| | |
| | export LANGFUSE_CSP_DISABLE="true" |
| |
|
| | |
| | |
| | export AUTH_CUSTOM_CLIENT_ID=$OAUTH_CLIENT_ID |
| | export AUTH_CUSTOM_CLIENT_SECRET=$OAUTH_CLIENT_SECRET |
| | export AUTH_CUSTOM_ISSUER=$OPENID_PROVIDER_URL |
| | export AUTH_CUSTOM_SCOPE=$OAUTH_SCOPES |
| | export AUTH_CUSTOM_NAME="Hugging Face" |
| |
|
| | |
| | export AUTH_DISABLE_USERNAME_PASSWORD="true" |
| |
|
| | |
| | if [ -n "$AUTH_DISABLE_SIGNUP" ]; then |
| | export AUTH_DISABLE_SIGNUP="$AUTH_DISABLE_SIGNUP" |
| | else |
| | export AUTH_DISABLE_SIGNUP="false" |
| | fi |
| |
|
| | |
| | echo "Starting Next.js..." |
| | ./web/entrypoint.sh node ./web/server.js \ |
| | --keepAliveTimeout 110000 |