Copilot instructions
.github/instructions/rails-deployment.instructions.mdRails Deployment with Kamal
Copilot instructions
Quality
52/100
Scores the file, not the repository.Length
738 words
25 headings · 0 code blocksRepository
54
— · pushed 410 days agoLast changed
3 days ago
First indexed 3 days ago.123456# Rails Deployment with Kamal78## Core Philosophy910- Deploy containerized Rails applications without complexity11- Use Kamal for zero-downtime deployments12- Keep deployment configuration simple and version controlled13- Leverage Docker without becoming a Docker expert14- Deploy anywhere with SSH access1516## Kamal Principles1718- One command deployments with automatic rollback19- Built-in health checks and rolling updates20- Integrated secret management21- No Kubernetes complexity needed22- Direct SSH-based deployment to servers2324## Configuration Strategy2526- Keep all deployment config in `config/deploy.yml`27- Use environment-specific settings wisely28- Store secrets securely with Kamal's encryption29- Version control deployment configuration30- Document server requirements clearly3132## Server Prerequisites3334- Ensure servers have Docker installed35- Configure SSH access for deployment user36- Set up firewall rules appropriately37- Prepare SSL certificates if needed38- Verify sufficient disk space and memory3940## Environment Management4142- Use Kamal's built-in environment variable handling43- Separate secrets from non-sensitive configuration44- Use `.env` files for local development only45- Leverage Rails credentials for application secrets46- Keep production passwords out of version control4748## Container Strategy4950- Build minimal production Docker images51- Use multi-stage builds to reduce size52- Install only production dependencies53- Configure proper health check endpoints54- Set appropriate resource limits5556## Database Configuration5758- Use managed databases when possible59- Configure connection pooling appropriately60- Set up automated backups61- Use read replicas for scaling62- Handle database migrations carefully6364## Asset Management6566- Precompile assets during Docker build67- Use CDN for asset delivery68- Configure proper cache headers69- Compress assets appropriately70- Handle asset versioning correctly7172## Health Checks7374- Implement `/up` endpoint for health monitoring75- Check database connectivity76- Verify background job processing77- Monitor external service dependencies78- Return appropriate status codes7980## Deployment Workflow8182- Run tests before deployment83- Build Docker image with correct tags84- Push to container registry85- Deploy with health check verification86- Monitor deployment progress8788## Zero-Downtime Deployments8990- Use Kamal's rolling deployment strategy91- Ensure backwards-compatible migrations92- Handle long-running requests gracefully93- Implement proper connection draining94- Test rollback procedures9596## SSL and Security9798- Use Let's Encrypt for SSL certificates99- Configure Traefik for SSL termination100- Implement proper security headers101- Keep containers updated102- Monitor for security vulnerabilities103104## Logging and Monitoring105106- Centralize application logs107- Use structured logging format108- Monitor application performance109- Set up error tracking110- Configure alerting rules111112## Background Jobs113114- Deploy workers alongside web servers115- Configure appropriate concurrency116- Monitor job queue depth117- Handle worker restarts gracefully118- Separate critical from bulk job workers119120## Scaling Strategy121122- Start with vertical scaling123- Add horizontal scaling when needed124- Use load balancer health checks125- Monitor resource utilization126- Plan capacity ahead of demand127128## Backup and Recovery129130- Automate database backups131- Test restore procedures regularly132- Back up uploaded files133- Document recovery procedures134- Store backups in multiple locations135136## Performance Optimization137138- Use HTTP/2 where possible139- Enable gzip compression140- Configure appropriate timeouts141- Monitor response times142- Optimize container startup time143144## Troubleshooting145146- Use Kamal's built-in debugging commands147- Access container logs easily148- Connect to running containers149- Monitor deployment events150- Keep rollback procedures ready151152## Maintenance153154- Schedule maintenance windows155- Communicate with users appropriately156- Test updates in staging first157- Monitor after deployments158- Document common issues159160## Cost Optimization161162- Right-size server resources163- Use spot instances where appropriate164- Monitor resource utilization165- Clean up unused resources166- Optimize container image sizes167168## Disaster Recovery169170- Document recovery procedures171- Test disaster scenarios172- Maintain off-site backups173- Have communication plan ready174- Know your RTO and RPO175176## Best Practices177178- Deploy frequently in small batches179- Automate everything possible180- Monitor before, during, and after deploys181- Keep deployment simple and boring182- Document non-obvious decisions183184## Common Patterns185186- Blue-green deployments for critical updates187- Canary deployments for gradual rollouts188- Feature flags for controlled releases189- Database migrations as separate step190- Scheduled deployments for low-traffic periods191192## Security Considerations193194- Rotate credentials regularly195- Use IAM roles where possible196- Audit server access197- Keep containers minimal198- Scan images for vulnerabilities199200Remember: Kamal makes deployment as simple as `kamal deploy`. Focus on your application, not deployment complexity.201
Also in levifig/rails-instructions
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| levifig/rails-instructions.github/instructions/rails-core.instructions.md · 54 | Copilot instructions | teststylearchtesting-strategy+5 | 68/100 | 3 days ago | |
| levifig/rails-instructions.cursor/rules/guidelines.mdc · 54 | Cursor rules | teststyletesting-strategysecurity+4 | 71/100 | 3 days ago | |
| levifig/rails-instructions.cursor/rules/rails-rules.mdc · 54 | Cursor rules | testlint-formatstylearch+9 | 84/100 | 3 days ago | |
| levifig/rails-instructions.github/copilot-instructions.md · 54 | Copilot instructions | teststyletesting-strategysecurity+4 | 71/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-api.instructions.md · 54 | Copilot instructions | testlint-formatstyletesting-strategy+7 | 67/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-background-jobs.instructions.md · 54 | Copilot instructions | teststyletesting-strategydatabase+2 | 63/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-controllers.instructions.md · 54 | Copilot instructions | teststylesecurityapi+1 | 56/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-hotwire.instructions.md · 54 | Copilot instructions | teststylesecurityperformance+1 | 56/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-importmaps.instructions.md · 54 | Copilot instructions | teststylesecuritydatabase+2 | 56/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-mobile.instructions.md · 54 | Copilot instructions | styleuiperformance | 66/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-models.instructions.md · 54 | Copilot instructions | teststylearchtypes+4 | 60/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-performance.instructions.md · 54 | Copilot instructions | teststylegitdatabase+2 | 56/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-security.instructions.md · 54 | Copilot instructions | teststylesecuritydependencies+3 | 63/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-services.instructions.md · 54 | Copilot instructions | teststylearchtesting-strategy+4 | 75/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-styling.instructions.md · 54 | Copilot instructions | styledatabaseuiperformance+3 | 59/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-testing.instructions.md · 54 | Copilot instructions | teststyletesting-strategysecurity+2 | 56/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails-views.instructions.md · 54 | Copilot instructions | teststylearchsecurity+3 | 60/100 | 3 days ago | |
| levifig/rails-instructions.github/instructions/rails.instructions.md · 54 | Copilot instructions | testlint-formatstylearch+9 | 84/100 | 3 days ago |
Diff against .github/instructions/rails-core.instructions.md Diff against .cursor/rules/guidelines.mdc Diff against .cursor/rules/rails-rules.mdc Diff against .github/copilot-instructions.md Diff against .github/instructions/rails-api.instructions.md Diff against .github/instructions/rails-background-jobs.instructions.md Diff against .github/instructions/rails-controllers.instructions.md Diff against .github/instructions/rails-hotwire.instructions.md Diff against .github/instructions/rails-importmaps.instructions.md Diff against .github/instructions/rails-mobile.instructions.md Diff against .github/instructions/rails-models.instructions.md Diff against .github/instructions/rails-performance.instructions.md Diff against .github/instructions/rails-security.instructions.md Diff against .github/instructions/rails-services.instructions.md Diff against .github/instructions/rails-styling.instructions.md Diff against .github/instructions/rails-testing.instructions.md Diff against .github/instructions/rails-views.instructions.md Diff against .github/instructions/rails.instructions.md
