Harden the free Render runtime - #28
Draft
raghubetina wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This keeps the deliberately small Render Free runtime profile, while closing several gaps found in a current audit:
SOLID_QUEUE_IN_PUMAas enabled only for the literal value"true"(so"false"no longer starts queue actors)ApplicationJobenqueues until the surrounding transaction commits, avoiding accidental dependence on same-database transactional enqueue behavior/upliveness route and use it from both Docker and Render health checksMALLOC_ARENA_MAX, which tunes glibc malloc and is inert because this image preloads jemalloc and already configures jemalloc throughMALLOC_CONFSECRET_KEY_BASEin the Docker run exampleThis addresses the runtime portions of #26. It intentionally does not attempt that issue's broader Codespaces/tooling work.
Why
The current free-tier process topology came from production incidents and should remain intact:
WEB_CONCURRENCY=1creates Puma master + worker overhead and OOM-loops a 512 MB service. Render also now suppliesWEB_CONCURRENCY=1by default for newer services unless overridden (Render default environment variables).enqueue_after_transaction_commitwhen using that topology without coupling application behavior to the queue backend.The app already silenced
/upin production but did not define the route, and neither its image nor Blueprint checked it. Render recommends a health endpoint that returns2xx/3xxonly when the service is healthy (health-check documentation);/upis intentionally liveness-only here.The image preloads jemalloc and already sets
MALLOC_CONF. jemalloc documentsMALLOC_CONFas its runtime configuration mechanism (jemalloc manual);MALLOC_ARENA_MAXis a glibc allocator tunable and therefore conveyed false confidence in this image.Supabase Free currently caps database size at 500 MB (official pricing). A 256 MB cache ceiling reserved more than half of that shared database before application, Queue, and Cable data.
SOLID_CACHE_MAX_SIZE_MBkeeps the smaller default adjustable for apps that outgrow the free profile.Validation
bundle exec rspec— 3 examples, 0 failuresbin/rubocop app/jobs/application_job.rb config/puma.rb config/routes.rb spec/jobs/application_job_spec.rb spec/requests/health_spec.rb— 5 files, no offensesdocker build -t rails-8-template-upstream:pr .— production image builds without a master keyWEB_CONCURRENCY=0andSOLID_QUEUE_IN_PUMA=true— Puma single mode and Solid Queue async supervisor both starthealthy;/upreturns 200 through ThrusterSOLID_QUEUE_IN_PUMA=falsestarts no Solid Queue actorsSOLID_CACHE_MAX_SIZE_MB=17becomes 17 MBrender.yamlparses and contains/upwithoutMALLOC_ARENA_MAXIntentionally left out
autoDeployTrigger: checksPass. The repository's current CI has only an always-green placeholder job, so checks-based deploys add no meaningful safety and risk stranding classroom-derived repositories where Actions are disabled. The Blueprint setting should be enabled with real CI.firstdraft/project-syncing; the accepted changes should be mirrored at that source so a later sync does not revert them.