Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: example of using Mercure with Traefik #789

Merged
merged 2 commits into from Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 11 additions & 9 deletions docs/hub/install.md
@@ -1,4 +1,4 @@
# Install the Mercure.rocks hub
# Install the Mercure.rocks Hub

## Managed and HA Versions

Expand Down Expand Up @@ -114,10 +114,10 @@ If you prefer to use `docker-compose` to run the Mercure.rocks hub, here's a sam

```yaml
# docker-compose.yml
version: "3.7"
version: '3'

services:
caddy:
mercure:
image: dunglas/mercure
restart: unless-stopped
environment:
Expand All @@ -128,17 +128,19 @@ services:
# Uncomment the following line to enable the development mode
#command: /usr/bin/caddy run --config /etc/caddy/Caddyfile.dev
ports:
- "80:80"
- "443:443"
- '80:80'
- '443:443'
volumes:
- caddy_data:/data
- caddy_config:/config
- mercure_data:/data
- mercure_config:/config

volumes:
caddy_data:
caddy_config:
mercure_data:
mercure_config:
```

Alternatively, you may want to [run the Mercure.rocks hub behind Traefik Proxy](traefik.md).

## Arch Linux

Mercure.rocks is available [on the AUR](https://aur.archlinux.org/packages/mercure), you can install it with your favorite AUR wrapper:
Expand Down
47 changes: 47 additions & 0 deletions docs/hub/traefik.md
@@ -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 expose a Mercure.rocks hub through Traefik:
dunglas marked this conversation as resolved.
Show resolved Hide resolved

```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.