-
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: example of using Mercure with Traefik (#789)
* docs: example of using Mercure with Traefik * Update docs/hub/traefik.md Co-authored-by: Jacob Dreesen <jacob@hdreesen.de> --------- Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
- Loading branch information
Showing
2 changed files
with
58 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Use the Mercure.rocks Hub with Traefik Proxy | ||
|
||
[Traefik](https://doc.traefik.io/traefik/) is a free and open source *edge router* poular in the Docker and Kubernetes ecosystems. | ||
|
||
The following Docker Compose file exposes a Mercure.rocks hub through Traefik: | ||
|
||
```yaml | ||
# docker-compose.yml | ||
version: '3' | ||
|
||
services: | ||
reverse-proxy: | ||
# The official v2 Traefik image | ||
image: traefik:v2.10 | ||
command: --api.insecure=true --providers.docker | ||
ports: | ||
# The HTTP port | ||
- '80:80' | ||
# The Web UI (enabled by --api.insecure=true) | ||
- '8080:8080' | ||
volumes: | ||
# So that Traefik can listen to the Docker events | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
|
||
mercure: | ||
# The official Mercure image | ||
image: dunglas/mercure | ||
restart: unless-stopped | ||
environment: | ||
# Disables Mercure.rocks auto-HTTPS feature, HTTPS must be handled at edge by Traefik or another proxy in front of it | ||
SERVER_NAME: ':80' | ||
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!' | ||
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!' | ||
# Enables the development mode, comment the following line to run the hub in prod mode | ||
command: /usr/bin/caddy run --config /etc/caddy/Caddyfile.dev | ||
volumes: | ||
- mercure_data:/data | ||
- mercure_config:/config | ||
labels: | ||
- "traefik.http.routers.mercure.rule=Host(`mercure.docker.localhost`)" | ||
|
||
volumes: | ||
mercure_data: | ||
mercure_config: | ||
``` | ||
|
||
Refer to the Traefik Proxy documentation to learn about all features provided by Traefik. |