diff --git a/.env b/.env index cc23653bd..d6fc80347 100644 --- a/.env +++ b/.env @@ -16,9 +16,6 @@ APP_ENV=prod APP_SECRET=!ChangeMeInAppEnv! ###< symfony/framework-bundle ### -## Wopi server for editing documents online -EDITOR_SERVER=http://collabora:9980 - # must be manually set in .env.local # ADMIN_PASSWORD= @@ -92,3 +89,13 @@ REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT} ###> symfony/ovh-cloud-notifier ### # OVHCLOUD_DSN=ovhcloud://APPLICATION_KEY:APPLICATION_SECRET@default?consumer_key=CONSUMER_KEY&service_name=SERVICE_NAME ###< symfony/ovh-cloud-notifier ### + +###> symfony/mercure-bundle ### +# See https://symfony.com/doc/current/mercure.html#configuration +# The URL of the Mercure hub, used by the app to publish updates (can be a local URL) +MERCURE_URL=https://example.com/.well-known/mercure +# The public URL of the Mercure hub, used by the browser to connect +MERCURE_PUBLIC_URL=https://example.com/.well-known/mercure +# The secret used to sign the JWTs +MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!" +###< symfony/mercure-bundle ### diff --git a/compose.override.yaml b/compose.override.yaml index 01169fbf0..ae167cac1 100644 --- a/compose.override.yaml +++ b/compose.override.yaml @@ -32,3 +32,9 @@ services: hostname: my-rabbit volumes: - ./docker/rabbitmq/data:/var/lib/rabbitmq + + ###> symfony/mercure-bundle ### + mercure: + ports: + - "127.0.0.1:8080:80" +###< symfony/mercure-bundle ### diff --git a/compose.yaml b/compose.yaml index 920f2e1b9..1675a7cff 100644 --- a/compose.yaml +++ b/compose.yaml @@ -50,7 +50,36 @@ services: timeout: 30s retries: 3 + ###> symfony/mercure-bundle ### + mercure: + image: dunglas/mercure + restart: unless-stopped + environment: + # Uncomment the following line to disable HTTPS, + #SERVER_NAME: ':80' + MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!' + MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!' + # Set the URL of your Symfony project (without trailing slash!) as value of the cors_origins directive + MERCURE_EXTRA_DIRECTIVES: | + cors_origins http://127.0.0.1:8000 + # Comment the following line to disable the development mode + command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile + healthcheck: + test: [ "CMD", "curl", "-f", "https://localhost/healthz" ] + timeout: 5s + retries: 5 + start_period: 60s + volumes: + - mercure_data:/data + - mercure_config:/config +###< symfony/mercure-bundle ### + volumes: ###> doctrine/doctrine-bundle ### database_data: -###< doctrine/doctrine-bundle ### + ###< doctrine/doctrine-bundle ### + + ###> symfony/mercure-bundle ### + mercure_data: + mercure_config: +###< symfony/mercure-bundle ### diff --git a/composer.json b/composer.json index 94338ce42..ead636a25 100644 --- a/composer.json +++ b/composer.json @@ -55,6 +55,7 @@ "symfony/http-foundation": "^5.4", "symfony/intl": "^5.4", "symfony/mailer": "^5.4", + "symfony/mercure-bundle": "^0.3.9", "symfony/messenger": "^5.4", "symfony/mime": "^5.4", "symfony/monolog-bundle": "^3.5", diff --git a/config/bundles.php b/config/bundles.php index 2eb99868b..44dddbe47 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -38,4 +38,5 @@ return [ Chill\TicketBundle\ChillTicketBundle::class => ['all' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], Symfony\UX\Translator\UxTranslatorBundle::class => ['all' => true], + Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true], ]; diff --git a/config/packages/mercure.yaml b/config/packages/mercure.yaml new file mode 100644 index 000000000..f2a739540 --- /dev/null +++ b/config/packages/mercure.yaml @@ -0,0 +1,8 @@ +mercure: + hubs: + default: + url: '%env(MERCURE_URL)%' + public_url: '%env(MERCURE_PUBLIC_URL)%' + jwt: + secret: '%env(MERCURE_JWT_SECRET)%' + publish: '*' diff --git a/package.json b/package.json index ccabc5c25..c84674df9 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "@hotwired/stimulus": "^3.0.0", "@luminateone/eslint-baseline": "^1.0.9", "@symfony/stimulus-bridge": "^3.2.0", + "@symfony/ux-translator": "file:vendor/symfony/ux-translator/assets", "@symfony/webpack-encore": "^4.1.0", "@tsconfig/node20": "^20.1.4", "@types/dompurify": "^3.0.5", diff --git a/symfony.lock b/symfony.lock index 6409f0c1d..3572b5425 100644 --- a/symfony.lock +++ b/symfony.lock @@ -281,6 +281,18 @@ "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f" } }, + "symfony/mercure-bundle": { + "version": "0.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "0.3", + "ref": "528285147494380298f8f991ee8c47abebaf79db" + }, + "files": [ + "config/packages/mercure.yaml" + ] + }, "symfony/messenger": { "version": "5.4", "recipe": {