Skip to main content

Overview

The platform runs on AWS with the following services:
ServicePurpose
ECS (EC2 launch type)Container orchestration for app, nginx, blackbox
ECRDocker image registry
S3File storage (profile images, videos, documents, env configs)
CloudWatchContainer logging
CodeBuildCI/CD build pipeline

AWS account details

Account ID: 170904582664
Region: eu-west-2 (London)
ECR Registry: 170904582664.dkr.ecr.eu-west-2.amazonaws.com

S3

Configuration

AWS_ACCESS_KEY_ID       — AWS access key
AWS_SECRET_ACCESS_KEY   — AWS secret key
AWS_DEFAULT_REGION      — AWS region
AWS_BUCKET              — S3 bucket name
Config: config/filesystems.php under s3 disk.

Storage layout

The S3 bucket tutorbloc-app stores:
PathContent
Profile imagesTutor/student profile pictures
Profile videosTutor intro videos
DBS documentsDBS certificate images
Qualification documentsEducation qualification images
Lesson note filesFiles attached to lesson notes
env-configurations/staging/.envStaging environment config
env-configurations/production/.envProduction environment config
APNS key filesApple push notification certificates

File access patterns

Files are served via temporary signed S3 URLs — not direct public URLs:
// Profile images/videos: redirect to signed URL
GET /api/resources/profile-image/{id}     5-minute signed URL
GET /api/resources/profile-video/{id}     5-day signed URL

// Protected documents: requires auth
GET /api/resources/dbs-image/{id}         5-minute signed URL (auth:api)
GET /api/resources/qualification-image/{id}  5-minute signed URL (auth:api)

File model

File: app/Models/File.php Uses UUID primary keys (non-incrementing strings), not auto-increment integers.
files
├── id (UUID string)
├── name
├── url
└── Polymorphic attachments via fileables table

ECS

Task definitions

Two environments, each running 3 containers: Production (production-taskdef.json):
ContainerImagePortMemory
apptutorbloc.app:production9000128 MB
nginxtutorbloc.app.nginx:production80128 MB
blackboxtutorbloc.blackbox:production3000128 MB
Staging (staging-taskdef.json):
ContainerImagePortMemory
apptutorbloc.app:staging9000128 MB
nginxtutorbloc.app.nginx:staging80, 443128 MB
blackboxtutorbloc.blackbox:staging3000128 MB

Environment file loading

ECS loads .env from S3 at container startup:
"environmentFiles": [{
  "value": "arn:aws:s3:::tutorbloc-app/env-configurations/production/.env",
  "type": "s3"
}]

Container startup

The app container (from Dockerfile) runs on startup:
  1. php artisan migrate --force — run pending migrations
  2. crond — start cron daemon for scheduled jobs
  3. php-fpm — start PHP-FPM process
If a migration fails, the container fails to start. This can cause deployment issues if a migration has errors.

CloudWatch

Logging configured per container:
Log group: /ecs/production-app-ec2  (or /ecs/staging-app-ec2)
Region: eu-west-2
Stream prefix: ecs
All three containers (app, nginx, blackbox) log to the same CloudWatch group.

ECR images

Three images are pushed during CI/CD:
ImageTag pattern
tutorbloc.app{env}, {env}-{build_number}
tutorbloc.app.nginx{env}, {env}-{build_number}
redis{env}
The blackbox image is pulled separately (not built in CI/CD).