@@ -6,11 +6,11 @@ echo "ProStaff API - Docker Entrypoint" >&2
66echo " ========================================" >&2
77
88# Remove any pre-existing server PID file
9- echo " [1/4 ] Removing stale PID files..." >&2
9+ echo " [1/5 ] Removing stale PID files..." >&2
1010rm -f /app/tmp/pids/server.pid
1111
1212# Wait for database to be ready
13- echo " [2/4 ] Checking database connection..." >&2
13+ echo " [2/5 ] Checking database connection..." >&2
1414DB_URL=" ${SUPABASE_DB_URL:- $DATABASE_URL } "
1515if [ -n " $DB_URL " ]; then
1616 # Extract host and port from URL (format: postgresql://user:pass@host:port/db)
3636 echo " ⚠ No DATABASE_URL configured, skipping database check" >&2
3737fi
3838
39+ # Check Redis connection (non-blocking)
40+ echo " [3/5] Checking Redis connection..." >&2
41+ if [ -n " $REDIS_URL " ]; then
42+ # Extract host and port from Redis URL
43+ REDIS_HOST=$( echo " $REDIS_URL " | sed -E ' s|redis://([^:@]+:)?([^@:]+)(:([0-9]+))?.*|\2|' )
44+ REDIS_PORT=$( echo " $REDIS_URL " | sed -E ' s|.*:([0-9]+)(/[0-9]+)?$|\1|' )
45+
46+ echo " → Redis: ${REDIS_HOST} :${REDIS_PORT} " >&2
47+
48+ # Try to connect to Redis (timeout after 5 seconds)
49+ if timeout 5 bash -c " echo > /dev/tcp/${REDIS_HOST} /${REDIS_PORT} " 2> /dev/null; then
50+ echo " ✓ Redis is reachable" >&2
51+ else
52+ echo " ⚠ Redis connection failed - Sidekiq will not work properly" >&2
53+ echo " → REDIS_URL: ${REDIS_URL} " >&2
54+ fi
55+ else
56+ echo " ⚠ No REDIS_URL configured, Sidekiq will run in inline mode" >&2
57+ fi
58+
3959# Run database migrations
40- echo " [3/4 ] Running database migrations..." >&2
60+ echo " [4/5 ] Running database migrations..." >&2
4161if bundle exec rails db:migrate 2>&1 | tee /tmp/migration.log >&2 ; then
4262 echo " ✓ Migrations completed" >&2
4363else
4868fi
4969
5070# Skip preload in production - Puma will handle it
51- echo " [4/4 ] Starting application server..." >&2
71+ echo " [5/5 ] Starting application server..." >&2
5272echo " → Port: ${PORT:- 3000} " >&2
5373echo " → Environment: ${RAILS_ENV:- development} " >&2
5474echo " → Workers: ${WEB_CONCURRENCY:- 2} " >&2
0 commit comments