Productionize palinks: systemd service + production Rails config #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Type
Feature
Lineage
Standalone — follow-up from initial deployment session. Site is live at https://palinks.tail5b443a.ts.net but runs as a manual
rails server -din development mode. No crash recovery, no boot persistence.Repo
ldraney/palinksUser Story
As Lucas
I want palinks to survive reboots and crashes without manual intervention
So that my link dashboard is always available
Context
palinks is deployed as a reverse proxy tunnel: nginx in k8s (
pal-e-deployments/overlays/palinks/) proxies to the local Puma server on100.110.151.59:3921via Tailscale. Currently running in development mode withbin/rails server -d. If Puma crashes or the machine reboots, the site goes dark.The database is already production-ready — CNPG cluster with
palinksdatabase created, daily backups to MinIO, WAL archiving. Thedatabase.ymlproduction config points topal-e-postgres-rw.postgres.svc.cluster.local, but for the reverse-proxy model the app connects to the same local Postgres (the CNPG cluster connection only works from inside k8s).File Targets
Files to create:
palinks.service— systemd unit file for Puma (auto-start, restart on crash)Files to modify:
config/environments/production.rb— production config (assume_ssl, allowed hosts, log level)config/database.yml— ensure local production database config works (local Postgres, not CNPG for the tunnel model)config/puma.rb— production worker/thread tuning if neededSteps outside the repo:
palinksproduction database on local PostgresRAILS_MASTER_KEYor generate production credentialsRAILS_ENV=production bin/rails db:migrateRAILS_ENV=production bin/rails assets:precompilesystemctl --user enable --now palinksAcceptance Criteria
systemctl --user status palinksshows active/runningsystemctl --user stop palinks && systemctl --user start palinks, site recovers within 10skill -9 $(pgrep -f palinks), systemd restarts Puma automaticallyTest Expectations
curl -s -o /dev/null -w "%{http_code}" https://palinks.tail5b443a.ts.net→ 200Constraints
systemctl --user(user-level unit), not root — matches the dev workflowloginctl enable-linger ldraney) so user services run without a login sessionSECRET_KEY_BASE— either viarails credentials:editor env varassume_ssl = truein production config (funnel terminates TLS)Checklist
Related
ldraney/pal-e-deployments— overlay atoverlays/palinks/(nginx reverse proxy)