Fix bot container inheriting site PORT/LOG_FILE from shared .env #41
Reference in New Issue
Block a user
No description provided.
Delete Branch "bugfix/bot-container-port-leak"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
appandbotservices indocker-compose.ymlshareenv_file: .env. The site'sPORT=3000therefore leaked into the bot container, and since the bot code isPORT || 4100, it bound 3000 instead of 4100.The server reaches the bot at
BOT_INTERNAL_URL(http://bot:4100), so with the bot on the wrong port the server↔bot calls failed at the connection level — surfacing as "failed to fetch" / "bot unreachable" on the admin Discord Bot page, even though the bot was otherwise healthy and fully connected to Discord (config fetched, 18 slash commands registered, client ready).Observed in the bot log:
Fix
Pin the bot service's own vars in its compose
environment:block so they override the shared.env:PORT: 4100— binds where the server expects it.LOG_FILE: bot.log— same leak class; keeps the bot's log distinct instead of inheriting the site'sapp.log.Verify after deploy
Then the admin Discord Bot page status poll reaches the bot and shows it connected. (Also ensure the root
.envhasBOT_INTERNAL_URL=http://bot:4100.)🤖 Generated with Claude Code
https://claude.ai/code/session_019rao86n5cXpwAyjdBFEshV