Zaroz
Git builds

Git builds: from your repository to a running service

With git builds you do not build an image yourself. You connect a repository, and Zaroz builds it and runs it. Every time you push, the service updates.

The short path

  1. Create a service and choose Where is your code?. Pick GitHub, GitLab or Forgejo or Gitea. See Connect a repository.
  2. Choose the repository and the branch. Zaroz looks at your files and says what it found: a Dockerfile, or a language such as Node or Python.
  3. Start the first build. You can follow it live in the Builds tab.
  4. When the build succeeds, the new version goes online.

You do not need a configuration file. Zaroz works out how to build most apps by itself. If you want to control the build, add a zaroz.toml file.

What the build does

A build takes the files of one commit, turns them into an image and saves the image. Then the service deploys that image.

  • If the repository has a Dockerfile, Zaroz uses it. Otherwise it works out the build from your code. See How builds are detected.
  • Your build secrets, such as a private registry token, are available while the build runs. They are never in the image. See Build secrets.
  • If you set a pre-deploy command, it runs from the new image before the service switches over. A common use is a database migration.
  • The service switches to the new version only when it answers its health check. If it does not, the version that was running keeps running.

A build is always tied to one commit. Zaroz does not build a branch name, it builds the commit that the branch pointed at.

What starts a build

TriggerWhen
PushYou push to the branch the service follows.
TagYou push a tag that matches the pattern you set.
By handYou choose Build now in the Builds tab.
Deploy hookSomething calls the service's private deploy hook URL, such as a step in your CI.
APIA program starts a build with an API token that is allowed to deploy the service.
Retry or rebuildYou retry a failed build, or rebuild a commit.

The rules are in the Source tab, under When it builds and deploys:

  • Pushes to a branch, Tags matching a pattern, or only when you start a build.
  • Deploy each build. On by default. A build that succeeds goes live on its own. When it is off, each successful build waits until you choose Deploy this build.
  • Wait for checks. Off by default. The build runs right away, but it deploys only after the other checks on the commit pass.
  • Read zaroz.toml. On by default. See zaroz.toml.

One build at a time per service. If you push twice quickly, the second build waits, and a newer push replaces a build that is still waiting (it shows as Replaced by a newer build). A build that is already running is never cancelled by a newer push. A build never rolls a service back to an older commit.

Seeing the result

Each build has a page with its log, its status, the commit, the builder size and the minutes it used. The statuses are Queued, Starting, Cloning, Preparing, Building, Pushing and then Succeeded, Failed, Canceled, Replaced by a newer build, Expired in the queue or Skipped. A build that waits in the queue for more than 6 hours expires.

Zaroz also reports on the commit in your git provider. On GitHub it adds a check named Zaroz: your service. On GitLab and Forgejo it sets a status named zaroz/your-service.

Logs are kept for 30 days.

When a build fails

The build page explains the failure in a sentence and links to Troubleshooting. Each failure has its own section there.

Go deeper

Good to know

  • You can connect a git account once and use it for every project in the organization.
  • Services that were built from a repository keep running if you remove the connection. New commits stop building.
  • A service has these limits, among others. Some can be different for your organization.
LimitValue
Builds running at once, per organization2
Builds waiting, per organization20
Build time limit20 minutes by default, 5 to 60
Image size10 GiB, compressed
Build secrets50 per service, 64 KiB each
Deploy hooks3 per service

New organizations can have lower limits at first.

Last modified on