Skip to content

Commit

Permalink
docs: example of using Mercure with Traefik
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Jul 29, 2023
1 parent e27e613 commit e5b36de
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 9 deletions.
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:

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

0 comments on commit e5b36de

Please sign in to comment.