Skip to main content
This page takes you from a fresh Linux host to a signed-in Earnie. It applies when you host Earnie yourself, in the self-hosted Earnie or fully on-premises option. See Deployment options. Earnie runs on one server with Docker Compose. You run one script, install.sh. It asks for the few values it can’t work out, writes the configuration file tenant.env, and starts Earnie. The steps are:
  1. Check you have everything in Before You Begin, then see What SCANOSS Gives You.
  2. Prepare the host: Docker, a data volume, your certificate and database if you bring them, and the bundle.
  3. Install: answer the installer’s questions, check that Earnie is healthy, and sign in.
  4. Optionally, set up single sign-on and connect your Git server.
To upgrade or back up later, see Upgrading and backing up.

Before You Begin

You need:
  • A server that meets the Self-hosting requirements.
  • A DNS name for Earnie, such as earnie.example.com, pointing at the server.
  • A PostgreSQL 16 database, or the server’s own disk space to run one as a container.
  • A TLS certificate for that DNS name, unless Earnie can get one from Let’s Encrypt. See TLS certificate.
  • A user on the server that can use sudo. You add it to the docker group when you prepare the host.
  • Internet access from the server.

What SCANOSS Gives You

SCANOSS sends you a SCANOSS API key. Earnie uses it to match your code against the SCANOSS knowledge base. There is nothing else to get from SCANOSS. One command installs the newest release:
You run the command when you prepare the host, after the data volume, certificate, and database are in place.

Prepare the Host

On AWS, Google Cloud, Azure, or DigitalOcean, see Running Earnie on a cloud provider for the machine, disk, and network to choose.
  1. Install Docker. Install Docker Engine 29 or later and the Docker Compose plugin from Docker’s own repository, as described in Install Docker Engine for your distribution. The package in your distribution’s own repository is too old: the installer refuses it, and the cryptography sandbox doesn’t work on it. Check the versions:
    Then let your user run Docker without sudo, and sign out and back in for it to take effect:
  2. Give the data directory its own volume. Earnie keeps everything that must survive the host under one directory, /var/lib/earnie by default. It holds scan archives, caches, certificates, and the bundled database if you use it. Mount a volume of 50 GB or more there before you install. The installer stops if it has under 10 GiB free. To use another path, set EARNIE_DATA_DIR before the first run. See Other settings. For example, for a new, empty disk that the server sees as /dev/sdb:
    Check the disk’s name with lsblk first: formatting the wrong disk erases it. A new ext4 file system has a lost+found directory. Leave it there.
  3. Put your certificate in place, if you bring one. If Earnie can’t get a certificate from Let’s Encrypt, create /var/lib/earnie/tls and put cert.pem and key.pem there before you install. The installer uses them when both are there, and Let’s Encrypt otherwise. See Your own certificate.
  4. Decide where the database runs. The installer runs PostgreSQL as a container on this server unless you give it your own. To use your own PostgreSQL 16 server, create an empty database and a user that owns it, and have its connection URL ready. See Own PostgreSQL.
  5. Get the bundle. The bundle extracts to its own directory, earnie-vX.Y.Z. That is the bundle directory: run every command on this page from it. Run the installer command from the directory where you want Earnie’s files, such as /opt/earnie. It extracts the bundle, pulls the images, and goes straight on to the installer’s questions. See Install.

Install

Run the installer from the bundle directory. On the first run it asks six questions, listed in What the installer asks, and starts Earnie. Later runs ask nothing. The installer command from Prepare the host runs install.sh for you. If it ended with ready. Next: cd earnie-vX.Y.Z && ./install.sh instead, because it ran without a terminal, run that:
The installer pulls any image it is missing from ghcr.io and Docker Hub. Neither needs a sign-in.
AI provenance isn’t available for self-hosted installations yet. See Scanners.

What the Installer Asks

