CoolFace
Apppublic

x-1/MiniMaxAI-MiniMax-M2.5

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
docker-entrypoint-wrapper.sh89 linesDownload Raw Back to root
1#!/bin/sh2 3# Create necessary directories in the persistent /data volume4echo "Creating necessary directories in the persistent /data volume..."5mkdir -p /data/postgresql/data /data/postgresql/run6 7chmod 0700 /data/postgresql/data8chmod 0755 /data/postgresql/run9 10chown -R postgres:postgres /data/postgresql/11 12# Initialize PostgreSQL if not already initialized13echo "Initializing PostgreSQL if not already initialized..."14if [ ! -f "/data/postgresql/data/PG_VERSION" ]; then15    # Initialize database16    echo "Initializing database..."17    su-exec postgres initdb -D /data/postgresql/data18    19    # Modify pg_hba.conf to allow local connections20    echo "local all all trust" > /data/postgresql/data/pg_hba.conf21    echo "host all all 127.0.0.1/32 trust" >> /data/postgresql/data/pg_hba.conf22    echo "host all all ::1/128 trust" >> /data/postgresql/data/pg_hba.conf23    echo "host all all 0.0.0.0/0 trust" >> /data/postgresql/data/pg_hba.conf24    echo "host all all ::/0 trust" >> /data/postgresql/data/pg_hba.conf25fi26 27# Start PostgreSQL with the persistent directories28echo "Starting PostgreSQL..."29su-exec postgres pg_ctl -D /data/postgresql/data -o "-c listen_addresses='*' -c unix_socket_directories='/data/postgresql/run'" start30 31# Create database and roles32echo "Creating database and roles..."33createuser -h /data/postgresql/run -s postgres || true34createdb -h /data/postgresql/run node || true35 36# Wait for PostgreSQL to be ready37echo "Waiting for PostgreSQL to be ready..."38until pg_isready -h localhost; do39  echo "Waiting for PostgreSQL to be ready..."40  sleep 141done42 43 44# Set NEXTAUTH_URL based on SPACE_HOST if available45if [ -n "$SPACE_ID" ]; then46    echo "Setting NEXTAUTH_URL to https://huggingface.co/spaces/${SPACE_ID}"47    # export NEXTAUTH_URL="https://huggingface.co/spaces/${SPACE_ID}"48    export NEXTAUTH_URL="https://${SPACE_HOST}"49else50    echo "WARNING: SPACE_ID not found"51fi52 53# Update DATABASE_URL to use TCP connection54export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/node"55 56# Export these environment variables to influence Next.js binding57export HOSTNAME="0.0.0.0"58export HOST="0.0.0.0"59export PORT=300060 61# Disable CSP headers to allow for embedded use within HF62export LANGFUSE_CSP_DISABLE="true"63 64# Preset oauth env vars based on injected space variables65# See https://huggingface.co/docs/hub/en/spaces-oauth#create-an-oauth-app66export AUTH_CUSTOM_CLIENT_ID=$OAUTH_CLIENT_ID67export AUTH_CUSTOM_CLIENT_SECRET=$OAUTH_CLIENT_SECRET68export AUTH_CUSTOM_ISSUER=$OPENID_PROVIDER_URL69export AUTH_CUSTOM_SCOPE=$OAUTH_SCOPES70export AUTH_CUSTOM_NAME="Hugging Face"71 72export LANGFUSE_INIT_USER_EMAIL=$LANGFUSE_INIT_USER_EMAIL73export LANGFUSE_INIT_USER_NAME=$LANGFUSE_INIT_USER_NAME74export LANGFUSE_INIT_USER_PASSWORD=$LANGFUSE_INIT_USER_PASSWORD75 76# Disable authentication via username/password to enforce authentication via HF77export AUTH_DISABLE_USERNAME_PASSWORD=$AUTH_DISABLE_USERNAME_PASSWORD78 79# Pass through AUTH_DISABLE_SIGNUP value if set, default to false if not set80if [ -n "$AUTH_DISABLE_SIGNUP" ]; then81    export AUTH_DISABLE_SIGNUP="$AUTH_DISABLE_SIGNUP"82else83    export AUTH_DISABLE_SIGNUP="false"84fi85 86# Start Next.js in the background87echo "Starting Next.js..."88./web/entrypoint.sh node ./web/server.js \89    --keepAliveTimeout 110000