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

feat: update Mercure docs #1608

Merged
merged 6 commits into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Symfony provides a straightforward component, built on top of the [Mercure](http

## Setup hub

There are different ways to set up Mercure as listed below:
There are different ways to set up Mercure; we choose the quickest and easiest for you below:

### Setup via Stackhero (Recommended)

Expand All @@ -34,69 +34,11 @@ There are different ways to set up Mercure as listed below:

### Setup via Docker

The docker image can be found at [dunglas/mercure](https://hub.docker.com/r/dunglas/mercure). It allows you to use the following *env* variables to configure Mercure.

::: warning
Use different publisher and subscriber keys for security reasons.
For security reasons, use different publisher and subscriber keys in production mode.
:::

```txt
- MERCURE_PUBLISHER_JWT_KEY: your-256-bit-publisher-key
- MERCURE_SUBSCRIBER_JWT_KEY: your-256-bit-subscriber-key
- MERCURE_EXTRA_DIRECTIVES: |-
cors_origins "https://my-pwa-shop.com https://en.my-pwa-shop.com"
anonymous 0
ui 1
```

You can also configure it like the self-installed version via the Caddyfile.

```txt
// Sample Caddyfile
{
# Debug mode (disable it in production!)
debug
# HTTP/3 support
}
:80
log
route {
redir / /.well-known/mercure/ui/
encode gzip
mercure {
# Enable the demo endpoint (disable it in production!)
demo
# Publisher JWT key
publisher_jwt MySecret
# Subscriber JWT key
subscriber_jwt MySecret
# CORS
cors_origins http://localhost:3000 http://localhost:8080 http://shopware.test http://7779-91-90-160-158.ngrok.io
publish_origins localhost:3000 localhost:8080 shopware.test 7779-91-90-160-158.ngrok.io
# Allow anonymous subscribers (double-check that it's what you want)
anonymous
# Enable the subscription API (double-check that it's what you want)
subscriptions
}
respond "Not Found" 404
}
```

### Self-host setup

The [installation guide](https://mercure.rocks/docs/hub/install) explains all the steps that are required for installing the Mercure.

```txt
mercure {
...
publisher_jwt my-publisher-key HS256
subscriber_jwt my-subscriber-key HS256
cors_origins "https://my-pwa-shop.com https://en.my-pwa-shop.com"
demo 0
ui 0
...
}
```
You can clone our [local-mercure-sample](https://github.com/shopware/local-mercure-sample) and run it with docker-compose.

## Config Mercure hub

Expand Down
Loading