Deployment
Docker Image
The application is containerised using a custom Dockerfile based on a PHP 8.2 FPM image from Housr’s private ECR registry.
Container Stack
The container runs three services via Supervisor:
- PHP-FPM — Handles PHP request processing
- Nginx — Reverse proxy and static file serving (port 80)
- Queue Worker — Processes background jobs (configured in
deploy/supervisord.conf)
Build Process
# Key steps in Dockerfile:
1. Install PHP extensions (pdo_mysql, redis, bcmath, gd, zip, opcache, soap)
2. Install Node.js 18
3. Install Nginx and Supervisor
4. Copy application code
5. Run composer install --no-dev --optimize-autoloader
6. Copy Nginx, PHP-FPM, and Supervisor configs from deploy/
7. Set permissions for www-dataDeploy Directory
The deploy/ directory contains production configuration files:
| File | Purpose |
|---|---|
deploy/run | Container entrypoint script |
deploy/nginx.conf | Nginx configuration |
deploy/deploy.conf | Nginx site configuration |
deploy/www.conf | PHP-FPM pool configuration |
deploy/supervisord.conf | Supervisor process management |
deploy/opcache.ini | PHP OPcache settings (timestamps validation disabled for production) |
Docker Compose
Development (docker-compose.yml):
- Single service on port 8000
- Mounts project directory as volume
- Connects to host MySQL via
host.docker.internal
Production (docker-compose.prod.yml):
- Production-specific overrides
Environment Configuration
Production Env Vars
In addition to the standard .env variables, production requires:
APP_ENV=productionAPP_DEBUG=falseAPP_URLset to production domain- All third-party service credentials (HubSpot, Twilio, etc.)
SENTRY_LARAVEL_DSNfor error trackingUSA=trueorUSA=falsefor region configuration
OPcache
Production uses OPcache with validate_timestamps=0 for performance. This means code changes require a container rebuild/restart.
AWS Copilot
The copilot/ directory suggests the application is deployed using AWS Copilot (ECS/Fargate). The deployment workflow:
- Build Docker image
- Push to ECR
- Deploy via Copilot to ECS
Region Deployments
The application is deployed as separate instances for UK and US, distinguished by the USA environment variable:
- UK deployment:
USA=false— Full feature set including bills pricing, spatial queries (MySQL 8) - US deployment:
USA=true— US-specific features, lease terms, building details, simplified bills pricing (MySQL 5.7 compatible)
Pre-Deployment Checks
Before deploying, run the full check suite:
composer checkThis runs:
vendor/bin/pest— All tests passvendor/bin/pint --test— Code style is correctvendor/bin/phpstan analyse --memory-limit=2G— No static analysis errors
Artisan Commands
Useful artisan commands for deployment/operations:
# Cache configuration for performance
php artisan config:cache
php artisan route:cache
php artisan view:cache
# Run migrations
php artisan migrate --force
# Clear caches
php artisan cache:clear
php artisan config:clear
php artisan route:clear
# List all registered routes
php artisan route:list
# List module status
php artisan module:list