Skip to content

Cap the site backend's resources and document manual record lookups - #309

Merged
Drefvelin merged 1 commit into
mainfrom
fix/backend-resource-limits
Oct 28, 2026
Merged

Drefvelin merged 1 commit into
mainfrom
fix/backend-resource-limits

Conversation

@Drefvelin

Copy link
Copy Markdown
Collaborator

Summary

  • Caps both sites' backend containers at 4 CPUs, 12 GB memory and 1024 processes. Normal production use is about 5 GB and under one core. Previews already have caps; the main sites had none.
  • Adds "Looking up records by hand" to the PostgreSQL ops doc. It says site records live only in Postgres, gives a working psql command, and warns against recursive filesystem searches.

Why

On 2026-10-26 a docker exec into tfmcweb-production-backend-1 ran glob.glob('/**/province.db', recursive=True) to look up a Discord link. Python 3.12 follows the looping symlinks under /sys, so the search never ends. It held a full core for 50 hours until it was killed. The file it was looking for doesn't exist anyway.

Test plan

  • docker compose config -q passes for both compose files
  • The doc's psql command runs against production (select count(*) from discord_links → 269)
  • After the www deploy, docker inspect shows the limits and health checks pass

🤖 Generated with Claude Code

A stray `docker exec` search for a nonexistent province.db ran in the
production backend for 50 hours at a full core. The backend had no CPU,
memory or process limits. Give both sites' backends caps well above
normal use, and say in the PostgreSQL ops doc where site records live and
how to query them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0d445ab5-2414-42ab-a7ee-85a9e6b457e9
Commits

Reviewing files that changed from the base of the PR and between e7424cd and 90b4fdc.

Files selected for processing: 3
  • docker-compose.staging.yml
  • docker-compose.yml
  • docs/docs/ops/postgresql.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Chores
    • Set resource limits for the backend in both staging and standard Docker Compose configurations: up to 4 CPUs, 12 GB of memory and 1,024 processes.
  • Documentation
    • Added guidance for querying site records with read-only SQL, including notes on stale database backups, recursive filesystem searches and selecting the correct site environment.

The Compose files now set resource limits for the backend service. The PostgreSQL operations documentation adds guidance for locating site records and querying them with read-only SQL.

Changes: Backend resource limits

Layer / File(s) Summary
Backend limits in Compose
docker-compose.yml, docker-compose.staging.yml
Both backend services set a CPU limit of 4, a memory limit of 12 GB and a process limit of 1,024. Comments describe runaway-process containment and approximate normal usage.

PostgreSQL lookup guidance

Layer / File(s) Summary
Query site records
docs/docs/ops/postgresql.md
The documentation explains that site records are stored in PostgreSQL, warns against recursive filesystem searches and provides a read-only query. It specifies using dev for the Dev site.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: ryanbarlow97

Merge Risk: Minimal · up to 90b4f

The configuration and lookup guidance are ready to merge on the available evidence. Confirm the limits on the running containers after deployment as planned.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Drefvelin
Drefvelin merged commit 89d4c82 into main Oct 28, 2026
8 checks passed
@Drefvelin
Drefvelin deleted the fix/backend-resource-limits branch October 28, 2026 09:13

This branch was successfully deployed

1 active deployment
preview — 90b4fdc8 Deployed Oct 28, 2026 by Drefvelin via deploy #853
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants