Install

Pratique is one binary with a web UI. Run it from the Docker image or build it from source, give it a public URL, and serve it over HTTPS directly or from your own proxy.

Run it with Docker

The image is ghcr.io/justpolidor/pratique, for linux/amd64 and linux/arm64. It runs as a non-root user on a distroless base, keeps its data in /data, and listens on 0.0.0.0:8484 inside the container.

TagWhat it points to
0.1.0One release. It never changes. Use this in production.
0.1The newest patch release of 0.1.
latestThe newest release. Fine for trying it out.

Check the image signature

Every release image is signed with cosign by the release workflow, and carries an SBOM and build provenance. Check the signature before you run a new version:

bashverify a release image
cosign verify ghcr.io/justpolidor/pratique:0.1.0 \
  --certificate-identity https://github.com/justpolidor/pratique/.github/workflows/release.yml@refs/tags/v0.1.0 \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

The command fails unless the image was signed by that workflow, for that tag. Releases also list each binary's SHA-256 in SHA256SUMS.

bashstart one instance
export PRATIQUE_ADMIN_TOKEN="$(openssl rand -hex 24)"
echo "$PRATIQUE_ADMIN_TOKEN"   # keep it in your password manager

docker run -d --name pratique --restart unless-stopped \
  -p 127.0.0.1:8484:8484 -v pratique:/data \
  -e PRATIQUE_PUBLIC_URL=https://pratique.example.com \
  -e PRATIQUE_TRUST_PROXY=true \
  -e PRATIQUE_RESERVED='@acme/*,acme-*' \
  -e PRATIQUE_ADMIN_TOKEN \
  ghcr.io/justpolidor/pratique:latest

This example puts a TLS proxy in front, on the same machine. Change the settings to fit your setup:

  • PRATIQUE_PUBLIC_URL is required. Inside the container Pratique listens on all addresses, and on any address that isn't loopback it refuses to start without a public URL.
  • PRATIQUE_TRUST_PROXY is only for when a proxy is really in front. See behind a proxy.
  • PRATIQUE_RESERVED lists your internal package names. See reserve internal names.

The image has a built-in health check, pratique healthcheck, which asks the server's /readyz endpoint whether the database and storage work. docker ps shows the container as healthy once it answers.

If you mount a host directory at /data in place of a named volume, give the container's user write access to it first: chown 65532:65532 /data.

Docker Compose

The repository has a compose.yaml for one instance on SQLite and local disk, with a TLS proxy expected in front. It builds the image from the checkout. To use the published image, replace build: . with image: ghcr.io/justpolidor/pratique:latest.

yamlcompose.yaml
services:
  pratique:
    build: .
    restart: unless-stopped
    ports:
      - "127.0.0.1:8484:8484"
    environment:
      PRATIQUE_PUBLIC_URL: https://pratique.example.com
      PRATIQUE_TRUST_PROXY: "true"
      PRATIQUE_ADMIN_TOKEN: ${PRATIQUE_ADMIN_TOKEN:?set a token of at least 16 characters}
      PRATIQUE_RESERVED: "@acme/*,acme-*"
    volumes:
      - pratique-data:/data

volumes:
  pratique-data:

Set PRATIQUE_PUBLIC_URL and your reserved names, then start it. Compose refuses to start until PRATIQUE_ADMIN_TOKEN is set.

bashstart with Compose
export PRATIQUE_ADMIN_TOKEN="$(openssl rand -hex 24)"
docker compose up -d --build

For a complete worked example on one server behind a Cloudflare Tunnel, see deploy on Hetzner.

Build from source

Pratique needs no external services to start. Build it with Go 1.27.4 or later:

bashbuild and run locally
go build -o pratique ./cmd/pratique
PRATIQUE_ADMIN_TOKEN="$(openssl rand -hex 24)" ./pratique

By default it listens on 127.0.0.1:8484 and keeps its data in ./data. On a loopback address it needs no public URL. If the server is entirely local, with a loopback listener, a local public URL and no trusted proxy, clients on the same machine can connect without a token. Their downloads are then recorded as anonymous. Anywhere else, every client needs a token.

Sign in for the first time

Open the public URL and sign in with the admin token. Then create access tokens and connect your tools. See quickstart.

  • The admin token must have at least 16 characters. Pratique warns below 32. Generate one with openssl rand -hex 24.
  • If you set no admin token and no single sign-on (OIDC, SAML or LDAP), Pratique generates a token for that run and prints it to standard error. In Docker, read it with docker logs pratique. It changes on every restart, so set PRATIQUE_ADMIN_TOKEN to keep one.
  • With single sign-on configured and no admin token, nobody can sign in with a token. That is the safest setup once SSO works. See sign-in and roles.
  • A restart ends every session that signed in with the admin token, so rotating the token takes effect at once.

