This directory contains everything needed to deploy the Video Processing Application to AWS.
- Docker and Docker Compose installed locally
- Pulumi CLI installed
- AWS CLI configured with appropriate credentials
- Cloudflare account and API token
- Domain name managed by Cloudflare
- Python 3.12 or higher
- Git (for cloning the repository)
deployments/
├── docker-compose.yml # Container orchestration
├── Dockerfile # Container build definition
├── deploy.sh # Deployment automation script
├── Pulumi.yaml # Pulumi project configuration
├── infra/ # Pulumi infrastructure code
│ ├── __main__.py # Main infrastructure definition
│ └── requirements.txt # Infrastructure dependencies
└── README.md # This documentation
- Create and activate virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
- Create necessary directories:
mkdir -p uploads processed
- Build and run locally:
# Run from the project root directory
docker-compose -f deployments/docker-compose.yml up --build
-
Access the application at http://localhost:8000
-
Stop the application:
# Use Ctrl+C to stop, then:
docker-compose -f deployments/docker-compose.yml down
The deployment script will:
- Use the project's virtual environment
- Install required Pulumi packages
- Initialize the Pulumi stack
- Deploy the infrastructure
Before deploying:
# Activate the project's virtual environment
source .venv/bin/activate # On Windows: .venv\Scripts\activate
- Make the deployment script executable:
# Run from the project root directory
chmod +x deployments/deploy.sh
- Deploy to AWS with Cloudflare integration:
# Run from the project root directory
./deployments/deploy.sh yourdomain.com your-cloudflare-api-token production
After deployment:
- The application will be available at your specified domain
- Cloudflare will automatically handle SSL/TLS
- The health check endpoint will monitor application status
- Docker will automatically restart the container if it fails
The deployment creates:
- VPC with proper networking
- EC2 instance running Docker
- Security group with necessary ports
- DNS record in Cloudflare
- SSL/TLS via Cloudflare's proxy
- Cloudflare proxy protection
- Automated SSL/TLS certificate management
- Restricted security group rules
- Container isolation
Adjust the following files for customization:
deployments/docker-compose.yml
for container configurationdeployments/Dockerfile
for build processdeployments/infra/__main__.py
for infrastructure settings.env
for application configuration (created during deployment)
HOST=0.0.0.0
PORT=80 # In production
DEBUG=False
ALLOWED_EXTENSIONS="mp4, avi, mov, mkv"
UPLOAD_DIR=uploads
PROCESSED_DIR=processed
The application includes a health check endpoint at /health
Docker will automatically restart the container if it becomes unhealthy.
Health check configuration:
- Interval: 30s
- Timeout: 10s
- Retries: 3
To destroy the infrastructure:
# Run from the project root directory
cd deployments/infra
pulumi destroy --yes
# Remove containers and images
docker-compose -f deployments/docker-compose.yml down --rmi all
# Clean up volumes (optional)
rm -rf uploads/* processed/*
-
If deployment fails:
- Check AWS credentials
- Verify Cloudflare API token permissions
- Review Pulumi logs
-
If container fails to start:
- Check docker logs
- Verify port availability
- Ensure directories exist
-
For SSL/TLS issues:
- Verify Cloudflare proxy status
- Check DNS propagation