Skip to content

Deploy with hpy

hpy is HappyProto’s command-line tool. It keeps your app’s lexicons, scripts and plugins in a project on your computer, runs it locally with live reload, and deploys it to your instance. This page covers what’s specific to deploying to HappyProto; hpy’s own reference covers every command.

hpy hv is short for hpy happyview, and both work everywhere below.

Install hpy

hpy is in beta, so install it from the beta channel.

macOS or Linux, with Homebrew:

brew install happyproto/tap/hpy-beta

macOS or Linux, with the install script:

curl -fsSL https://happyproto.github.io/cli/install-beta.sh | sh

The script puts hpy in /usr/local/bin. If you can’t write there, sudo asks for your password once, for that copy alone.

Windows, in PowerShell:

powershell -ExecutionPolicy Bypass -c "irm https://happyproto.github.io/cli/install-beta.ps1 | iex"

For apt, dnf or building from source, see hpy’s install instructions. hpy update updates it on its channel.

Create a project and run it locally

hpy happyview create --name my-app
cd my-app
hpy happyview dev

create asks for your account’s DID, which gets superadmin on the local HappyView, and offers interpreters and libraries; the defaults are fine to start. dev serves the project at http://127.0.0.1:3000, and a saved file is live on the next request.

dev runs against the real atproto network, so a record it writes goes to your real PDS, and any instance tracking that collection indexes it, including your HappyProto one. HappyView’s running locally guide covers a private local network instead.

Sign in to your instance

hpy happyview login --url https://<name>.hpy.at

login asks for your handle or DID and signs you in through your browser. The account must be an admin on the instance; the account that created the project is. Your PDS must support atproto permission sets, because the sign-in asks for HappyView’s instance-management permissions.

hpy happyview whoami lists the instances you’re signed in to. A sign-in lapses after about two weeks unused; run login again.

Deploy

hpy happyview deploy --dry-run
hpy happyview deploy

--dry-run shows what would change. deploy shows the same, asks, then:

  1. installs each plugin happyview.lock pins, at exactly that version, with the capabilities the lock records for it;
  2. sends the project, meaning happyview.toml, everything under src/ and its built modules, in one piece. The instance checks it and switches to it all at once, or refuses it and keeps the one it had.

What a deploy changes on a HappyProto instance:

  • It applies [lexicons], [scripts], [modules], [network_lexicons] and [labels] from happyview.toml.
  • [instance], [dev], [jetstream] and the HappyView version stay as the instance has them. The preview warns if the project sets them. To change the HappyView version, upgrade the project in the dashboard.
  • Lexicons and scripts added in HappyView’s dashboard are kept. Where the project defines the same one, the project’s wins.
  • Plugins the lock doesn’t list are kept, unless you pass --prune-plugins.
  • A project bundle can be at most 50 MB compressed.

A deploy installs what you tested, so the lock must match happyview.toml. If it doesn’t, run hpy happyview add and deploy again.

Backfills

To index a collection’s existing records, set backfill = true on it:

[lexicons."com.example.note"]
backfill = true

The first deploy with that setting starts the backfill, and --dry-run lists it. On HappyProto a backfill reads from the shared network store, so it can wait for a crawl; see Backfills.

Deploy from CI

CI has no browser, so it uses an API key instead of a sign-in.

  1. In your instance’s HappyView dashboard, create an API key with the project:deploy, plugins:read and plugins:create permissions. Add plugins:delete if you deploy with --prune-plugins.
  2. Store it as a secret in your CI.
  3. Set HPY_HV_URL to https://<name>.hpy.at and HPY_HV_API_KEY to the key, then run:
hpy happyview check --locked
hpy happyview deploy --yes

--yes skips the confirmation.

Common errors

Message What to do
not signed in to a HappyView instance; run hpy hv login --url <instance> Run hpy happyview login --url https://<name>.hpy.at.
happyview.lock records no capabilities for … The lock is from an older hpy. Run hpy happyview check, commit the change, and deploy again.
the project is too large … it takes bundles up to 50 MB compressed Remove large files from src/.
the project on … changed since this deploy read it Someone deployed in between. Run the deploy again to see what it would change now.