Deployments
Deploy on push
Push to a branch on GitHub and its environment goes live, without a CI pipeline. A read-only deploy key and a webhook, placed in one click.
On this page
With Deploy on push, a push to a branch deploys the environment that follows it: main to production, develop to test, or whatever you choose. There is no CI pipeline to set up or keep. Brewless gets no access to your code: a job in your own Scaleway project fetches the commit with a read-only deploy key.
Deploy on push works with repositories on GitHub. GitLab, Bitbucket and Codeberg are available on request: write to hi@brewless.eu.
Tip
Want your tests to run first? Deploy from GitHub Actions instead: the same page in the console makes the workflow and a pipeline token for this one application. See Deploying from a pipeline.
How a push goes live
- You push to a branch that an environment follows.
- GitHub sends a webhook, signed with a secret of this connection. A delivery without the right signature is ignored.
- A job in your own Scaleway project fetches the commit with the deploy key, and checks that it is the newest commit of the branch. What the webhook says is not trusted: the job looks for itself.
- The commit becomes a release, built and put live like any deploy: release commands first, and the release that was live stays live when something fails.
A newer push to the same branch overtakes an older one that is still under way. A commit that is live already, or on its way, starts nothing, so a pipeline that deploys the same commit does not collide with it. A release from a push goes under "Deploy on push via" the repository, never under a name from the webhook.
Connect a repository
- In the console, open the application and choose Deploy on push.
- Under Connect a repository, give the SSH address, such as
git@github.com:acme/shop.git, and choose Connect. - Brewless makes a deploy key, which takes about a minute. It makes the key pair in memory, writes the private half straight to your own Secret Manager and forgets it; only the public half is kept.
Then the deploy key and a webhook go on the repository: with the Brewless GitHub App in one click, or by hand.
With the Brewless GitHub App
Choose Place them on your repository. GitHub asks you to sign in to the Brewless app, and to install it on the repository if it is not there yet: choose Only select repositories and pick this one. Back in the console, Brewless puts the read-only deploy key and the webhook on the repository and starts a test of the connection.
The app asks GitHub for two permissions on the repositories you install it on, and nothing more:
| Permission | What for |
|---|---|
| Administration | Adding the read-only deploy key |
| Webhooks | Adding the webhook for pushes |
It cannot read your code. Brewless places the key and the webhook with a token of the installation for this one repository, and ends that token and your sign-in token at once; neither is stored. Every change it makes on GitHub is in your audit trail. You can remove the app at any time under the repository's or organisation's Settings, GitHub Apps.
By hand
- In the repository on GitHub, open Settings, Deploy keys, Add deploy key, and paste the key the console shows. Leave Allow write access off.
- Open Settings, Webhooks, Add webhook. Paste the address the console shows, set the content type to
application/json, choose Show the secret in the console and paste it under Secret, and choose Just the push event. - Back in the console, choose Test connection.
Note
A new GitHub organisation can have deploy keys turned off. An organisation owner turns them on under the organisation's Settings, Security and quality, Deploy keys. The test of the connection says so when the key is refused.
Once the key reaches the repository and GitHub has delivered a push, the page marks Deploy on push Active, says when the last push arrived and folds the key and the webhook away. Show the key and webhook opens them again, for instance to place the webhook anew.
Choose which branch deploys what
Each environment follows one branch, and one branch deploys one environment. Set it under Which branch deploys what on the Branches tab of the Deploy on push page, or in brewless.yml:
environments:
production:
branch: main
test:
branch: develop
A branch: line takes effect with a brewless deploy by someone who may manage the application. A push never changes it, not even a push that changes this line. An environment without a branch is not deployed by pushes.
Deploy the newest commit next to a branch starts a run for the newest commit of that branch now, without a push.
What a push may change
A push deploys code. The brewless.yml in the commit may change these keys of its environment, and nothing else:
| Key | What it is |
|---|---|
web |
Sizes and bounds of the web container |
worker |
Sizes and bounds of the worker |
release |
The release commands |
variables |
Plain variables |
backup.schedule, backup.at, backup.retention |
When backups by Brewless run and how many are kept |
Anything else, such as a database, storage, a domain, backup.bucket, backup.lock or backup.destinations, edge (cache, refuse, private_origin, publish, …), firewall or realtime, needs someone who may manage the application: an owner or admin. Either of them can:
- run
brewless deploy <environment>, or - press Deploy the newest commit for the environment on the Branches tab of the Deploy on push page. The run then goes under their name and does what their
brewless deploywould: it applies the file's resources, edge and firewall, and the file becomes what later pushes are compared with.
A push is compared with what the last such deploy asked for, so deploy each environment once this way after you connected the repository. A push from the code host that changes more is refused, nothing is deployed, and the run says which keys and both ways to deploy it. Secrets never come from a push: they go to your Secret Manager with brewless env:push.
Follow a push
Deploy on push in the menu lists every push of the organisation, newest first, with a filter per application and status. Open one to see:
- every step, with how long it took, updating while the run goes on;
- the log of the build, which follows the newest lines while the image is built;
- what the end of a
brewless deploywould tell you, such as a certificate that is still on its way; - what the run cost: the jobs Deploy on push adds and the build of the release, apart.
When a push does not go live, whoever pushed gets a mail, if their address belongs to a member of the organisation. Otherwise it goes to whoever connected the repository.
What it costs
The jobs that fetch a commit run in your own Scaleway project, at Scaleway's prices for Serverless Jobs; the build of the release costs the same as with any deploy. The console estimates both at Scaleway's list prices, per run, as a total for the month above the list of pushes, and as a line of its own on the costs page. The free allowance of your Scaleway account is not subtracted, and the line is part of what Scaleway bills you already, so it is never added to the total there.
Disconnect
Disconnect, on the Settings tab of the Deploy on push page, stops pushes from deploying and deletes the private half of the deploy key from your Secret Manager. What runs keeps running. Remove the deploy key and the webhook on GitHub yourself, and the Brewless app if nothing else uses it.