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.
- 🎯 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
- A Civo account (for cloud infrastructure)
- A GitHub account (for CI/CD)
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
Create a .env file in your project root:
# Civo Configuration
CIVO_API_KEY=your_civo_api_key
CIVO_REGION=NYC1
# Upstash Configuration
UPSTASH_EMAIL=your_email
UPSTASH_API_KEY=your_upstash_api_key
# GitHub Configuration
GITHUB_TOKEN=your_github_token
# Django Configuration
DJANGO_SECRET_KEY=your_secret_key
DJANGO_DEBUG=False
DJANGO_ALLOWED_HOSTS=your-domain.comEdit 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