Enabling Auto-Stop
Enable auto-stop with theENABLE_AUTOSTOP environment variable:
The container’s restart policy must be set to
"no" to prevent automatic restarts. You’ll need to manually restart the container after it stops.How Auto-Stop Works
Timeout reached
If no players reconnect within the configured timeout period, the server stops gracefully.
Configuration Variables
| Variable | Default | Description |
|---|---|---|
AUTOSTOP_TIMEOUT_EST | 3600 | Seconds between last client disconnect and server stop |
AUTOSTOP_TIMEOUT_INIT | 1800 | Seconds between server start and stop (if no connections) |
AUTOSTOP_PERIOD | 10 | Seconds between state machine checks |
AUTOPAUSE_STATUS_RETRY_LIMIT | 10 | Number of status check retries |
AUTOPAUSE_STATUS_RETRY_INTERVAL | 2s | Time between status check retries |
Example Configuration
Restart Policy Configuration
The container must be configured not to restart automatically:Manual Restart
After the server auto-stops, restart it manually:Skip Auto-Stop File
Create a.skip-stop file in the /data directory to temporarily prevent auto-stopping:
The auto-stop timer resets while the
.skip-stop file is present.Proxy Protocol Support
If you use PROXY Protocol (e.g., through HAProxy or Fly.io), enable it in your server configuration and set:Proxy Configuration Examples
HAProxy:Use Cases
AWS Fargate
Reduce costs by stopping when idle:Development Servers
Auto-stop development servers when not in use:Scheduled Servers
Combine with cron or schedulers for specific play times:Troubleshooting
Enable Debug Logging
Add debug output to see auto-stop behavior:Common Issues
Container keeps restarting after auto-stop:- Verify restart policy is set to
"no" - Check orchestration system restart settings
- Enable debug logging to see state transitions
- Verify timeout values are appropriate for your use case
- Check that players are actually disconnecting
- Increase
AUTOSTOP_TIMEOUT_INIT - Check logs for connection issues
- Ensure
USES_PROXY_PROTOCOL=trueis set - Verify proxy is configured to send PROXY protocol headers
- Check proxy and server logs for protocol errors
Monitoring Auto-Stop
Monitor auto-stop events in the logs:Example Compose File
A complete example is available in the GitHub repository.Comparison with Auto-Pause
| Feature | Auto-Stop | Auto-Pause |
|---|---|---|
| Container state | Stops container | Pauses Java process |
| Restart required | Manual | Automatic |
| Resource usage | Zero (stopped) | Minimal (paused) |
| Player experience | Must wait for manual restart | Transparent resume |
| Use case | Cost optimization | Resource optimization |
| Compatibility | Incompatible with auto-pause | Incompatible with auto-stop |