fix: move health server from port 8080 to 8081 (#130) #131

Open
Claude wants to merge 1 commits from issue/130-move-bot-health-server-off-port-8080-to-avoid-admi into main
4 changed files with 8 additions and 8 deletions

View File

@ -31,7 +31,7 @@ pip install -r requirements.txt # Install dependencies
- **Path**: `/home/cal/container-data/paper-dynasty`
- **Container**: `paper-dynasty_discord-app_1`
- **Image**: `manticorum67/paper-dynasty-discordapp`
- **Health**: `GET http://localhost:8080/health` (HTTP server in `health_server.py`)
- **Health**: `GET http://localhost:8081/health` (HTTP server in `health_server.py`)
- **Versioning**: CalVer (`YYYY.M.BUILD`) — manually tagged when ready to release
### Logs
@ -46,7 +46,7 @@ pip install -r requirements.txt # Install dependencies
- Bot not responding → check `docker logs`, verify `BOT_TOKEN` and `GUILD_ID`
- API errors → verify `DATABASE` is set to `Prod` or `Dev`, check `API_TOKEN` matches the database API
- Game engine errors → check `/usr/src/app/logs/discord.log` for detailed tracebacks
- Health endpoint not responding → `health_server.py` runs on port 8080 inside the container
- Health endpoint not responding → `health_server.py` runs on port 8081 inside the container
### CI/CD
Ruff lint on PRs. Docker image built on CalVer tag push only.

View File

@ -17,14 +17,14 @@ logger = logging.getLogger("discord_app.health")
class HealthServer:
"""HTTP server for health checks and metrics."""
def __init__(self, bot: commands.Bot, host: str = "0.0.0.0", port: int = 8080):
def __init__(self, bot: commands.Bot, host: str = "0.0.0.0", port: int = 8081):
"""
Initialize health server.
Args:
bot: Discord bot instance to monitor
host: Host to bind to (default: 0.0.0.0 for container access)
port: Port to listen on (default: 8080)
port: Port to listen on (default: 8081)
"""
self.bot = bot
self.host = host
@ -148,7 +148,7 @@ class HealthServer:
logger.info("Health check server stopped")
async def run_health_server(bot: commands.Bot, host: str = "0.0.0.0", port: int = 8080):
async def run_health_server(bot: commands.Bot, host: str = "0.0.0.0", port: int = 8081):
"""
Run health server as a background task.

View File

@ -32,7 +32,7 @@ the expected bot response, and pass/fail criteria.
Before running these tests, ensure the following state exists:
### Bot State
- [ ] Bot is online and healthy: `GET http://sba-bots:8080/health` returns 200
- [ ] Bot is online and healthy: `GET http://sba-bots:8081/health` returns 200
- [ ] Refractor cog is loaded: check bot logs for `Loaded extension 'cogs.refractor'`
- [ ] Test user has the `PD Players` role on the dev server
@ -72,7 +72,7 @@ API layer is functional. Execute via shell or Playwright network interception.
### REF-API-01: Bot health endpoint
| Field | Value |
|---|---|
| **Command** | `curl -sf http://sba-bots:8080/health` |
| **Command** | `curl -sf http://sba-bots:8081/health` |
| **Expected** | HTTP 200, body contains health status |
| **Pass criteria** | Non-empty 200 response |

View File

@ -14,7 +14,7 @@ STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://pddev.manticorum.com/ap
echo ""
echo "=== Discord Bot ==="
# Health check
curl -sf http://sba-bots:8080/health >/dev/null 2>&1 && echo "PASS: bot health OK" || echo "FAIL: bot health endpoint"
curl -sf http://sba-bots:8081/health >/dev/null 2>&1 && echo "PASS: bot health OK" || echo "FAIL: bot health endpoint"
# Recent refractor activity in logs
echo ""