The installer checks the host first: Docker Engine 29 or later, the Compose plugin, and access to the Docker daemon. If a check fails, it stops and says what to fix. Free disk space, 10 GiB on the data directory, is checked after the questions. On the first run, it creates tenant.env from tenant.env.example and asks for what it can’t work out: An answer that doesn’t fit, such as a DNS name with https:// or a module that doesn’t exist, is asked again. No answer can start with a quote or contain #: Docker Compose would read a quote or a comment there. ai is listed only when the AI image is available to the server, which isn’t the case for self-hosted installs yet. If you type it anyway, the installer refuses it with AI provenance isn't available for self-hosted installs yet before anything is written, and asks the questions again. Everything else is generated or derived: the session and encryption secrets, the bundled PostgreSQL and its password unless DB_URL names your own database, the certificate source from whether your files are in /var/lib/earnie/tls, the release from the bundle’s VERSION file, the Docker group ID, the Docker bridge address, and the number of CPUs the cryptography sandbox may use. The installer writes the answers and the secrets to tenant.env, the derived values to .env, pulls the images, starts Earnie, waits for every service to be healthy, checks that https://<EARNIE_HOST>/healthz answers on this server, and ends with the address to sign in at. The installer never changes a value that tenant.env already has. To answer in advance instead of at the prompts, export the same names as environment variables on the sh side of the installer command; the installer prints which names it took from the environment. If you extracted the bundle yourself, you can also copy tenant.env.example to tenant.env in the bundle directory and fill in the fill in block at the top before you run ./install.sh. DB_URL and EARNIE_DATA_DIR are read the same way but never asked: without them, the installer runs the bundled PostgreSQL and uses /var/lib/earnie, and says so. Without a terminal, a missing answer stops the installer, which names it and writes nothing.
Always edit tenant.env. Never edit .env. The installer writes .env from tenant.env every time it runs and overwrites your changes.
tenant.env is a Docker Compose environment file, not a shell script:
  • Write each setting as NAME=value on its own line.
  • Don’t use quotes and don’t write export. Quotes become part of the value.
  • A value runs to the end of the line, spaces included. Don’t add a trailing comment on the same line.
The installer sets the file’s permissions to 0600, because it holds secrets. Keep a copy somewhere safe: EARNIE_SSO_KEK_HEX and EARNIE_INTEGRATIONS_KEK_HEX encrypt the credentials Earnie stores, and a restored database is useless without them. See Upgrading and backing up.

Own PostgreSQL

Set the connection URL before the first run. With the installer command there is no tenant.env before install.sh runs, so export DB_URL on the sh side. The installer then asks its questions as usual and doesn’t start the bundled database.
If you extracted the bundle yourself, you can set it in tenant.env in the bundle directory instead:
Use a password made of letters and digits, so you don’t have to escape it in the URL. The server’s address must be reachable from a container: localhost is refused, because inside a container it means the container itself.

Scanners

EARNIE_MODULES lists the scanners your organisation has bought, separated by commas, with no spaces, plus enrichment, which the installer adds by itself. For example, the installer writes EARNIE_MODULES=oss,crypto,enrichment when you answer oss,crypto. Set only the scanners your organisation has. Hardware needs depend on this list. See CPU and memory.

Sign-In Methods

The first run turns on password sign-in and sets the administrator’s password. Earnie also supports single sign-on (OIDC), alone or together with passwords. See Single sign-on. While EARNIE_INITIAL_ADMIN_PASSWORD is in tenant.env, the installer sets that password again on every run, and says so. Clear it once you have signed in; the installer doesn’t ask for it again.

Other Settings

Every other setting in tenant.env.example has a default that works. Some are worth knowing about:

TLS Certificate

Earnie serves HTTPS on port 443. The EARNIE_TLS setting decides where its certificate comes from. The installer picks custom when both certificate files are in place before it runs, and acme otherwise. To force one, set EARNIE_TLS in tenant.env.

Let’s Encrypt

The contact address is the administrator’s email unless you set EARNIE_ACME_EMAIL. There is nothing else to do. The name in EARNIE_HOST must already point at the server, or the certificate request fails. The installer notices: after it starts Earnie, it waits for https://<EARNIE_HOST>/healthz to answer, and stops with a message if it doesn’t.

Your Own Certificate

