Brewless Brewless Docs

Running your application

Private origin

Let Scaleway refuse every request to your web container that did not come through the edge, before the container wakes for it.

On this page

Your web container has an address of its own at Scaleway (….functions.fnc.<region>.scw.cloud), and your test address points straight at it. Crawlers find both and ask them now and then. Nothing keeps a page there, so every such request wakes the container, and a container that is woken every few minutes never scales to zero. The edge secret does not help with that: your application can only refuse a request once its container is awake.

Scaleway can refuse it sooner. A container whose privacy is private is only called with a token in the X-Auth-Token header; Scaleway answers any other request with a 403 itself, and the container does not start for it.

brewless.yml
environments:
  production:
    edge:
      private_origin: true

It is off unless the file says so.

What a deploy does

With edge.private_origin: true, a deploy does this after the release is live, in an order that never leaves your site without a way in:

  1. It makes an identity in your Scaleway organisation, brewless-<application>-<environment>-origin, that may call the private containers of the application's project and nothing else (ContainersPrivateAccess), and a key for it. The secret key of that key is the token. It is kept in your own Secret Manager as <application>-<environment>-origin-token, and made once: the next deploy uses the same one.
  2. It gives the pull zone the edge rule brewless: origin token, which adds the token to every request the edge sends your container, and waits two minutes for the rule to reach every edge server. While the container is still public the token is simply ignored, so this changes nothing yet.
  3. Only then it makes the web container private, and asks its health route the way the edge does, with the token. When the container keeps refusing for two minutes, it is made public again and the deploy says so: the site keeps answering, and the next deploy tries again.

A deploy whose file no longer says private_origin: true goes the other way: the web container is made public first, and only then is the rule taken off the pull zone. A deploy without a brewless.yml keeps what the last one asked. The identity and its kept key stay, so turning it on again needs no new one. Each change is written to the audit trail; the token never is.

Brewless only undoes what it did. A web container you made private yourself, without the rule at the edge, is left as it is.

What it needs

  • An edge. Without a pull zone nothing would send the token; the container stays public and the deploy says why.
  • A Scaleway key that may manage identities (IAMManager), as for the other identities Brewless makes. Without it the container stays public and the deploy says so.
  • No mail through Scaleway. Scaleway reports what became of a mail to your web container's own address and cannot send a token along. The file is refused with mail: scaleway, and an environment whose mail events go to the web container is not made private. Lettermint is not affected.

What changes

  • Your test address stops answering. It points straight at the container, so a browser gets Scaleway's 403. Open the site on your own domain or on the address of the edge (<pull zone>.b-cdn.net) instead. The container's own address answers 403 too, which is the point.
  • Only the web container. The release and worker containers keep their own addresses and stay public: the release commands, the queue (a trigger calls the worker with POST /) and the scheduler reach them as before.
  • Brewless still reaches it. Every call Brewless makes straight to a container, such as the health check of a release, adds the token when that container is private. A private web container whose token is gone is not given a new release, because it would refuse every visitor too.
  • The edge's own requests, including the warm-up after a release, carry the token through the rule, as visitors' do.

How strong it is

The token lets anyone who has it call every private container of the application's project, and nothing else at Scaleway. Like the edge secret it sits in a rule of your pull zone, where anyone with the bunny.net key of your account can read it. To take it away, delete the key of the identity in the Scaleway console: Scaleway then refuses the edge as well, so make the container public first.