# Build Environment

> Where Potions builds your release, which system packages are installed, and how native dependencies (NIFs) work.

Potions builds your release on a dedicated build server, never on your own server, then uploads it to your server. This page covers what that build environment contains, so you know which dependencies build without extra setup.

## Operating System

Builds run on **Ubuntu 24.04 LTS (x86_64)**, the same operating system as every server Potions manages, including [servers you bring yourself](/docs/bring-your-own-server). Because the build and your server match, native code compiled during the build runs on your server.

Erlang, Elixir and Node.js are installed at the versions selected in your app's **Settings**.

## Installed Packages

Every build has these system packages:

| Package | What it's for |
|---------|---------------|
| `build-essential` | gcc, g++, make and C library headers, for dependencies that compile C or C++ |
| `cmake` | Dependencies that build with CMake, such as `rocksdb` |
| `pkg-config` | Build scripts that look up system libraries |
| `autoconf`, `m4` | Build scripts generated with Autotools |
| `libssl-dev` | OpenSSL headers |
| `libzstd-dev` | Zstandard compression headers, used by `rocksdb` |
| `libncurses-dev` | ncurses headers |
| `unixodbc-dev` | ODBC headers |
| `xsltproc`, `fop` | XSLT and PDF tools some documentation builds use |
| `git`, `curl`, `openssh-client`, `ca-certificates` | Fetching your code and its dependencies |
| `inotify-tools` | File watching for build tools that expect it |

## Native Dependencies (NIFs)

Most dependencies with native code need nothing extra:

- **Precompiled packages** download a ready-made binary for Linux x86_64. Examples: `exqlite`, `vix`, `explorer`, `tokenizers`.
- **Packages that bundle their C sources** compile them with `build-essential`. Examples: `bcrypt_elixir`, `argon2_elixir`, `jiffy`.
- **Packages that build with CMake**, such as `rocksdb` (used by `barrel_docdb`), use the `cmake` and `libzstd-dev` above.

### Libraries on your server

A NIF can link a system library dynamically, and then that library has to be on your server when the app starts, not just on the build server. OpenSSL (`libssl3t64`) and Zstandard (`libzstd1`) come with every Ubuntu 24.04 server, so NIFs that use the packages above load without extra setup.

If a dependency needs a library that isn't part of a standard Ubuntu install, add it on your server's **Packages** tab if it's listed there, or [connect over SSH](/docs/ssh-keys) and install it with `sudo apt-get install`. When a library is missing, the NIF fails to load with an error naming the missing `.so` file.

## Need Another Package?

[Contact us](/contact) with the package name and the dependency that needs it. Build servers are shared by every app, so we add packages for everyone rather than per app: some dependencies link whatever libraries they find during the build, and a package installed for one app could change what another app's build produces. Before adding one, we check that the library it builds against is available on every Ubuntu 24.04 server.

## Build Time and Caching

A dependency that compiles native code from source makes your first build slower. `rocksdb`, for example, compiles a full database engine and can add 10 minutes or more. Potions caches your app's dependencies and build artifacts on the build server, so later builds reuse the compiled code. A build can land on a different build server, which compiles it once more there.

A long build is fine as long as it keeps printing output: a build fails after 15 minutes with no output, and a deploy fails if it's still running after 45 minutes. The exception is the Fly.io fallback, used when no build server is available: it has no cache, and the whole build must finish within 15 minutes. See [Build timeout](/docs/troubleshooting-deploys#build-timeout).
