Back to articles
Deploying Mercure alongside Caddy on a shared VPS
How-ToDevOps

Deploying Mercure alongside Caddy on a shared VPS

via Dev.toRussell Jones

Ahnii! Mercure is a real-time push protocol built on server-sent events (SSE). It ships as a standalone binary that embeds its own Caddy server. If you already run Caddy as your web server, you now have two Caddy processes fighting over ports. This post covers how to deploy both on the same VPS using Ansible , with solutions for every gotcha that came up. Prerequisites A VPS with Caddy already serving your sites Ansible for deployment automation The Mercure binary installed on the server A domain with DNS pointed at your VPS Resolving the port conflict Mercure's embedded Caddy wants to bind to port 443 and run its own admin API on port 2019. Your main Caddy already owns both. The fix is to disable auto-HTTPS on Mercure and bind it to a localhost-only port: { auto_https off admin localhost:2039 } http://localhost:3080 { mercure { publisher_jwt {env.MERCURE_JWT_SECRET} subscriber_jwt {env.MERCURE_JWT_SECRET} cors_origins https://minoo.live publish_origins * anonymous } respond /healthz 2

Continue reading on Dev.to

Opens in a new tab

Read Full Article
5 views

Related Articles