Deploy caddy based executable on Scalingo PaaS
Following up https://github.com/dunglas/mercure/issues/52 and https://github.com/dunglas/mercure/pull/92 :
I'm trying to deploy mercure on Scalingo, a Heruko like PaaS. The issue is that the legacy binary seems to be used when executing the application.
I can see in the logs the following messages :
/!\ This Mercure binary is deprecated, use the binary based on Caddy Server instead! See https://mercure.rocks/docs/UPGRADE
How to make use of the new caddy based executable on Scalingo ? I tried using PROJECT_DIR variable to build the new executable but with no luck yet (https://doc.scalingo.com/platform/getting-started/common-deployment-errors)
Where do you download the binary from?
Here is the log of a deployment on Scalingo :
<-- Start deployment of mercure -->
Fetching source code
Fetching deployment cache
-----> Fetching stdlib.sh.v8... done
----->
Detected go modules via go.mod
----->
Detected Module Name: github.com/dunglas/mercure
----->
-----> Using go1.24.0
-----> Determining packages to install
Detected the following main packages to install:
github.com/dunglas/mercure/cmd/mercure
-----> Running: go install -v -tags heroku github.com/dunglas/mercure/cmd/mercure
github.com/dunglas/mercure/common
github.com/dunglas/mercure
github.com/dunglas/mercure/cmd
github.com/dunglas/mercure/cmd/mercure
Installed the following binaries:
./bin/mercure
Build complete, shipping your container...
Waiting for your application to boot...
We can see that Scalingo uses the cmd/mercure executable to build. And here is the Procfile I use for now :
web: ADDR=":${PORT}" mercure --debug="${MERCURE_DEBUG}" --allow-anonymous --jwt-key="${MERCURE_SUBSCRIBER_JWT_KEY}" --cors-allowed-origins="${MERCURE_CORS_ALLOWED_ORIGIN}" --publish-allowed-origins="${MERCURE_PUBLISH_ALLOWED_ORIGINS}" --write-timeout 1800s --heartbeat-interval 20s
For information, some messages seems to be lost when using the legacy executable of Mercure. We're switching to a small server where we will deploy the Mercure docker image directly, it will be simpler.