Cloud-agnostic Infrastructure as Code (IaC) and Configuration as Code (CaC) for the CP-Planta application, supporting AWS and Azure platforms with Docker Swarm orchestration.
CP-Planta Infrastructure provides an automated deployment pipeline for a containerized application stack with:
- Multi-cloud support: Deploy to AWS or Azure with the same code base
- High availability: Docker Swarm orchestration with service replication
- Database resilience: PostgreSQL with primary-replica replication
- Connection pooling: PgBouncer for optimized database connections
- Automated DevOps: GitHub Actions workflows for CI/CD
- Secure access: Automatic SSL certificate generation via Let's Encrypt
The infrastructure is designed as a multi-tier application with:
- Frontend: React.js application served through Traefik
- Backend: NestJS API with Prisma ORM
- Database: PostgreSQL with replication for high availability
- Edge Router: Traefik for SSL termination and routing
- Monitoring: Docker Swarm Visualizer
-
Clone the repository:
git clone https://github.com/Saccilotto-AGES-Projects/AGES-III-CP-Planta-Infra.git cd AGES-III-CP-Planta-Infra -
Create your environment file:
./secrets-manager.sh template cp .env.example .env # Edit .env with your cloud credentials -
Deploy to your chosen cloud:
# For AWS ./deploy.sh --provider aws # For Azure ./deploy.sh --provider azure
-
Access your application via the displayed endpoints:
- Frontend: https://cpplanta.duckdns.org
- API: https://api.cpplanta.duckdns.org
- PgAdmin: https://pgadmin.cpplanta.duckdns.org
- Visualizer: https://viz.cpplanta.duckdns.org
CP-Planta-Infra/
├── .github/workflows/ # GitHub Actions workflows
├── terraform/ # Infrastructure as Code
│ ├── aws/ # AWS-specific configuration
│ ├── azure/ # Azure-specific configuration
│ └── modules/ # Reusable Terraform modules
├── deployment/ # Configuration as Code
│ ├── ansible/ # Ansible playbooks and roles
│ ├── swarm/ # Docker Swarm configuration
│ └── kubernetes/ # Kubernetes configuration (future)
├── docs/ # Documentation
├── *.sh # Main deployment scripts
└── *.md # Documentation files
- Compute: AWS EC2 or Azure VM instances
- Networking: VPC/VNet, Security Groups, Load Balancers
- DNS: DuckDNS for domain management
- Container Orchestration: Docker Swarm
- Reverse Proxy: Traefik with automatic SSL
- Service Discovery: Internal DNS with CoreDNS
- Database: PostgreSQL with replication
- Connection Pooling: PgBouncer
- Backend: Node.js API containers
- Frontend: React.js static containers
The infrastructure code supports deployment to both AWS and Azure using the same codebase, allowing for cloud flexibility and disaster recovery options.
PostgreSQL is deployed with a primary-replica setup for data resilience, with automatic failover capabilities through repmgr.
Traefik automatically handles SSL certificate provisioning and renewal through Let's Encrypt.
Comprehensive scripts for deployment, updates, and maintenance tasks reduce operational complexity.
- DEPLOYMENT.md - Detailed deployment instructions
- CLI-REFERENCE.md - Command-line reference guide
Contributions 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 AGPL License - see the LICENSE file for details.
- André Sacilotto Santos - Lead Developer and Software Architect
- Agência Experimental de Engenharia de Software (AGES) - Project Scope and Stakeholders Management
- Hortti - Original Project Idea and Business Requirements