v0.1.11 - Last push before changing logging system
This commit is contained in:
@@ -246,24 +246,37 @@ else
|
||||
echo -e "${YELLOW}Starting FastCGI in production mode - will generate new keys and create database${NC}"
|
||||
fi
|
||||
|
||||
# Start FastCGI application with proper logging (daemonized but with redirected streams)
|
||||
# Start FastCGI application with proper logging
|
||||
echo "FastCGI starting at $(date)" >> logs/app/stderr.log
|
||||
spawn-fcgi -s "$SOCKET_PATH" -M 666 -u "$USER" -g "$USER" -P "$PID_FILE" -- "$FCGI_BINARY" $FCGI_ARGS 1>>logs/app/stdout.log 2>>logs/app/stderr.log
|
||||
|
||||
if [ $? -eq 0 ] && [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat "$PID_FILE")
|
||||
# Use nohup with spawn-fcgi -n to keep process running with redirected output
|
||||
# The key is: nohup prevents HUP signal, -n prevents daemonization (keeps stderr connected)
|
||||
nohup spawn-fcgi -n -s "$SOCKET_PATH" -M 666 -u "$USER" -g "$USER" -- "$FCGI_BINARY" $FCGI_ARGS >>logs/app/stdout.log 2>>logs/app/stderr.log </dev/null &
|
||||
SPAWN_PID=$!
|
||||
|
||||
# Wait for spawn-fcgi to spawn the child
|
||||
sleep 1
|
||||
|
||||
# Get the actual FastCGI process PID (child of spawn-fcgi)
|
||||
FCGI_PID=$(pgrep -f "ginxsom-fcgi.*--storage-dir" | head -1)
|
||||
if [ -z "$FCGI_PID" ]; then
|
||||
echo -e "${RED}Warning: Could not find FastCGI process${NC}"
|
||||
FCGI_PID=$SPAWN_PID
|
||||
fi
|
||||
|
||||
# Save PID
|
||||
echo $FCGI_PID > "$PID_FILE"
|
||||
|
||||
# Give it a moment to start
|
||||
sleep 1
|
||||
|
||||
if check_process "$FCGI_PID"; then
|
||||
echo -e "${GREEN}FastCGI application started successfully${NC}"
|
||||
echo "PID: $PID"
|
||||
|
||||
# Verify it's actually running
|
||||
if check_process "$PID"; then
|
||||
echo -e "${GREEN}Process confirmed running${NC}"
|
||||
else
|
||||
echo -e "${RED}Warning: Process may have crashed immediately${NC}"
|
||||
exit 1
|
||||
fi
|
||||
echo "PID: $FCGI_PID"
|
||||
echo -e "${GREEN}Process confirmed running${NC}"
|
||||
else
|
||||
echo -e "${RED}Failed to start FastCGI application${NC}"
|
||||
echo -e "${RED}Process may have crashed immediately${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -334,4 +347,8 @@ echo -e "${YELLOW}To stop all processes, run: nginx -p . -c $NGINX_CONFIG -s sto
|
||||
echo -e "${YELLOW}To monitor logs, check: logs/nginx/error.log, logs/nginx/access.log, logs/app/stderr.log, logs/app/stdout.log${NC}"
|
||||
echo -e "\n${YELLOW}Server is available at:${NC}"
|
||||
echo -e " ${GREEN}HTTP:${NC} http://localhost:9001"
|
||||
echo -e " ${GREEN}HTTPS:${NC} https://localhost:9443"
|
||||
echo -e " ${GREEN}HTTPS:${NC} https://localhost:9443"
|
||||
echo -e "\n${YELLOW}Admin WebSocket endpoint:${NC}"
|
||||
echo -e " ${GREEN}WSS:${NC} wss://localhost:9443/admin (via nginx proxy)"
|
||||
echo -e " ${GREEN}WS:${NC} ws://localhost:9001/admin (via nginx proxy)"
|
||||
echo -e " ${GREEN}Direct:${NC} ws://localhost:9442 (direct connection)"
|
||||
Reference in New Issue
Block a user