Problem:
Dunglas Mercure just upgraded this week, and has completly change, it now use a caddy web serveur solution instead of a built-in web serveur, it seems to be very cool, but now, i can not configure my dunglas/mercure image anymore...
https://mercure.rocks/docs/UPGRADE
So the problem seems to be directly related to this update, because now, the dunglas/mercure image is built from a caddy web serveur image, and where before i could just configure my image like this:
mercure:
image: dunglas/mercure
environment:
- JWT_KEY=MySecret
- ALLOW_ANONYMOUS=1
- PUBLISH_ALLOWED_ORIGINS=http://localhost
- DEBUG=1
- CORS_ALLOWED_ORIGINS=http://localhost:8080
ports:
- 3000:80
Now it don't work anymore (Caddy is using his default caddyFile, which is set in the caddy web serveur image called by the dunglas/mercure image)
I did not succeed to configure caddy web serveur through mercure/dunglass image (configure jwt_key, cors etc...)
So i'm first wondering if there a way to configure this new image?
And then, if there's no way to configure it, i'll would like to know what is the purpose of this new USELESS mercure image if we can not configure it, and have to make our own with a correctly pre-configured caddy web server?
So, i have to apologize for my ignorance, while i'm still a noob on docker and docker compose, this update put me in panic.
Finally, i simply tried to bind a Caddyfile in the dunglass/mercure container, replacing the default file conf, and it worked!
So in my docker-compose file, mercure service is now:
mercure:
image: dunglas/mercure
volumes:
- ./back/docker/Caddyfile:/etc/caddy/Caddyfile
ports:
- 3000:80
And my Caddyfile:
# Learn how to configure the Mercure.rocks Hub on https://mercure.rocks/docs/hub/config
{
# Debug mode (disable it in production!)
debug
# HTTP/3 support
experimental_http3
}
: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:8080
# 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
}
If it can help someone!