Use this when the server has only an internal name, when it isn’t reachable from the internet, or when your organisation issues its own certificates.
  1. Create the certificate directory before you install. It is <EARNIE_DATA_DIR>/tls, /var/lib/earnie/tls by default. With the installer command, the files must be there on the first run. EARNIE_TLS_DIR only applies when you set it in a pre-filled tenant.env in a bundle you extracted yourself. The directory must be listable (0755) and cert.pem readable by the user who installs.
  2. Put two files in that directory: The certificate must cover the name in EARNIE_HOST.
If either file is missing or empty, install.sh stops before it starts anything and names the file it expects. To renew, replace both files, then restart the proxy from the bundle directory:

Using a Load Balancer

You can put a load balancer in front of Earnie. It must do one of these:
  • Pass TLS through. Forward the TCP connection to port 443 on the Earnie server without decrypting it. Earnie’s certificate is what users see.
  • Re-encrypt to Earnie. Terminate TLS on the balancer, then open a new TLS connection to port 443 on Earnie. Set EARNIE_TLS=custom, and use a certificate that the balancer trusts.
Earnie doesn’t accept plain HTTP from the balancer: it redirects every plain HTTP request to HTTPS. For the balancers of AWS, Google Cloud, Azure, and DigitalOcean, see Put a load balancer in front. Earnie uses the client’s address for rate limits and for the audit log. Behind a balancer, every request appears to come from the balancer unless you tell Earnie to trust the balancer’s X-Forwarded-For header. This applies when the balancer re-encrypts. A balancer that passes TLS through can’t add the header.
  1. In the bundle’s Caddyfile, add a servers block with a trusted_proxies entry inside the global block at the top. Keep the lines already there. Use the balancer’s own source range, never a range that clients can send from.
  2. In tenant.env, add the same range after web:

If Your Certificate Comes from an Internal CA

Everything that connects to Earnie must trust the CA that signed Earnie’s certificate. Plan for these:

After the Installer

Check That Earnie Is Healthy

When the installer finishes, it prints the address to sign in at. The health check is at /healthz. Open it, or request it from the command line:
If your certificate comes from an internal CA that the server doesn’t trust, add --cacert with the CA’s certificate, for example curl -fsS --cacert internal-ca.pem https://earnie.example.com/healthz. A healthy Earnie answers with a success status. To see every service, including the ones that have finished:
In the STATUS column, every long-running service must show Up, with (healthy) where it has a health check. The one-time services data-init, migrate, and bootstrap, plus fs-probe-init if you turned on telemetry, finish and show Exited (0). That’s normal. Any other exit code means that service failed. See Troubleshooting.

Sign In

Open https://<EARNIE_HOST> in a browser. Sign in with the administrator email and password you gave the installer, or with single sign-on if you set it up. Then continue with Workspace setup.

Single Sign-On

Earnie signs users in through an OpenID Connect (OIDC) identity provider such as Microsoft Entra ID, Okta, or Keycloak.
  1. In your identity provider, register Earnie as a web application.
  2. Set its redirect URL to:
  3. Copy the issuer URL, the client ID, and a client secret into tenant.env: Set all three or none. Leave OIDC_REDIRECT_URL as it is. It already points at the address above.
  4. To sign in with single sign-on only, set EARNIE_PASSWORD_AUTH_ENABLED=false.
  5. Apply the change.
When the client secret expires, create a new one in your identity provider, replace OIDC_CLIENT_SECRET, and apply the change. If sign-in fails with a redirect_uri_mismatch error, the redirect URL in your identity provider doesn’t match the one above.

Connecting Your Git Server

Earnie reads your repositories from GitHub or GitLab and posts its results on pull and merge requests. The in-app steps are the same as in the SCANOSS-hosted option. See Connecting a repository. This section covers what your self-hosted installation must provide. Your Git server must be able to reach Earnie at EARNIE_PUBLIC_BASE_URL. It delivers webhooks there, and GitHub redirects the browser there while you connect. Earnie must be able to reach your Git server too.

GitLab (Self-Managed)

  • Version. GitLab 17.4 or later.
  • Token. Create a group access token with the api and read_repository scopes. A group Owner creates it. Project access tokens, service account tokens, and personal access tokens with the same scopes also work. Earnie needs the Maintainer role on each project it imports, because it registers a webhook on each one.
  • Reachability. Earnie only sends the token over HTTPS. GitLab must be reachable from the Earnie server over HTTPS.
  • Webhooks. Earnie registers one project webhook per imported project. It points at <EARNIE_PUBLIC_BASE_URL>/webhooks/gitlab/<connection id>. If Earnie has a private address, GitLab blocks the webhook by default. An administrator then needs to turn on Allow requests to the local network from webhooks and integrations, under Admin Area, Settings, Network, Outbound requests. Alternatively, add Earnie’s host to the allowlist on the same page.
  • Earnie trusts GitLab’s CA. If an internal CA signed GitLab’s certificate, paste that CA certificate into My GitLab uses an internal CA when you connect.
  • GitLab trusts Earnie’s CA. If an internal CA signed Earnie’s certificate, GitLab’s administrator must add that CA to GitLab’s trusted certificates, in /etc/gitlab/trusted-certs/ on the GitLab server. Until they do, GitLab fails every delivery with a certificate verify failed error. Earnie always asks GitLab to verify the certificate.

GitHub.com

Earnie connects to GitHub by creating a GitHub App for your installation. Set these two values in tenant.env and apply the change. GitHub redirects the browser to your Earnie address during the connection and sends webhooks there afterwards, so EARNIE_PUBLIC_BASE_URL must be a name that GitHub can resolve and reach.

GitHub Enterprise Server

You can connect GitHub.com and any number of GitHub Enterprise Server hosts to the same Earnie. Choose GitHub Enterprise Server when you connect, then enter the server’s address.
  • Version. GitHub Enterprise Server 3.4 or later.
  • Network. Earnie reaches the server over HTTPS. The server delivers webhooks to <EARNIE_PUBLIC_BASE_URL>/webhooks/github/<server host>, so it must be able to reach Earnie.
  • Internal CA. If an internal CA signed the server’s certificate, paste that CA certificate when you connect. If an internal CA signed Earnie’s certificate, the server’s administrator must trust it, as for GitLab.
  • Organisation. The organisation list isn’t available on Enterprise Server, so you type the organisation’s name.
  • GitHub Actions. The scanoss/earnie-cli action works on Enterprise Server only with GitHub Connect or after you sync the action with actions-sync. Set the EARNIE_PROJECT environment variable, or the action’s project input, because the CLI can’t work out the project from an Enterprise Server remote.

Changing Configuration Later

To change a setting:
  1. Edit tenant.env.
  2. Run the installer again from the bundle directory:
The installer asks nothing, rewrites .env, restarts the services whose settings changed, and runs the one-time services again. That includes setting the administrator password again if EARNIE_INITIAL_ADMIN_PASSWORD is still set. The images are already there, so it pulls nothing.

Turn on a Scanner Later

Add the scanner to EARNIE_MODULES, for example EARNIE_MODULES=oss,crypto, and run the installer as above. The installer starts the scanner’s worker. Check that the server has the extra CPU and memory it needs first. See Self-hosting requirements. To confirm, check that the enabled_modules list in Earnie’s GET /v1/me response includes the new scanner.

Turn on a Preview Feature

Some features ship in a release before they’re generally available. They stay off until you turn them on. SCANOSS gives you the name of a preview when you can try it. Add the name to EARNIE_PREVIEW_FEATURES in tenant.env, separated by commas, with no spaces, and run the installer as above. To turn a preview off again, remove its name and run the installer. To confirm, check that the enabled_features list in Earnie’s GET /v1/me response includes the name. A preview can change before it’s generally available. Release notes don’t list a preview’s changes until it is.

Troubleshooting

Start with the state and the logs of every service:
The services are caddy, web, and earnie-api. Depending on your settings, there are also postgres for the bundled database, worker-crypto and sandbox-egress for cryptography, and otel-collector for telemetry.

What’s Next