Skip to main content
A Gleam web server runs on Sevalla as an application: Sevalla builds an image from your Git repository, compiles your project to Erlang bytecode with gleam export erlang-shipment, and runs it on the Erlang virtual machine (the BEAM) as processes. The web process runs the main function of your project, background workers and cron jobs can run other modules of the same project, and jobs run migrations before each deployment.

Framework guides

Wisp

Deploy a Wisp JSON API on Mist, with a secret key and a graceful shutdown on Erlang/OTP 29.

How Gleam applications run on Sevalla

Every process (web, worker, cron job and job) runs from the same image, each with its own start command. Sevalla runs a custom start command with /bin/sh -l -c, which expands /app/*/ebin to every package’s folder, and exec makes the BEAM receive SIGTERM. See Processes for every process type and its settings.

Pin the Gleam version

Ingot builds with the newest Gleam release it knows, 1.19.2 with Ingot v0.4.1, unless the project asks for another. Gleam publishes its images for exact releases, so a new Ingot release moves the build to the newest Gleam release, and to the Erlang/OTP release that Gleam’s image comes with. Ingot takes the version from the first of these that’s set:
  1. The INGOT_GLEAM_VERSION environment variable, marked Available during buildtime, or versions.gleam in ingot.json.
  2. The gleam line of .tool-versions, then mise’s configuration, in the build path or a folder above it up to the repository root.
  3. The gleam requirement in gleam.toml, such as gleam = ">= 1.19.0", which the Gleam compiler also checks. Clauses join with and; a requirement with or fails the build.
How Ingot reads the version:
  • A requirement, such as >= 1.19.0 in gleam.toml, builds with the newest release Ingot knows that meets it. The build plan’s Gleam row shows 1, the line, and where the requirement came from.
  • An exact release, such as gleam 1.19.2 in .tool-versions, stays on that release, and the build log warns that its image won’t receive security rebuilds.
  • A release newer than every one Ingot knows fails the build, for example gleam.toml gleam: no gleam version in this Ingot release satisfies ">= 1.30.0" (newest known: 1.19.2).
See Set the language version.

Build with a Dockerfile

Ingot needs no Dockerfile, but you can write your own for full control of the image. A Dockerfile for Gleam on Sevalla builds in the Gleam team’s ghcr.io/gleam-lang/gleam image of the release you develop with, copies gleam.toml and manifest.toml and runs gleam deps download before it copies the code, so a code change reuses the downloaded packages, then runs gleam export erlang-shipment. The final stage copies only the shipment into the slim official erlang image of the same Erlang/OTP release, sets LANG=C.UTF-8, runs as a user other than root, and starts entrypoint.sh, which replaces itself with the BEAM: it handles SIGTERM itself, so it needs no init process. See Deploy a Wisp application.