Skip to content

Deployment (AWS)

Overview

The production environment runs on AWS using ECS (Elastic Container Service) with Fargate for container orchestration. The application is packaged as a Docker image and deployed via CI/CD pipeline.


Architecture

Route53 → CloudFront → ALB → ECS Fargate (app + queue)

                                   ├── RDS PostgreSQL
                                   └── ElastiCache Redis
ServicePurpose
Route53DNS management
CloudFrontCDN + SSL termination
ALBLoad balancing across ECS tasks
ECS FargateContainer orchestration (serverless)
RDS PostgreSQLManaged database
ElastiCache RedisCache + queue
S3File storage (backup, logs)
CloudWatchMonitoring + logging

CI/CD Pipeline

The pipeline is configured via GitHub Actions (.github/workflows/):

  1. Push to develop / main → triggers build
  2. Buildmake build prod (production Dockerfile)
  3. Testcomposer run ci:check (lint + format + types + test)
  4. Push → Image pushed to ECR (Elastic Container Registry)
  5. Deploy → ECS service updated with new image

Required Secrets

SecretDescription
AWS_ACCESS_KEY_IDIAM access key
AWS_SECRET_ACCESS_KEYIAM secret key
AWS_ECR_REPOSITORYECR repository URI
ECS_CLUSTERECS cluster name
ECS_SERVICEECS service name
APP_KEYLaravel APP_KEY
DB_*Database credentials
REDIS_*Redis credentials

Environment Variables

env
APP_ENV=production
APP_DEBUG=false
APP_KEY=base64:...

DB_CONNECTION=pgsql
DB_HOST=clustername.cluster-xxx.rds.amazonaws.com
DB_PORT=5432
DB_DATABASE=sutomo
DB_USERNAME=sutomo
DB_PASSWORD=...

REDIS_HOST=clustername.xxx.ng.0001.use1.cache.amazonaws.com
REDIS_PASSWORD=...
REDIS_PORT=6379

AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=sutomo-production

Monitoring

ToolPurposeAccess
CloudWatchLogs + metricsAWS Console
GrafanaDashboardgrafana.sutomo.sch.id
PrometheusMetrics collectionInternal
Laravel HorizonQueue management/portal/horizon

Key Files

FilePurpose
.github/workflows/deploy.ymlCI/CD pipeline definition
DockerfileProduction image (multi-stage, ~150MB)
docker-compose.ymlProduction service definitions
config/octane.phpFrankenPHP worker configuration