Overview
SushiGo uses Docker Compose to orchestrate multiple services for development and testing. There are two main compose files:docker-compose.yml- Main development stackdocker-compose.e2e.yml- End-to-end testing stack
Development Stack
The main development stack includes six services:Services Overview
| Service | Container | Purpose | Ports |
|---|---|---|---|
| dev | dev_container | Main development environment (API + Webapp) | 5173 |
| devtest | devtest_container | Isolated testing environment | 8081, 5174 |
| nginx | nginx_proxy | Reverse proxy with SSL | 80, 443 |
| pgsql | postgres_container | PostgreSQL 15 database | 5432 |
| pgadmin | pgadmin_container | Database management UI | 5050 |
| mailhog | mailhog_container | Email testing server | 8025 |
Service Details
dev (Development Container)
Primary development environment running both Laravel API and React webapp.| Variable | Default | Description |
|---|---|---|
VITE_PORT | 5173 | Vite dev server port |
VITE_HMR_HOST | sushigo.local | Hot Module Replacement host |
VITE_API_URL | https://api.sushigo.local/api/v1 | API endpoint for webapp |
DB_HOST | pgsql | Database host |
POSTGRES_DB | mydb | Database name |
- Host
/→ Container/app(entire project) - Docker socket mounted for Docker-in-Docker operations
- Apache config mounted for custom SSL/proxy settings
devtest (Testing Container)
Isolated environment for running tests without affecting the main dev database.- Running integration tests in isolation
- Testing migrations before applying to dev
- Parallel development workflows
nginx (Reverse Proxy)
Handles SSL termination and routing for all web services.| Domain | Backend | Purpose |
|---|---|---|
sushigo.local | dev:5173 | Webapp (Vite) |
api.sushigo.local | dev:80 | API (Apache) |
devtest.sushigo.local | devtest:5173 | Webapp (test) |
devtest.api.sushigo.local | devtest:80 | API (test) |
pgsql (PostgreSQL)
PostgreSQL 15 database server with automatic initialization.| Database | Purpose | Created by |
|---|---|---|
mydb | Main development database | Docker compose |
mydb_test | PHPUnit testing database | Init script |
mydb_devtest | Isolated testing environment | Init script |
mydb_e2e | E2E testing database | E2E compose |
docker/pgsql/init-test-db.sh automatically creates test databases on first run.
Persistent Storage:
Data is stored in the pg_data Docker volume to persist across container restarts.
pgadmin (Database UI)
Web-based PostgreSQL administration tool.docker/pgadmin/servers.json.
mailhog (Email Testing)
SMTP server for capturing outgoing emails during development..env should use:
E2E Testing Stack
The E2E stack extends the main stack with Cypress testing services.test_e2e (E2E Environment)
mydb_e2e) to avoid interfering with development data.
cypress (Headless Runner)
cypress-ui (Interactive Mode)
Docker Commands
Starting Services
Stopping Services
Viewing Logs
Restarting Services
Executing Commands
Makefile Shortcuts
The project includes aMakefile with convenient shortcuts:
| Command | Description |
|---|---|
make help | Show all available commands |
make e2e-up | Start E2E container |
make e2e-down | Stop E2E container |
make e2e-restart | Restart E2E container |
make e2e-logs | View E2E logs |
make cypress-ui | Open Cypress interactive UI (VNC) |
make cypress-run | Run Cypress tests headless |
make db-seed | Run database seeders |
make ssl-info | Show SSL certificate information |
make hosts-setup | Display hosts file configuration instructions |
make chrome-clear-hsts | Instructions for clearing Chrome HSTS cache |
Network Architecture
All services communicate over a shared Docker bridge network: Service Discovery: Services reference each other by service name:- API connects to
pgsql:5432(notlocalhost:5432) - Webapp proxies API requests through nginx
- Mailhog is accessible as
mailhog:1025for SMTP
Health Checks
All critical services define health checks to ensure proper startup order:depends_on with condition: service_healthy to control startup order.
Volumes
Named Volumes
| Volume | Purpose | Data |
|---|---|---|
pg_data | PostgreSQL data | Databases, tables, indexes |
cypress-cache | Cypress binaries | Shared across E2E containers |
Bind Mounts
| Host Path | Container Path | Purpose |
|---|---|---|
./ | /app | Entire project (live reload) |
./docker/nginx/nginx.conf | /etc/nginx/nginx.conf | Nginx configuration |
./docker/app/config/dev/cert | /etc/nginx/certs | SSL certificates |
/var/run/docker.sock | /var/run/docker.sock | Docker-in-Docker access |
Troubleshooting
Services won't start
Services won't start
Database connection errors
Database connection errors
nginx SSL errors
nginx SSL errors
Stale container state
Stale container state
Next Steps
Environment Setup
Initial setup and VS Code configuration
Testing
Run tests across all environments