Set the public URL

PRATIQUE_PUBLIC_URL is the address clients use. Package listings point clients at it for downloads, the Connect page and error messages show it, and sign-in callbacks return to it. Set it to the exact address people and CI reach, such as https://pratique.example.com.

It is required on any listen address that isn't loopback. When Pratique serves HTTPS itself, it must start with https://.

Serve it over HTTPS

Package managers send tokens with every request, so serve Pratique over HTTPS before anyone uses it over a network. Choose one of two ways.

Directly

Give Pratique a certificate and key, and set a public URL that starts with https://:

yamlpratique.yaml
server:
  listen: 0.0.0.0:8443
  public_url: https://pratique.example.com:8443
  tls_cert: /etc/pratique/cert.pem   # the full chain
  tls_key: /etc/pratique/key.pem

The environment variables are PRATIQUE_TLS_CERT and PRATIQUE_TLS_KEY. Set both, or neither.

  • Renewals need no restart. Pratique picks up a renewed certificate from those files. Replace the key and certificate together.
  • Pratique doesn't obtain certificates. Use your own certificate authority or an ACME client.
  • Plain HTTP isn't answered on that port, so there is no redirect from HTTP.
  • Private certificate authorities must be trusted by clients. For pratique commands, set SSL_CERT_FILE.

Behind a proxy

Run a proxy such as Caddy or nginx in front of Pratique, and let it handle TLS.

  • Preserve the Host header.
  • Set X-Forwarded-For.
  • Set PRATIQUE_TRUST_PROXY=true, so the audit log and the sign-in limit use the client's address and not the proxy's.

With PRATIQUE_TRUST_PROXY on, Pratique uses the last address in X-Forwarded-For, across all lines of the header. That is the address your proxy adds, and the only one it vouches for. Earlier entries come from the client.

Only with a proxy

Turn on PRATIQUE_TRUST_PROXY only when a proxy is really in front and clients can't reach Pratique around it. Otherwise a client can forge the addresses in your audit log.

Reserve internal names

Set PRATIQUE_RESERVED to your internal package name patterns, such as @acme/*,acme-*, before anyone connects. Pratique never looks up a reserved name in a public registry, which stops dependency confusion. Do this first, so internal names are never sent upstream. In artifactory mode, reserved names can also be published. See private packages.

The data directory

PRATIQUE_DATA (server.data_dir) holds everything the server keeps. In the image it is /data, and from source it defaults to ./data.

  • pratique.db is the SQLite database. It holds the audit log, settings, token hashes, projects and build records.
  • blobs/ holds package files, including the only copy of your private packages. It also holds temporary files while they are verified.

With Postgres and S3, the database and package files move out, but each instance still needs the data directory for temporary files. See run more than one instance.

Upgrade

Pull the new image, or build the new version, and restart. Database migrations run at startup, so there is no separate step. With several replicas, you can upgrade without downtime: see upgrade without downtime. Back up first, because a migration changes the database.

bashupgrade with Compose, using the published image
docker compose pull
docker compose up -d

If your compose.yaml builds from the checkout, update the checkout and run docker compose up -d --build instead.

Run pratique version to check the version afterwards. The image also contains the matching pratique-connect builds, so developers update the tool by running its install command again; pratique-connect doctor tells them when theirs is older than the server.

Before you use it for a team

  1. Turn on single sign-on. Configure OIDC, SAML or LDAP, and add SCIM to end access when someone leaves. Keep the admin token only as a break-glass login, or remove it. See sign-in and roles.
  2. Block direct access to the registries. A proxy only protects clients that can't go around it. See block direct access.
  3. Sign the audit log. Run pratique audit-keygen, set PRATIQUE_AUDIT_KEY, and keep the key out of the database and its backups. Then pratique verify-log can show that nobody with database access changed past events.
  4. Back up on a schedule, and test a restore. On SQLite, pratique backup DIR is safe while the server runs. On Postgres, use pg_dump or your provider's snapshots. See storage.
  5. Watch it. Set PRATIQUE_METRICS_TOKEN to turn on /metrics, check /readyz, and set PRATIQUE_WEBHOOK_URL for alerts. See monitoring.
  6. Check lockfiles in CI. Add pratique lockcheck to your pipelines. See CI checks and inventory.