PaaS-style Infrastructure as Code for Django Applications
Deploy your Django applications with a Heroku-like experience using modern cloud infrastructure. DRY2-IaaS combines Infrastructure as Code (Terraform), Kubernetes (Helm), and automated CI/CD workflows to give you a production-ready deployment platform.
🎯 NEW: The CLI now uses GitHub Secrets exclusively. START HERE → for quick setup!
- 🎯 PaaS-like Experience - Deploy Django apps with simple CLI commands
- ☁️ Multi-Cloud Support - Civo Kubernetes, Upstash Redis, and more
- 🔄 GitOps Workflows - Automated deployments via GitHub Actions
- 🌍 Multi-Environment - Dev, staging, and production environments out of the box
- 📦 Helm Charts - Pre-configured Kubernetes deployments with best practices
- 🔧 Terraform Modules - Reusable infrastructure components
- 📊 Observability - Built-in monitoring with Elastic Stack and Sentry
- 🔒 Security - Secrets management, RBAC, and network policies
- Python 3.8 or higher
- Poetry for dependency management
- Terraform >= 1.0
- Helm >= 3.0
- kubectl for Kubernetes management
- GitHub CLI (optional, for easier secret management)
- A Civo account (for cloud infrastructure)
- An Upstash account (for Redis)
- A GitHub account (for CI/CD)
IMPORTANT: This project uses GitHub Secrets to manage all credentials securely.
- ❌ NO credential prompting during
dry2 init - ❌ NO credentials saved to files
- ❌ NO credentials committed to git
- ✅ ALL credentials must be set manually in GitHub
Before deploying, you must manually set up GitHub Secrets for your repository.
📖 Required GitHub Secrets (Quick Reference) 📖 Complete Setup Guide (Detailed Instructions)
# Install GitHub CLI
brew install gh # macOS
# or: sudo apt install gh # Linux
# Authenticate
gh auth login
# Set secrets (replace with your actual values)
gh secret set DEV_CIVO_TOKEN --body "your-token"
gh secret set DEV_UPSTASH_EMAIL --body "your-email"
gh secret set DEV_UPSTASH_API_KEY --body "your-key"
gh secret set DEV_DJANGO_SECRET_KEY --body "$(python3 -c 'import secrets; print(secrets.token_urlsafe(50))')"
gh secret set DEV_DATABASE_URL --body "postgresql://..."
# Repeat for PRODUCTION_* secretsFor detailed instructions, see GITHUB_SECRETS_SETUP.md.
You can install dry2 directly from this GitHub repository using Poetry:
# Option 1: Install as a dependency in your project
poetry add git+https://github.com/qwigo/dry2-iaas.git
# Option 2: Clone and install for development
git clone https://github.com/qwigo/dry2-iaas.git
cd dry2-iaas
poetry install
poetry shellAlternatively, you can use pip:
pip install git+https://github.com/qwigo/dry2-iaas.gitdry2 --version
dry2 --helpIf you've already installed dry2 and need to update to the latest version:
# Update with Poetry
poetry update dry2-cli
# Or reinstall
poetry remove dry2-cli
poetry add git+https://github.com/qwigo/dry2-iaas.git# Navigate to your Django project directory
cd my-django-project
# Initialize DRY2-IaaS
dry2 initThis will guide you through an interactive setup process and create:
.dry2/configuration directory- Terraform configurations for your environments
- GitHub Actions workflows
- Helm values files
# Create a development environment
dry2 env create dev
# Create staging and production environments
dry2 env create staging
dry2 env create production# Deploy the infrastructure for dev environment
dry2 deploy infra --env dev
# This provisions:
# - Kubernetes cluster on Civo
# - Redis on Upstash
# - Load balancers and storage# Deploy your Django application
dry2 deploy app --env dev
# This deploys:
# - Django web servers
# - Celery workers
# - Database migrations
# - Static file collection# Check the status of your deployment
dry2 status --env dev
# View specific components
dry2 status infra --env dev
dry2 status app --env devOnce set up, push to your repository to trigger automatic deployments:
# Push to dev branch -> deploys to dev environment
git push origin dev
# Push to staging branch -> deploys to staging
git push origin staging
# Push to main branch -> deploys to production
git push origin mainInitialize a new DRY2-IaaS project. Creates configuration files and directory structure.
dry2 init [OPTIONS]Manage environments (dev, staging, production).
dry2 env create <environment> # Create a new environment
dry2 env list # List all environments
dry2 env delete <environment> # Delete an environmentDeploy infrastructure or applications.
dry2 deploy infra --env <environment> # Deploy infrastructure
dry2 deploy app --env <environment> # Deploy application
dry2 deploy all --env <environment> # Deploy everythingCheck deployment status.
dry2 status --env <environment> # Overall status
dry2 status infra --env <environment> # Infrastructure status
dry2 status app --env <environment> # Application statusDestroy infrastructure or applications.
dry2 destroy app --env <environment> # Destroy application only
dry2 destroy infra --env <environment> # Destroy infrastructure
dry2 destroy all --env <environment> # Destroy everythingdry2-iaas/
├── dry2/ # DRY2 CLI Python package
│ ├── commands/ # CLI command implementations
│ ├── templates/ # Jinja2 templates
│ └── utils/ # Utility functions
├── pyproject.toml # Poetry configuration
├── setup.py # Setuptools configuration
├── requirements.txt # Python dependencies
│
├── terraform/ # Terraform configurations
│ ├── environments/ # Environment-specific configs
│ │ ├── dev/
│ │ ├── staging/
│ │ └── production/
│ ├── modules/ # Reusable Terraform modules
│ │ ├── civo-k8s/ # Civo Kubernetes cluster
│ │ ├── civo-loadbalancer/ # Load balancer configuration
│ │ ├── civo-storage/ # Persistent storage
│ │ └── upstash-redis/ # Upstash Redis instance
│ └── shared/ # Shared configurations
│
└── helm/ # Helm charts
├── django-app/ # Django application chart
│ ├── templates/ # Kubernetes manifests
│ └── values-*.yaml # Environment-specific values
└── observability/ # Monitoring stack
├── elastic-stack-values.yaml
└── sentry-values.yaml
DRY2-IaaS provides a complete deployment pipeline:
-
Infrastructure Layer (Terraform)
- Kubernetes cluster on Civo
- Redis on Upstash
- Load balancers and storage
-
Application Layer (Helm)
- Django web servers with autoscaling
- Celery workers for background tasks
- PostgreSQL database
- Redis cache
-
Deployment Layer (GitHub Actions)
- Automated CI/CD pipelines
- Environment-specific workflows
- Automatic rollbacks on failure
All credentials are managed via GitHub Secrets. This ensures:
- ✅ No secrets in your repository
- ✅ No local credential files to manage
- ✅ Environment-specific credentials (dev, staging, production)
- ✅ Secure encrypted storage
See GITHUB_SECRETS_SETUP.md for complete setup instructions.
For local Terraform operations, use environment variables instead of files:
# Create a .env file (git-ignored)
export TF_VAR_civo_token="your-token"
export TF_VAR_upstash_email="your-email"
export TF_VAR_upstash_api_key="your-key"
# Source it before running terraform
source .env
cd terraform/environments/dev
terraform planNote: The .env file is git-ignored by default. Never commit credentials!
Edit terraform/environments/<env>/terraform.tfvars:
cluster_name = "my-app-dev"
cluster_nodes = 3
node_size = "g4s.kube.medium"
region = "NYC1"
redis_name = "my-app-redis-dev"
redis_region = "us-east-1"Customize helm/django-app/values-<env>.yaml:
replicaCount: 3
image:
repository: your-registry/your-app
tag: latest
resources:
limits:
cpu: 1000m
memory: 1024Mi
requests:
cpu: 500m
memory: 512Mi
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the terms specified in the LICENSE file.
- AWS EKS support
- Google Cloud GKE support
- DigitalOcean Kubernetes support
- Built-in backup and restore
- Cost optimization recommendations
- Performance monitoring dashboard
- One-click SSL certificate management
- Database migration tooling
Made with ❤️ by the DRY2-IaaS team