Prerequisites
Before you begin, ensure you have the following installed:- Docker and Docker Compose
- mkcert for generating locally-trusted SSL certificates
- Basic familiarity with command line tools
Setup Process
Configure Hosts File
Add the following entry to your hosts file:Location by OS:
- Linux/macOS:
/etc/hosts - Windows:
C:\Windows\System32\drivers\etc\hosts
Generate SSL Certificates
Install and configure mkcert to generate locally-trusted development certificates:This creates certificate files that Traefik will use to serve the application over HTTPS.
Set Up Traefik Network
Create a separate Docker Compose project that runs Traefik on an external network:You’ll need a Traefik Docker Compose configuration that:
- Runs on the
traefiknetwork - Listens on ports 80 and 443
- Uses the mkcert certificates you generated
- Has the
websecureentrypoint configured
traefik network.Configure Environment Variables
Copy the example environment file and configure it:Edit The database path is configured via Docker Compose and defaults to
.env and set your desired values:/var/www/data/cfbmarblegame.db.Start the Development Server
From the project root, start the Docker Compose services:This will:
- Build the web container with development dependencies
- Enable Xdebug for debugging
- Mount the
app/directory as a volume for hot-reloading - Connect to the Traefik network
- Configure Traefik labels for HTTPS routing
Development Configuration
The local development environment usesdocker-compose.override.yml to apply development-specific settings:
Build Arguments
DEV_DEPS=1- Installs development dependencies
Environment Variables
ENABLE_PHP_DEV_CONFIG=1- Enables PHP development configurationENABLE_XDEBUG=1- Enables Xdebug for debugging
Volumes
./app/:/var/www:delegated- Mounts the app directory for live code changes
Traefik Labels
The application is configured with the following Traefik routing:- Host:
cfbmarblegame.test - Entrypoint:
websecure(HTTPS) - TLS: Enabled
Troubleshooting
Cannot access https://cfbmarblegame.test
- Verify the hosts file entry is correct
- Ensure Traefik is running and connected to the
traefiknetwork - Check that Docker Compose services are running:
docker compose ps
SSL certificate errors
- Run
mkcert -installto install the local CA - Regenerate certificates if needed:
mkcert cfbmarblegame.test - Restart your browser after installing the CA
Code changes not reflected
- Ensure the volume mount is working:
docker compose ps - Check file permissions on the
app/directory - For PHP configuration changes, restart the container:
docker compose restart web
Next Steps
Now that your local environment is set up, you can:- Run database migrations
- Run tests
- Start developing new features