Deployment Overview
Gumroad uses automated deployments with Buildkite and Nomad for orchestration:- Staging - Automatically deployed from
mainbranch - Production - Automatically deployed from
mainafter staging succeeds - Branch Apps - Preview deployments for feature branches
- Hotfixes - Emergency deployments outside the normal flow
Automated Deployment
The standard deployment flow is fully automated:No manual intervention is needed for standard deployments. The CI/CD pipeline handles everything automatically.
Prerequisites
For manual deployments or hotfixes, you’ll need:Required Setup
- Environment variables file -
nomad/.envwith deployment credentials - AWS CLI - Installed and configured with IAM credentials
- Nomad documentation - Read
nomad/README.mdfor architecture understanding
Deployment credentials are stored in 1Password (team members only).
Manual Deployment
Automatic Script Method
For simple deployments of verified commits:- Detect your current branch (doesn’t matter which)
- Show commits to be deployed
- Prompt for confirmation
- Handle the deployment process
Manual Method
For more control over the deployment process:Deployment Architecture
Docker Images
Each deployment creates a Docker image tagged with the git commit SHA:Nomad Jobs
Nomad orchestrates several job types:- database_migration - Runs database migrations
- web - Rails web servers
- sidekiq_worker - Background job workers
- rpush - Push notification service
- post_deployment - Post-deployment tasks
Deployment Sequence
The deployment script follows this sequence:Deployment Locks
Deployments are automatically locked during active deployments.Manual Lock Management
Branch Apps
Create preview deployments for testing features:Branch apps are automatically deleted when the branch is deleted from the repository.
Hotfix Deployments
Hotfixes allow deploying critical fixes outside the normal flow.When to Use Hotfixes
Use hotfixes for:- Critical production bugs
- Security vulnerabilities
- Data integrity issues
Hotfix Process
Create hotfix branch
Branch from the last production tag:
Branch name must start with
comp-assets- for Docker image builds.Hotfix Alternative Tag Sources
If the latest deployment was already a hotfix (not inproduction-release tag):
- Find the last deployed tag from Slack #releases channel
- Check the tags page on GitHub
- Create branch from that specific tag
Hotfixing Workers Only
To deploy only Sidekiq workers without affecting web servers:Method 1: Modify Deployment Script
Method 2: Direct Nomad Command
Rollback Procedures
When Deployment Goes Bad
Stop running containers
Visit the Nomad UI at
http://localhost:8080 and kill problematic containers in the Allocations page.If localhost doesn’t work:Find previous revision
Check the #releases Slack channel for the last successful deployment tag.Example:
production-d6b4605Monitoring Deployments
Logs
All production logs are available in Kibana:- URL: https://logs.gumroad.com
- Search by: 7-letter commit SHA
- Includes: DB migrations, web servers, Sidekiq workers
Slack Notifications
Deployment events are posted to#releases channel:
- Deployment starts
- Deployment completes
- Deployment failures
- Rollbacks
Nomad UI
Access the Nomad UI to:- View running jobs and allocations
- Check resource utilization
- Monitor job health
- View logs for specific allocations
Deployment Checklist
Pre-Deployment
Pre-Deployment
- All tests passing on CI
- Code reviewed and approved
- Database migrations are backwards compatible
- Feature flags configured if needed
- Staging deployment successful and validated
- Team notified in #releases (for manual deployments)
During Deployment
During Deployment
- Monitor deployment progress in Nomad UI
- Watch logs in Kibana for errors
- Verify database migrations complete successfully
- Check that new workers start properly
- Confirm web servers are healthy
Post-Deployment
Post-Deployment
- Smoke test critical functionality
- Monitor error rates in Bugsnag
- Check performance metrics
- Verify Sidekiq queues are processing
- Confirm in #releases channel
Environment-Specific Configuration
Staging Environment
- Branch:
staging - URL: https://staging.gumroad.com
- Auto-deploy: Enabled on
mainbranch - Database: Staging database (separate from production)
Production Environment
- Branch:
production(tags) - URL: https://gumroad.com
- Auto-deploy: Enabled after staging succeeds
- Database: Production database (replicated)
Troubleshooting
Deployment is locked
Deployment is locked
Problem: Deployment fails with “deployment is locked” message.Solution: Check if another deployment is in progress. If not, manually unlock:
Docker image not found
Docker image not found
Problem: Deployment fails because Docker image doesn’t exist.Solution: Ensure Buildkite completed the
docker_asset_compile job. Check the Buildkite UI for the commit.Database migration fails
Database migration fails
Problem: Migration fails during deployment.Solution:
- Check migration logs in Kibana
- If migration is invalid, rollback to previous version
- Fix migration and redeploy
- Never deploy migrations that aren’t backwards compatible
Best Practices
Test Migrations
Always test database migrations on staging before production. Ensure they’re reversible.
Use Feature Flags
Deploy code behind feature flags for gradual rollouts and easy rollbacks.
Monitor After Deploy
Watch error rates and performance for 30 minutes after each production deployment.
Document Hotfixes
Always document hotfix deployments in #releases with reason and impact.
Next Steps
Architecture
Understand the deployment architecture
Testing
Ensure tests pass before deploying
Contributing
Follow contribution guidelines
Testing
Test before deploying