This project sets up a local development environment with multiple subdomains using Traefik as a reverse proxy and vcap.me for local domain resolution.
- Local development with subdomains (e.g., app1.vcap.me, app2.vcap.me)
- Easy switching between development and production environments
- Automatic SSL certificate management (when configured for production)
- Simple Makefile commands for common tasks
- Docker and Docker Compose installed
- Make utility (usually pre-installed on Linux/macOS)
- Clone this repository
- Start the development environment:
make dev
- Access your services at:
make dev
- Start development environment (uses .env.dev)make prod
- Start production environment (uses .env.prod)make stop
- Stop all servicesmake status
- Check service status
.env.dev
- Development environment variables.env.prod
- Production environment variablesdocker-compose.yml
- Main Docker Compose configuration
- Add a new service to
docker-compose.yml
- Add the appropriate Traefik labels for routing
- Update the environment files with the new domain
- Restart the services
This project includes Ansible tests to verify the subdomain configuration. The tests check if all configured subdomains are accessible and return the expected HTTP status code.
- Ansible 2.9 or later
- Python 3.6 or later
-
Install the test dependencies:
pip install -r tests/ansible/requirements.txt
-
Make sure your services are running:
make dev
-
Run the Ansible tests:
cd tests/ansible ansible-playbook playbook.yml
You can modify the test configuration in tests/ansible/playbook.yml
:
vars:
test_domains:
- "app1.vcap.me"
- "app2.vcap.me"
expected_status: 200
If domains don't resolve, try these solutions:
-
For vcap.me/localhost resolution issues:
- Ensure your
/etc/hosts
includes:127.0.0.1 app1.vcap.me app2.vcap.me
- Ensure your
-
DNS Rebinding Protection: If your network blocks resolving domains like vcap.me:
- Check your router settings for "DNS rebinding protection" and disable it if needed
- Try using alternative DNS servers like Cloudflare (1.1.1.1) or Google DNS (8.8.8.8)
- Configure a custom domain with a wildcard A record pointing to 127.0.0.1
-
Service Logs:
docker-compose logs <service_name>
For the best development experience, we recommend using localtest.me
with environment variables because:
✅ No docker-compose.yml modifications needed - All changes are in .env
files
✅ No hosts file editing required - localtest.me works out of the box
✅ Identical domain structure - Use the same URL structure across environments
✅ Quick setup - Just update the .env
file
✅ Subdomain support - Wildcard subdomains work automatically
# Development
cp .env.dev .env
docker-compose up -d
# Production
cp .env.prod .env
docker-compose up -d
This approach offers maximum flexibility with minimal configuration complexity and requires no modifications to the main docker-compose.yml
file.