docs: remove AI-assisted setup wizard mentions
This commit is contained in:
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
# Caddy Entrypoint Script for Synapsis
|
||||
# Reads the dynamic port from the shared file and starts Caddy
|
||||
|
||||
set -e
|
||||
|
||||
SHARED_PORT_FILE="/var/run/synapsis/port"
|
||||
DEFAULT_PORT=3000
|
||||
|
||||
# Wait for the port file to exist (with timeout)
|
||||
echo "⏳ Waiting for Synapsis app to announce its port..."
|
||||
TIMEOUT=60
|
||||
ELAPSED=0
|
||||
|
||||
while [ ! -f "$SHARED_PORT_FILE" ] && [ $ELAPSED -lt $TIMEOUT ]; do
|
||||
sleep 1
|
||||
ELAPSED=$((ELAPSED + 1))
|
||||
done
|
||||
|
||||
if [ -f "$SHARED_PORT_FILE" ]; then
|
||||
APP_PORT=$(cat "$SHARED_PORT_FILE")
|
||||
echo "✅ Found Synapsis app on port: $APP_PORT"
|
||||
else
|
||||
echo "⚠️ Port file not found after ${TIMEOUT}s, using default port: $DEFAULT_PORT"
|
||||
APP_PORT=$DEFAULT_PORT
|
||||
fi
|
||||
|
||||
export APP_PORT
|
||||
|
||||
# Validate that APP_PORT is a number
|
||||
if ! echo "$APP_PORT" | grep -qE '^[0-9]+$'; then
|
||||
echo "❌ Invalid port number: $APP_PORT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🌐 Starting Caddy reverse proxy to app:$APP_PORT..."
|
||||
echo ""
|
||||
|
||||
# Start Caddy with the environment variable set
|
||||
exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
|
||||
Executable
+73
@@ -0,0 +1,73 @@
|
||||
#!/bin/sh
|
||||
# Synapsis Docker Entrypoint Script
|
||||
# Handles automatic port detection when PORT=auto
|
||||
|
||||
set -e
|
||||
|
||||
# Default port range for auto-detection
|
||||
PORT_START=${PORT_START:-3000}
|
||||
PORT_END=${PORT_END:-3020}
|
||||
|
||||
# Function to check if a port is available
|
||||
check_port_available() {
|
||||
local port=$1
|
||||
if ! nc -z localhost "$port" 2>/dev/null; then
|
||||
return 0 # Port is available
|
||||
else
|
||||
return 1 # Port is in use
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to find first available port in range
|
||||
find_available_port() {
|
||||
local start=$1
|
||||
local end=$2
|
||||
|
||||
for port in $(seq "$start" "$end"); do
|
||||
if check_port_available "$port"; then
|
||||
echo "$port"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo "ERROR: No available ports found in range $start-$end" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
# Handle PORT=auto
|
||||
if [ "${PORT}" = "auto" ]; then
|
||||
echo "🔍 PORT=auto detected, scanning for available port in range ${PORT_START}-${PORT_END}..."
|
||||
|
||||
DETECTED_PORT=$(find_available_port "$PORT_START" "$PORT_END")
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Failed to find an available port. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export PORT="$DETECTED_PORT"
|
||||
echo "✅ Using automatically detected port: $PORT"
|
||||
else
|
||||
echo "📡 Using configured port: $PORT"
|
||||
fi
|
||||
|
||||
# Ensure PORT is set
|
||||
if [ -z "$PORT" ]; then
|
||||
echo "⚠️ PORT not set, defaulting to 3000"
|
||||
export PORT=3000
|
||||
fi
|
||||
|
||||
# Write port to shared file for Caddy to read
|
||||
SHARED_PORT_FILE="/var/run/synapsis/port"
|
||||
mkdir -p "$(dirname "$SHARED_PORT_FILE")"
|
||||
echo "$PORT" > "$SHARED_PORT_FILE"
|
||||
echo "📝 Port $PORT written to $SHARED_PORT_FILE"
|
||||
|
||||
# Export HOSTNAME for Next.js
|
||||
export HOSTNAME="0.0.0.0"
|
||||
|
||||
echo "🚀 Starting Synapsis on port $PORT..."
|
||||
echo ""
|
||||
|
||||
# Start the Next.js application
|
||||
exec node server.js
|
||||
Reference in New Issue
Block a user