Skip to content

Commit dd06112

Browse files
author
Hamza Shahid
committed
fix: export SERVER_PORT and use exec for proper signal handling
1 parent f2e91d8 commit dd06112

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

Docker/scripts/railway_start.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
#!/bin/bash
2-
# Railway startup script - v2
2+
# Railway startup script - v3
33
set -e
44

55
echo "=== Evolution API Railway Startup ==="
6-
echo "PORT: ${PORT:-8080}"
7-
echo "DATABASE_PROVIDER: $DATABASE_PROVIDER"
6+
echo "Railway PORT: $PORT"
7+
8+
# Export SERVER_PORT for the app to use
9+
export SERVER_PORT="${PORT:-8080}"
10+
export DATABASE_URL="$DATABASE_CONNECTION_URI"
11+
12+
echo "Using SERVER_PORT: $SERVER_PORT"
813

914
# Create .env file with Railway environment variables
1015
cat > .env << EOF
1116
DATABASE_PROVIDER=${DATABASE_PROVIDER:-postgresql}
1217
DATABASE_CONNECTION_URI=$DATABASE_CONNECTION_URI
1318
SERVER_TYPE=http
14-
SERVER_PORT=${PORT:-8080}
19+
SERVER_PORT=$SERVER_PORT
1520
AUTHENTICATION_API_KEY=$AUTHENTICATION_API_KEY
1621
CACHE_REDIS_ENABLED=${CACHE_REDIS_ENABLED:-false}
1722
CACHE_LOCAL_ENABLED=${CACHE_LOCAL_ENABLED:-true}
1823
CORS_ORIGIN=${CORS_ORIGIN:-*}
1924
LANGUAGE=${LANGUAGE:-en}
25+
LOG_LEVEL=DEBUG
2026
EOF
2127

22-
echo "=== .env file created ==="
23-
cat .env
24-
25-
# Set DATABASE_URL for Prisma
26-
export DATABASE_URL="$DATABASE_CONNECTION_URI"
27-
2828
echo "=== Running database migrations ==="
2929
npm run db:deploy
3030

31-
echo "=== Starting Evolution API ==="
32-
npm run start:prod
31+
echo "=== Starting Evolution API on port $SERVER_PORT ==="
32+
exec npm run start:prod

0 commit comments

Comments
 (0)