Install the server.

Run tensile-auth-server from the signed image or the binary, with Postgres or SQLite.

On this page
  1. Run the image
  2. Check the image signature
  3. Run the binary
  4. Try it with Docker Compose

This guide is for the person who runs tensile-auth-server for an app: install it, configure it, keep its keys, back it up, upgrade it, put it behind the app’s proxy, and watch it. The design behind each choice is in design/server.md.

The server is the library packaged as one binary. The app forwards /auth/ to it, so sessions stay in __Host- cookies on the app’s own origin, and the app’s backend checks each request with POST /v1/check. One server serves one app: one relying party ID and one set of origins.

The server needs one of these databases:

  • Postgres for any install with more than one replica. CI tests Postgres 18.
  • SQLite for a single node, with database_url set to sqlite:///absolute/path.

It listens on two ports:

  • 8080, the API, which the app’s proxy forwards to.
  • 9090, the ops port, which serves the health checks /livez and /readyz to your orchestrator alone. Never publish or proxy it.

Run the image

The image is ghcr.io/tensile-tools/tensile-auth-server, a public package that needs no sign-in to pull. Its tags are vX.Y.Z and X.Y; there’s no latest tag. It runs as UID and GID 65532 on a distroless base with no shell, and it supports a read-only root file system.

  1. Check the image’s signature, as described in Check the image signature.

  2. Create the master key and keep a copy apart from the database (see The master key):

    Shell
    openssl rand -base64 32 > master_key
  3. Start the server with the database URL, the app’s origins, and the master key:

    Shell
    docker run -d --name tensile-auth --read-only --cap-drop ALL \
      --security-opt no-new-privileges:true \
      -p 127.0.0.1:8080:8080 \
      -e TENSILE_AUTH_ORIGINS=https://app.example.com \
      -e TENSILE_AUTH_DATABASE_URL_FILE=/run/secrets/database_url \
      -e TENSILE_AUTH_MASTER_KEY_FILE=/run/secrets/master_key \
      -v "$PWD/database_url:/run/secrets/database_url:ro" \
      -v "$PWD/master_key:/run/secrets/master_key:ro" \
      ghcr.io/tensile-tools/tensile-auth-server:v0.3.0

To try the server on one machine with Postgres, use the Compose file in examples/server. just smoke-server starts that example and checks that it answers.

Check the image signature

The release workflow signs every image keylessly with its GitHub identity, and Sigstore’s public transparency log records the signature. With cosign 2.0 or later, check that the release workflow of tensile-tools/tensile-auth signed the image at its tag:

Shell
cosign verify ghcr.io/tensile-tools/tensile-auth-server:v0.3.0 \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  --certificate-identity https://github.com/tensile-tools/tensile-auth/.github/workflows/release.yml@refs/tags/v0.3.0 \
  --certificate-github-workflow-repository tensile-tools/tensile-auth \
  --certificate-github-workflow-trigger push

For another version, change both v0.3.0s.

To deploy exactly what you verified, run the image by the digest that cosign verify prints. Each image also carries an SPDX SBOM and SLSA provenance for each architecture; docker buildx imagetools inspect --format '{{json .SBOM}}' IMAGE prints the SBOM.

Run the binary

The image is the supported way to run the server. To run the binary without Docker, for example under systemd, build it from a checkout of the repository at a release tag. You need the Go version in go.mod.

Shell
git checkout v0.3.0
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X tensile.tools/auth/server.Version=v0.3.0" \
  -o /usr/local/bin/tensile-auth-server ./cmd/tensile-auth-server

Run it as an unprivileged user: the binary refuses to run as UID 0. With no command it runs serve. It reads /etc/tensile-auth/config.toml when that file exists.

To try it on your computer with nothing to set up, run tensile-auth-server dev. dev keeps everything in memory, serves only localhost origins, writes email to standard error, and refuses database_url.

Try it with Docker Compose

  1. Create the three secret files in this directory:

    Shell
    openssl rand -base64 32 > master_key
    openssl rand -hex 16 > postgres_password
    printf 'postgres://auth:%s@postgres:5432/auth?sslmode=disable' "$(cat postgres_password)" > database_url
  2. Start both services:

    Shell
    docker compose up --build
  3. Create an app key for your app’s backend:

    Shell
    docker compose exec tensile-auth /tensile-auth-server app-key create my-app
  4. Make yourself an administrator: run admin invite, open the link it prints within 15 minutes, and sign in with a passkey.

    Shell
    docker compose exec tensile-auth /tensile-auth-server admin invite

The server serves the API on localhost:8080 for an app at http://localhost:3000 that proxies /auth/ to it. The health and metrics port, 9090, stays inside the Compose network. Keep master_key backed up apart from the database: losing it loses every TOTP secret.

To check that the example starts and answers, run just smoke-server from the repository’s root. It starts these services under another project name, checks the health, sign-in, and app API routes, and removes them.

The example builds the image from this repository, so it runs the code beside it. To run a released version instead, replace the build section in compose.yaml with image: ghcr.io/tensile-tools/tensile-auth-server:vX.Y.Z. Don’t commit the secret files.