Fix container memory issues and server startup
- Added ulimits for memlock (required for Source engine) - Increased memory limits to 8GB - Added stdin_open and tty for proper console - Added -disableluarefresh flag - Use exec for proper signal handling
This commit is contained in:
@@ -5,6 +5,8 @@ services:
|
|||||||
dockerfile: docker/Dockerfile
|
dockerfile: docker/Dockerfile
|
||||||
container_name: gmod-prophunt
|
container_name: gmod-prophunt
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
- SRCDS_TOKEN=${SRCDS_TOKEN:-}
|
- SRCDS_TOKEN=${SRCDS_TOKEN:-}
|
||||||
@@ -32,15 +34,21 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- gmod-network
|
- gmod-network
|
||||||
|
|
||||||
|
# Required for Source engine servers
|
||||||
|
ulimits:
|
||||||
|
memlock:
|
||||||
|
soft: -1
|
||||||
|
hard: -1
|
||||||
|
|
||||||
# Resource limits (optional, adjust as needed)
|
# Resource limits (optional, adjust as needed)
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: '4'
|
cpus: '4'
|
||||||
memory: 4G
|
memory: 8G
|
||||||
reservations:
|
reservations:
|
||||||
cpus: '1'
|
cpus: '1'
|
||||||
memory: 1G
|
memory: 2G
|
||||||
|
|
||||||
# Logging configuration
|
# Logging configuration
|
||||||
logging:
|
logging:
|
||||||
|
|||||||
@@ -179,9 +179,9 @@ cleanup() {
|
|||||||
}
|
}
|
||||||
trap cleanup SIGTERM SIGINT
|
trap cleanup SIGTERM SIGINT
|
||||||
|
|
||||||
# Start the server
|
# Add -disableluarefresh to prevent lua refresh issues
|
||||||
./srcds_run $ARGS &
|
# Add -norestart to prevent auto-restart loop issues in Docker
|
||||||
SERVER_PID=$!
|
ARGS="$ARGS -disableluarefresh"
|
||||||
|
|
||||||
# Wait for the server process
|
# Start the server (using exec to replace shell process)
|
||||||
wait $SERVER_PID
|
exec ./srcds_run $ARGS
|
||||||
|
|||||||
Reference in New Issue
Block a user