Skip to content

Commit 1942af6

Browse files
authored
feat: compat with MercureBundle 0.3 (#128)
* feat: compat with MercureBundle 0.3 * fix: review
1 parent 24b9c90 commit 1942af6

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

docker-compose.prod.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ services:
66
environment:
77
APP_ENV: prod
88
APP_SECRET: ${APP_SECRET}
9+
MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET}
910

1011
caddy:
1112
environment:
12-
MERCURE_PUBLISHER_JWT_KEY: ${MERCURE_PUBLISHER_JWT_KEY}
13-
MERCURE_SUBSCRIBER_JWT_KEY: ${MERCURE_SUBSCRIBER_JWT_KEY}
13+
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
14+
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}

docker-compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ services:
2020
# Run "composer require symfony/orm-pack" to install and configure Doctrine ORM
2121
DATABASE_URL: postgresql://${POSTGRES_USER:-symfony}:${POSTGRES_PASSWORD:-ChangeMe}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-13}
2222
# Run "composer require symfony/mercure-bundle" to install and configure the Mercure integration
23-
MERCURE_PUBLISH_URL: ${MERCURE_URL:-http://caddy/.well-known/mercure}
23+
MERCURE_URL: ${CADDY_MERCURE_URL:-http://caddy/.well-known/mercure}
24+
MERCURE_PUBLIC_URL: https://${SERVER_NAME:-localhost}/.well-known/mercure
25+
MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
2426
SYMFONY_VERSION:
2527

2628
caddy:
@@ -31,8 +33,8 @@ services:
3133
- php
3234
environment:
3335
SERVER_NAME: ${SERVER_NAME:-localhost, caddy:80}
34-
MERCURE_PUBLISHER_JWT_KEY: ${MERCURE_PUBLISHER_JWT_KEY:-!ChangeMe!}
35-
MERCURE_SUBSCRIBER_JWT_KEY: ${MERCURE_SUBSCRIBER_JWT_KEY:-!ChangeMe!}
36+
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
37+
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
3638
restart: unless-stopped
3739
volumes:
3840
- php_socket:/var/run/php

docs/production.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,11 @@ Go into the directory containing your project (`<project-name>`), and start the
6565
```console
6666
SERVER_NAME=your-domain-name.example.com \
6767
APP_SECRET=ChangeMe \
68-
MERCURE_PUBLISHER_JWT_KEY=ChangeMe \
69-
MERCURE_SUBSCRIBER_JWT_KEY=ChangeMe \
68+
CADDY_MERCURE_JWT_SECRET=ChangeMe \
7069
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
7170
```
7271

73-
Be sure to replace `your-domain-name.example.com` by your actual domain name and to set the values of `APP_SECRET`, `MERCURE_PUBLISHER_JWT_KEY` and `MERCURE_SUBSCRIBER_JWT_KEY` to cryptographically secure random values.
72+
Be sure to replace `your-domain-name.example.com` by your actual domain name and to set the values of `APP_SECRET`, `CADDY_MERCURE_JWT_SECRET` to cryptographically secure random values.
7473

7574
Your server is up and running, and a Let's Encrypt HTTPS certificate has been automatically generated for you.
7675
Go to `https://your-domain-name.example.com` and enjoy!
@@ -82,9 +81,8 @@ Alternatively, if you don't want to expose an HTTPS server but only an HTTP one,
8281
```console
8382
SERVER_NAME=:80 \
8483
APP_SECRET=ChangeMe \
85-
MERCURE_PUBLISHER_JWT_KEY=ChangeMe \
86-
MERCURE_SUBSCRIBER_JWT_KEY=ChangeMe \
87-
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
84+
CADDY_MERCURE_JWT_SECRET=ChangeMe \
85+
-docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
8886
```
8987

9088
## Deploying on Multiple Nodes

0 commit comments

Comments
 (0)