Overview
Modrinth uses different deployment strategies for its various components:- Frontend (Web): Cloudflare Pages with SSR
- Backend (Labrinth): Docker containers on Kubernetes
- Desktop App: GitHub Releases with auto-updater
- Documentation: Cloudflare Pages (static)
Frontend Deployment (Cloudflare Pages)
Build Process
The web frontend is deployed to Cloudflare Pages with Nuxt’s Cloudflare preset. Build command:.output/ directory with:
- Static assets in
.output/public/ - Server functions in
.output/server/
CI/CD Workflow
.github/workflows/frontend-deploy.yml
Preview Deployments
Every pull request gets an automatic preview deployment:.github/workflows/frontend-preview.yml
https://pr-{number}.modrinth-web.pages.dev
Environment Variables
Production environment variables are configured in Cloudflare Pages:SSR Configuration
Nuxt is configured for server-side rendering:nuxt.config.ts
Rollback
Rollback to previous deployment:Backend Deployment (Docker + Kubernetes)
Docker Build
Labrinth is deployed as a Docker container. Dockerfile:apps/labrinth/Dockerfile
CI/CD Workflow
.github/workflows/labrinth-docker.yml
Release Profile
Production builds use optimized settings:Cargo.toml
Kubernetes Deployment
Deployment manifest:k8s/labrinth-deployment.yaml
k8s/labrinth-service.yaml
Database Migrations
Migrations are run before deploying new version:Rolling Updates
Health Checks
Labrinth exposes health endpoints:src/routes/health.rs
Desktop App Deployment
Build Process
The desktop app is built for all platforms using GitHub Actions..github/workflows/theseus-build.yml
Release Process
1
Create Tag
2
Build Artifacts
GitHub Actions builds for:
- macOS: Universal binary (x64 + ARM64)
.dmg - Windows:
.msiinstaller and.exeportable - Linux:
.deb,.AppImage
3
Create GitHub Release
4
Update Auto-Updater
Tauri’s auto-updater automatically detects new releases from GitHub.
Version Numbering
The app version is set inpackages/app-lib/Cargo.toml:
Code Signing
macOS:Auto-Updates
The app checks for updates on launch:apps/app/src/main.rs
Documentation Deployment
Documentation (this site) is deployed to Cloudflare Pages:main.
Infrastructure
Services
Modrinth production infrastructure:- Cloudflare Pages: Frontend hosting + CDN
- Kubernetes: Backend API orchestration
- PostgreSQL: Primary database (managed)
- Redis: Cache and sessions (managed)
- ClickHouse: Analytics database (managed)
- Meilisearch: Search engine (managed)
- S3: Object storage (files, images)
- Sentry: Error tracking
- Datadog: Monitoring and logging
Monitoring
Health checks:- Request rate
- Response time
- Error rate
- Database query time
- Cache hit rate
- Application logs
- Access logs
- Error logs
- Audit logs
Scaling
Horizontal scaling:- Read replicas for read-heavy queries
- Connection pooling (PgBouncer)
- Query optimization
Deployment Checklist
Pre-Deployment
1
Run Tests
2
Check Linting
3
Test Migrations
Test database migrations on staging environment first.
4
Update Changelog
Document changes in CHANGELOG.md or release notes.
5
Review Dependencies
Check for security vulnerabilities:
Deployment
1
Deploy to Staging
Test on staging environment first:
2
Run Smoke Tests
Verify critical functionality on staging.
3
Deploy to Production
4
Monitor Deployment
Watch logs and metrics for errors:
- Check Sentry for new errors
- Monitor Datadog dashboards
- Watch Kubernetes pod status
5
Verify Functionality
Test critical user flows:
- Login/authentication
- Project search
- File downloads
- API endpoints
Post-Deployment
- Announce release (if user-facing changes)
- Update documentation if needed
- Monitor for issues over next 24 hours
- Be ready to rollback if critical issues arise
Rollback Procedures
Frontend Rollback
Backend Rollback
Database Rollback
If migration needs to be reverted:Security
Secrets Management
- GitHub Secrets for CI/CD
- Kubernetes Secrets for production
- Never commit secrets to git
- Rotate secrets regularly
Vulnerability Scanning
SSL/TLS
- Cloudflare provides SSL for frontend
- Let’s Encrypt certificates for backend
- Enforce HTTPS everywhere
Next Steps
Local Setup
Set up local development environment
Testing
Run tests before deployment
Backend (Labrinth)
Learn about backend architecture
Contributing
Contribute to Modrinth
