Skip to content

πŸ—οΈ Infrastructure as Code for LocalStore Platform - Terraform configurations for AWS deployment, Docker Compose for local dev, and CI/CD pipelines. Single-server MVP setup (~$20/month) with scaling path to production architecture.

License

Notifications You must be signed in to change notification settings

localstore-platform/infra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—οΈ LocalStore Platform - Infrastructure

Infrastructure and deployment repository for the LocalStore Platform. Hosts Terraform configurations for AWS deployment, Docker Compose for local development, and CI/CD pipeline configurations.

Spec Version: v1.1-specs
Repository: infra
Status: 🟑 In Progress


πŸ“‹ Overview

This repository contains:

  • Terraform configurations for AWS infrastructure (VPC, EC2, RDS, etc.)
  • Docker Compose files for local development and production
  • CI/CD pipelines using GitHub Actions
  • Kubernetes manifests (future scaling path)

Tech Stack

  • IaC: Terraform 1.5+
  • Container Runtime: Docker 24+, Docker Compose 2.20+
  • Cloud Provider: AWS (ap-southeast-1 - Singapore region)
  • CI/CD: GitHub Actions
  • DNS/CDN: CloudFlare (optional)

Target Architecture

MVP ($20/month):
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           AWS EC2 (t2.small)            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚        Docker Compose           β”‚    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚    β”‚
β”‚  β”‚  β”‚ NestJS  β”‚  β”‚ Python  β”‚      β”‚    β”‚
β”‚  β”‚  β”‚  API    β”‚  β”‚   AI    β”‚      β”‚    β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜      β”‚    β”‚
β”‚  β”‚       β”‚            β”‚           β”‚    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”      β”‚    β”‚
β”‚  β”‚  β”‚     PostgreSQL       β”‚      β”‚    β”‚
β”‚  β”‚  β”‚       + Redis        β”‚      β”‚    β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Repository Structure

infra/
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ workflows/           # CI/CD pipelines
β”‚   β”‚   β”œβ”€β”€ terraform-plan.yml
β”‚   β”‚   β”œβ”€β”€ terraform-apply.yml
β”‚   β”‚   └── docker-build.yml
β”‚   β”œβ”€β”€ CODEOWNERS
β”‚   β”œβ”€β”€ PULL_REQUEST_TEMPLATE.md
β”‚   └── copilot-instructions.md
β”‚
β”œβ”€β”€ terraform/
β”‚   β”œβ”€β”€ environments/
β”‚   β”‚   β”œβ”€β”€ dev/             # Development environment
β”‚   β”‚   β”œβ”€β”€ staging/         # Staging environment
β”‚   β”‚   └── prod/            # Production environment
β”‚   β”œβ”€β”€ modules/
β”‚   β”‚   β”œβ”€β”€ vpc/             # VPC, subnets, security groups
β”‚   β”‚   β”œβ”€β”€ ec2/             # EC2 instances
β”‚   β”‚   β”œβ”€β”€ rds/             # RDS PostgreSQL (future)
β”‚   β”‚   └── s3/              # S3 buckets
β”‚   └── shared/              # Shared variables and outputs
β”‚
β”œβ”€β”€ docker/
β”‚   β”œβ”€β”€ compose/
β”‚   β”‚   β”œβ”€β”€ docker-compose.yml        # Local dev
β”‚   β”‚   β”œβ”€β”€ docker-compose.prod.yml   # Production
β”‚   β”‚   └── docker-compose.test.yml   # Testing
β”‚   β”œβ”€β”€ nginx/               # Nginx reverse proxy configs
β”‚   └── scripts/             # Helper scripts
β”‚
β”œβ”€β”€ k8s/                     # Kubernetes manifests (future)
β”‚   β”œβ”€β”€ base/
β”‚   └── overlays/
β”‚
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ deploy.sh            # Deployment script
β”‚   β”œβ”€β”€ config.sh            # Environment configuration generator
β”‚   └── ecr.mk               # ECR operations Makefile
β”‚
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ DEPLOYMENT.md        # Deployment guide
β”‚   β”œβ”€β”€ SECURITY.md          # Security configuration
β”‚   └── MONITORING.md        # Monitoring setup
β”‚
β”œβ”€β”€ .env.example             # Environment template
β”œβ”€β”€ SPEC_LINKS.md            # Links to specifications
β”œβ”€β”€ GIT_WORKFLOW.md          # Git workflow guide
└── README.md                # This file

πŸš€ Quick Start

Prerequisites

# Check required tools
terraform --version    # Need 1.5+
docker --version       # Need 24+
docker compose version # Need 2.20+
aws --version          # Need 2.0+

Local Development

# Clone repository
git clone https://github.com/localstore-platform/infra.git
cd infra

# Copy environment template
cp .env.example .env
# Edit .env with your settings

# Start local development environment
cd docker/compose
docker compose up -d

# Verify services are running
docker compose ps

AWS Deployment (MVP)

# Configure AWS credentials
aws configure

# Initialize Terraform
cd terraform/environments/prod
terraform init

# Preview changes
terraform plan -out=plan.tfplan

# Apply changes
terraform apply plan.tfplan

πŸ”§ Configuration

Environment Variables

See .env.example for all required environment variables.

Key variables:

Variable Description Example
AWS_REGION AWS region ap-southeast-1
EC2_INSTANCE_TYPE EC2 instance size t2.small
DOMAIN_NAME Primary domain quanly.ai
DB_PASSWORD Database password (secret)

Infrastructure Costs (Estimated)

Component Monthly Cost
EC2 t2.small ~$15
EBS Storage (20GB) ~$2
Data Transfer ~$3
Total MVP ~$20/month

πŸ“Š Monitoring

CloudWatch Metrics

  • CPU utilization
  • Memory usage
  • Disk I/O
  • Network traffic

Alerts (Production)

  • CPU > 80% for 5 minutes
  • Memory > 85%
  • Disk usage > 90%
  • API response time > 2s

πŸ” Security

Security Groups

Port Service Source
22 SSH Admin IPs only
80 HTTP 0.0.0.0/0
443 HTTPS 0.0.0.0/0
5432 PostgreSQL VPC only
6379 Redis VPC only

Best Practices

  • βœ… Never commit secrets to repository
  • βœ… Use AWS Secrets Manager or Parameter Store
  • βœ… Enable VPC flow logs
  • βœ… Regular security patching
  • βœ… SSL/TLS for all external traffic

πŸ“š Documentation


πŸ”— Related Repositories

Repository Description Status
specs Documentation & specifications βœ… Complete
api NestJS backend API βœ… Sprint 0.5
menu Next.js public menu website 🟑 In Progress
contracts TypeScript shared types βœ… v0.1.0
dashboard Next.js owner dashboard 🟑 Docs Only
mobile Flutter mobile app 🟑 Docs Only

πŸ‘₯ Team & Ownership

CODEOWNERS: @localstore-platform/infra-team

For infrastructure support or questions:

  • Create an issue in this repository
  • Tag @localstore-platform/infra-team in PRs
  • Reference relevant spec sections in SPEC_LINKS.md

πŸ“„ License

MIT License - see LICENSE for details.

About

πŸ—οΈ Infrastructure as Code for LocalStore Platform - Terraform configurations for AWS deployment, Docker Compose for local dev, and CI/CD pipelines. Single-server MVP setup (~$20/month) with scaling path to production architecture.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •