Current Architecture: ReptiDex uses AWS ECS Fargate for serverless container orchestration with ARM64 Graviton2 processors. All infrastructure is managed via CloudFormation templates, and applications are deployed as Docker containers via ECR and GitHub Actions.
ReptiDex Deployment Guide
Comprehensive deployment procedures for ReptiDex infrastructure and applications, covering both AWS CloudFormation infrastructure and application deployment strategies.
Quick Navigation
Infrastructure
AWS CloudFormation
Applications
Frontend & Backend
CI/CD
Automated deployments
Troubleshooting
Common issues
Infrastructure Deployment
Prerequisites
Required Setup
AWS Requirements:
- AWS CLI installed and configured
- CloudFormation, ECS, ECR, RDS, IAM permissions
- AWS SSO configured for reptidex-dev profile
- Node.js 20+ and pnpm installed
- Docker with ARM64/AMD64 support
- Git configured with ReptiDex credentials
- GitHub Packages authentication token (for private npm packages)
CloudFormation Infrastructure
reptidex uses AWS CloudFormation templates for infrastructure as code. Templates are organized in deployment order:- Development
- Production
Development Environment Deployment
Cost: ~$150/month | Uptime: 24/7 (on-demand scaling)- Multi-AZ deployment (2 AZs for HA)
- ECS Fargate with ARM64 Graviton2 (0.25-0.5 vCPU per task)
- db.t4g.micro RDS and cache.t4g.micro ElastiCache
- 2x NAT gateways for private subnet egress
- Container Insights for monitoring
- 7-day CloudWatch log retention
Infrastructure Templates Overview
| Template | Purpose | Resources | Dependencies |
|---|---|---|---|
| 01-vpc.yaml | Network foundation | VPC, subnets, IGW, NAT gateway, flow logs | None |
| 02-security.yaml | Security infrastructure | Security groups, IAM roles, policies | VPC |
| 03-database.yaml | Data layer | RDS PostgreSQL, ElastiCache Redis | VPC, Security |
| 04-compute.yaml | Load balancer and routing | ALB, Target Groups, Listener Rules, DNS | VPC, Security, Database |
| 05-ecs.yaml | Container orchestration | ECS Cluster, Fargate Services, Task Definitions | VPC, Security, Compute |
Infrastructure Cleanup
⚠️ Infrastructure Cleanup (Destructive Operation)
CloudFormation Stack Deletion: Similar toterraform destroy, reptidex
provides a cleanup script for completely removing AWS infrastructure. This
operation is irreversible and will permanently delete all resources.- Complete Cleanup
- Selective Cleanup
Delete All Infrastructure
- Prompts for explicit
DELETEconfirmation - Deletes stacks in reverse dependency order:
- 06-monitoring → 05-storage → 04-compute → 03-database → 02-security → 01-vpc
- Waits for each stack deletion to complete
- Shows progress and any failures
- All ECS services and task definitions
- ECS Fargate cluster
- RDS databases and ElastiCache clusters
- Application Load Balancer and target groups
- ECR repositories (if empty)
- Route53 DNS records
- All IAM roles and security groups created by templates
Cleanup Safety Features
Safety Confirmations
Multiple Confirmation Steps:
- Environment confirmation (dev/prod)
- Stack list preview before deletion
- Explicit
DELETEtyping requirement - Progress tracking with failure handling
Failure Handling
Robust Error Handling:
- Skips non-existent stacks gracefully
- Shows stack events for failed deletions
- Continues with remaining stacks on partial failures
- Provides detailed error messages and troubleshooting info
Common Cleanup Issues
- S3 Bucket Issues
- Database Issues
- Manual Cleanup
S3 Buckets Not Empty:
Application Deployment
Development Application Deployment
- Local Development
- AWS Development
Local Development Setup ```bash # 1. Clone and setup workspace git
clone https://github.com/reptidex/reptidex.git cd reptidex # 2. Install dependencies pnpm install # 3. Start backend services (Docker) ./scripts/dev.sh backend # 4. Start frontend applications (local) ./scripts/dev.sh frontend # 5. Verify services curl http://localhost:8001/health # Core API curl http://localhost:8002/health # Animal API curl http://localhost:3000 # Public web app ``` Local Architecture: - Backend: Docker containers with PostgreSQL and Redis - Frontend: Local Vite dev servers with hot reload - Environment: Mixed development for optimal developer experienceProduction Application Deployment
Production Deployment Process
Zero-Downtime ECS Deployment Strategy:- Rolling Updates: ECS Fargate rolling deployment with health checks
- Deployment Circuit Breaker: Automatic rollback on task failures
- Database Migrations: Run via ECS task before service update
- Health Check Monitoring: ALB health checks validate new tasks
CI/CD Pipeline
GitHub Actions Workflow
- Infrastructure
- Applications
Infrastructure CI/CD
Deployment Environments
Development
Purpose: Feature development and testing Trigger: Pull request
creation Approval: Automatic Rollback: Automatic on failure
Staging
Purpose: Pre-production validation Trigger: Merge to main branch
Approval: Automatic Rollback: Manual trigger available
Production
Purpose: Live customer-facing environment Trigger: Manual promotion
from staging Approval: Required (manual approval) Rollback:
Automated with monitoring triggers
Monitoring and Health Checks
Application Health Endpoints
All reptidex services expose health check endpoints for monitoring:Deployment Monitoring
- Infrastructure
- Applications
Infrastructure Monitoring CloudFormation Stack Monitoring: - Stack
creation/update events - Resource creation status - Stack drift detection - Cost monitoring and alerts Network Monitoring: - VPC Flow Logs analysis- Security group compliance - NAT Gateway usage and costs - Internet Gateway traffic patterns
Troubleshooting
Common Infrastructure Issues
- CloudFormation
- Networking
- Applications
CloudFormation Deployment Issues
Stack Creation Failures:- Verify AWS credentials and permissions
- Check CIDR block overlaps in parameters
- Ensure availability zones exist in target region
- Verify instance types are available in region
Emergency Procedures
Emergency Rollback Procedures
Infrastructure Rollback:bash # Rollback CloudFormation stack to previous version aws cloudformation cancel-update-stack --stack-name reptidex-prod-compute # Or rollback to specific change set aws cloudformation execute-change-set --change-set-name rollback-changeset Application
Rollback: bash # Rollback to previous Auto Scaling Group launch template ./scripts/rollback-deployment.sh prod --version previous # Or emergency traffic redirect ./scripts/emergency-redirect.sh --target maintenance-page Support Contacts
Infrastructure Issues:- Primary: DevOps team
- Escalation: AWS Support (Business Plan)
- Emergency: On-call engineer rotation
- Primary: Development team
- Database: Database administrator
- Frontend: Frontend team lead
This deployment guide covers the complete reptidex deployment process from
infrastructure provisioning to application deployment. Regular updates to this
documentation ensure alignment with infrastructure changes and deployment
process improvements. For the latest deployment procedures, always refer to
the scripts in the
/infrastructure/scripts/ directory and CI/CD pipeline
configurations.
