37 lines
1.2 KiB
Markdown
37 lines
1.2 KiB
Markdown
# Dev Proxy with Traefik
|
|
|
|
This project sets up a local development environment with Traefik as a reverse proxy.
|
|
|
|
## What is Traefik?
|
|
|
|
Traefik is a modern reverse proxy and load balancer that automatically discovers your services and configures itself accordingly. This makes it perfect for containerized environments.
|
|
|
|
## Getting Started
|
|
|
|
1. Ensure Docker and Docker Compose are installed on your system
|
|
2. Start the services:
|
|
```
|
|
docker-compose up -d
|
|
```
|
|
3. Access the Traefik dashboard at: http://traefik.localhost:8080
|
|
4. Access the example app at: http://app.localhost
|
|
|
|
## Configuration
|
|
|
|
The main configuration is in the `docker-compose.yml` file and additional Traefik configuration is in the `traefik/config/` directory.
|
|
|
|
To add a new service to be proxied by Traefik:
|
|
|
|
1. Add a new service to the docker-compose.yml
|
|
2. Add the appropriate Traefik labels to the service
|
|
3. Restart the containers with `docker-compose up -d`
|
|
|
|
## Example Labels
|
|
|
|
```yaml
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.myservice.rule=Host(`myservice.localhost`)"
|
|
- "traefik.http.routers.myservice.entrypoints=web"
|
|
- "traefik.http.services.myservice.loadbalancer.server.port=8080"
|
|
``` |