Moving a self-hosted HappyView 2.x app onto HappyProto
If you are running HappyView 2.x yourself and want it on a HappyProto instance, this is the whole path: what v3 breaks, how to move, and what is still rough.
Before you start
You will need:
- Your 2.x instance still running, so you can read its configuration out of it.
- A database backup. Take one even though you are not upgrading in place — it is the only copy of your scripts and lexicons.
- Your HappyProto account, signed in to the dashboard.
- The list of plugins you currently run, and any secrets you configured for them. Secrets do not come with you and are not readable back out of your old instance’s API; if you cannot recover one, plan to re-issue it with the upstream provider.
Set aside more time than you expect for the scripts step. Everything else is minutes; migrating scripts is the real work.
The short version
v3 takes the script runtime out of HappyView. In v2 a Lua interpreter was compiled into the binary. In v3 a script runs inside an interpreter plugin, and HappyView ships none — a fresh instance with no interpreter installed can neither save nor run a script.
Four things break a 2.x setup:
- Scripts need an interpreter plugin installed before any of them run.
- Script globals are gone.
db,params,event,Record,now()and 27 others. Scripts move tohandle(input, ctx)withrequire(). - Plugin manifests need
api_version"2"and must declare their capabilities. There is no fallback for any plugin type. - Script limits are now enforced. v2 set an instruction limit and never applied it. A script that quietly ran long in v2 can fail in v3.
And one thing that is new rather than broken: HappyView can now publish your
lexicons to the network as com.atproto.lexicon.schema records. It needs a
permission grant that no migration gives you — see
Lexicon publishing.
Part 1 — What v3 changes
Scripts move into an interpreter plugin
This is the change everything else hangs off. Install an interpreter before you do anything else with scripts, or every script surface refuses:
| Surface | With no interpreter installed |
|---|---|
Saving a script (POST/PATCH /admin/scripts) |
400, naming the language |
| An XRPC query or procedure backed by a script | 503 ServerMisconfigured |
| A record event | Dead-lettered on the first attempt — the record is still indexed |
| A label event | Dead-lettered on the first attempt — the label still persists |
| A job | Fails, with the same message in its error column |
Record and label events are deliberately let through rather than held: a missing interpreter is an operator’s problem, not a reason to stop indexing. The dead-letter rows are your record of what went unprocessed, under Dead Letters in the dashboard.
Three interpreters are published: Lua, JavaScript and TypeScript.
Lua is the one to pick if you are migrating 2.x scripts — the codemod targets
Lua, and your existing scripts are Lua. A new HappyProto instance comes with
the Lua interpreter already installed, from its GitHub release rather than
from the registry; HappyView links it to its registry project in the
background, and update offers follow its channel from then on. Install
happyview-javascript or happyview-typescript as well, and the script
editor’s Language picker lets you choose Lua, JavaScript or TypeScript per
script. Each script runs on the interpreter for the language it is saved in.
Install it from Integrations → Plugins → Add plugin, pick happyview-lua from
the catalogue, choose the beta channel, review the capabilities it asks for, and
install. The boot warning stops at the instance’s next boot.
Removed globals, and the codemod
A script stored before the upgrade stays in the table untouched and fails the
first time it reads a removed global. Rather than attempt to index a nil value, you get a sentence naming the global and the fix:
the 'db' global was removed in v3; run the script codemod
(Migrate on the script's page under Integrations → Scripts, or
happyview-codemod) -- see the Migrating scripts guide
A Lua interpreter older than 1.0.0-alpha.6 says “Settings → Scripts → Migrate” instead, an older name for the same place.
The scripts list reports what each script still references in
needs_migration. The codemod rewrites it from the Migrate button on the
script’s page (Integrations → Scripts, then open the script), or from
POST /admin/scripts/{id}/codemod with {"apply": true, "allow_markers": true}.
Read the Migrating Scripts guide
— it is the reference for what the rewrite does, what it leaves behind as a
-- codemod: comment for you to finish by hand, and the three polyfills it
inlines so migrated scripts keep v2’s data shapes.
Two things that matter for ordering:
- The codemod does not need an interpreter. It is a source rewrite, so you can migrate every script before installing one. Editing a script by hand afterwards does need an interpreter, because the save is validated through it.
- Saving is stricter than running.
POST/PATCH /admin/scriptsrefuse a body that still references a removed global, with the names inremoved_globals. The codemod’s own apply is the single exception, so a script with unfinished markers can still be stored once you confirm it: the confirmation is"allow_markers": trueon the apply. Without it, an apply that leaves markers is refused with a 409.
Expect to finish some scripts by hand. The codemod is honest about what it cannot rewrite mechanically rather than guessing.
Plugins need api_version “2”
v2 loaded plugins declaring api_version "1". v3 requires "2", and refuses
anything lower at load:
auth plugins need an api_version: "2" manifest declaring capabilities
(got api_version "1"); republish the plugin with a capabilities-declaring manifest
There is no fallback for any plugin type, auth included. A v2-era manifest also
has to declare its capabilities, and the loader cross-checks that declaration
against the compiled module’s actual import section — a plugin that imports
something its manifest does not cover is refused before it ever runs.
Your instance still boots. A refused plugin logs a failure and is simply absent, so anything that depended on it — account linking through an auth plugin, say — silently stops working. Check your boot log after the move.
For official plugins, installing from the catalogue gets you a current release. For an in-house plugin, you are republishing it against the v3 SDK.
The plugin registry moved to software.release
If you have automation or notes that point at the old model, they are stale.
HappyView now reads its catalogue from a registry of software.release records
at https://api.happyproto.at, refreshed every 15 minutes. The GitHub release
walk that used to feed the catalogue has been removed. What changed that you
can see:
- Plugins are projects. A publisher’s DID plus a project name, e.g.
did:plc:mo7vq4jbioxwafy5zkcc3euxandhappyview-lua. - Installs follow a channel.
latestfor releases,betaandalphafor prereleases. An install follows its channel and is offered updates as the channel moves. You can pin to one version instead and never be offered one. - Bytes are verified by CID. Each version names its manifest and module by
CID; HappyView fetches both from the registry and refuses either whose bytes
do not match. The CIDs are stored with the install, so every reload and
restart re-checks them. A registry install takes no
sha256— the CIDs do that job. - Versions have lifecycle states set by the publisher:
activeanddeprecatedinstall,unavailableandretireddo not. Nothing turns a running plugin off on its own; a plugin whose version is later retired keeps running and the dashboard marks it in red with the publisher’s reason. - Updates come only from the publisher you installed from, even if another publisher’s project shares the name. To move to another publisher’s project, remove the plugin and add it again.
One consequence worth knowing: the registry is a boot dependency for a plugin
installed from it. Each install re-fetches its bytes from the registry at
every boot and reload, so while the registry is unreachable, that plugin is not
loaded. Setting PLUGIN_REGISTRY_URL=off does not change that for already
installed plugins — they keep fetching from the registry they came from. The
Lua interpreter a new instance comes with is the exception: it was installed
from its release URL, so the registry being unreachable doesn’t stop it
loading.
Lexicon publishing needs a grant nothing grants you
New in v3: HappyView can publish your manual and project lexicons to the
network as com.atproto.lexicon.schema records, so other apps can resolve your
schemas. Two upgrade gotchas, and both bite silently:
- Your attached account probably was not asked for the right scope. An account attached before HappyView could publish lexicons — or one whose last sign-in was the ordinary dashboard login — holds a session without the schema-write scope. The publishing target shows as unavailable and says what it was granted. Fix: press Re-authenticate on System → Service Identity once and approve the request.
- Existing operators do not get
lexicons:publish. The Manager template includes it for operators created from now on, but no migration grants it to operators who already exist. Grant it explicitly from Access → Users. An operator with superadmin can always publish.
Also worth knowing before you rely on it: HappyView cannot set DNS. A published
schema record only resolves when _lexicon.<your-authority> names the DID it
was written to. The publishing page checks and reports this; it cannot fix it.
Script limits are now enforced
v2 set a one-million-instruction limit and then never applied it — the hook was
installed on the wrong thread, so the coroutine handle ran on never saw it.
v3 enforces it and adds two limits v2 had none of.
| Limit | Default | Applies to |
|---|---|---|
| Instructions per run | 1,000,000 | Every kind but jobs |
| Wall clock per run | 10 s | Every kind but jobs |
| Memory per run | 64 MiB | Every kind, jobs included |
Jobs are exempt from the first two — running long is what a job is for, and
ctx.job.should_stop() is its stop.
The wall clock counts only time the script itself runs; waiting on the host (an
HTTP request, a database read) is not charged to it. A run that spends either
budget fails with timeout; one that exhausts memory fails with memory. An
XRPC caller sees {"error": "script_error", "errorType": "timeout"} at 408, or
"memory" at 500.
On HappyProto you set the first two from System → General (see Part 2). Review any script you know runs long before you cut over.
Two smaller changes that will catch you
Error text changed shape. If you have alerting or log queries over script
failures, the dead-letter and job error columns no longer carry v2’s stage
prefixes (db api:, xrpc api:, script load failed:, missing handle():,
create sandbox:). v3 writes the failure’s category instead — syntax:,
runtime:, timeout:, memory: or missing_handle: — followed by the
interpreter’s own text. A project script’s failure names its file:
<kind> in <file>: …. Limits the host enforces come through as
Timeout: the run exceeded its execution limit and Memory limit exceeded: …,
so a rule keyed on timeout: alone misses them. The old prefixes match
nothing.
Library record reads return an envelope. A record read through a library
answers {uri, did, collection, rkey, cid, indexed_at, record}, with the
stored body verbatim under record. v2 answered the body with uri written
onto it. Scripts the codemod migrated keep v2’s flat rows through a shim it
inlines, so this only bites code you write fresh. The public XRPC query routes
keep their flat shape — that is a client contract and it did not change.
Part 2 — Moving onto a HappyProto instance
There is no database import
Say it plainly, because it is the thing most likely to surprise you: a HappyProto instance is provisioned fresh. There is no path that takes your self-hosted database and turns it into a HappyProto instance. Moving means re-creating your app’s configuration on a new instance and letting it index the network again.
What that means concretely:
| What | Comes with you? | How |
|---|---|---|
| Lexicons | No | Re-upload them, or commit them to a project |
| Scripts | No | Re-create them — migrate them first, see below |
| Plugins | No | Re-install from the catalogue |
| Plugin secrets | No | Re-enter; re-issue upstream if you cannot recover one |
| Instance settings | No | Re-set from the dashboard |
| Operators and permissions | No | Re-invite; remember lexicons:publish |
| Indexed network records | Not needed | Backfill re-indexes them |
| Records your app wrote to user PDSes | Already safe | They live in users’ repos, not your instance |
That last row is the consolation, and it is a real one: the data that matters is in users’ repos. An AppView is an index. Rebuilding an index is slow but it is not data loss.
There is no assisted migration during the beta: we will not move a database for you. If you need help moving data, ping us in Discord or email support@happyproto.at.
The order to do it in
Migrate your scripts on the old instance first. Everything else is faster and less error-prone once the scripts are already v3-shaped.
- On your 2.x instance: take a database backup.
- On your 2.x instance: upgrade it to v3 locally if you can, run the
codemod over every stored script, and finish the
-- codemod:markers by hand. You now have working v3 scripts, and you can copy their bodies out. If you would rather not upgrade your live instance, run a v3 build against a copy of the database purely to use the codemod, and keep the output. - Create your HappyProto project, as in
Get started. Your instance is
at
https://<slug>.hpy.at, and the account that created it holds superadmin on it. - Check the Lua interpreter is installed under Integrations → Plugins.
New instances come with it; if it is missing, add
happyview-luafrom Add plugin. Do this before you touch scripts. Confirm the boot warning is gone. - Install your library and auth plugins from the catalogue, accepting each one’s capabilities. Re-enter their secrets.
- Upload your lexicons. If you want them published to the network,
re-authenticate from System → Service Identity first and grant
lexicons:publishto the operators who need it. - Re-create your scripts from the migrated bodies. Each save is validated
through the interpreter, so a mistake is caught here rather than at run
time. Confirm
needs_migrationis empty andrunnableis true for every script. - Start your backfills, and expect them to take a while.
- Review your script limits under System → General against anything you know runs long.
- Cut over whatever points at your old instance.
What you can and cannot change
This is the biggest practical difference from self-hosting, and it reshapes several of the v3 upgrade steps. On a HappyProto instance you have no shell and no environment variables. In the dashboard you choose an instance’s plan when you create it, and can move it to another later with Change plan on the project’s Settings tab. When a newer HappyView release is offered, Upgrade available on the project’s Overview upgrades it. You can also add custom domains to an instance and delete it.
So, of the routes the self-hosted v3 guide offers:
| Route | On HappyProto |
|---|---|
PLUGIN_URLS to install plugins at startup |
Not available — use Add plugin |
A directory under ./plugins/ |
Not available — no filesystem |
The happyview-codemod CLI |
Not available — use POST /admin/scripts/{id}/codemod, or run the CLI against a copy of your old database before you move |
SCRIPT_INSTRUCTION_LIMIT / SCRIPT_WALL_CLOCK_SECONDS |
Set them in System → General instead; the dashboard values take precedence over the environment anyway, so nothing is lost |
PLUGIN_CACHE_DIR |
Not settable |
Everything you need is on the dashboard or the admin API. Nothing in the v3 upgrade requires a shell — but if your notes assume one, this is where they break.
Your records come from a shared network store
HappyProto tenants read network records from a shared store rather than each instance running its own Jetstream ingest. One ingest feeds every tenant, and each tenant gets its own database role scoped to what it may see.
Two things follow that you would not see self-hosting:
- Backfill and ingest behave differently from a single-tenant instance running its own Jetstream connection. Treat the Jetstream settings in the self-hosted configuration reference as not applying to you.
- If the shared store is unavailable, some admin reads fail rather than
lying.
/admin/statsanswers 503 while claimed storage is down, instead of reporting a confidently wrong count. If you see a 503 from the stats endpoint, that is what it means — it is not your instance being broken.
Part 3 — Known gaps during the beta
Being straight about the rough edges, so you can plan around them rather than discover them.
There is no guided upgrade flow. Nothing detects a v2 database and walks you through the codemod. Every step in this guide is manual.
There is no database import. Covered above; it is the largest gap and the one most likely to change after the beta. Until then, ask in Discord or at support@happyproto.at if moving data is blocking you.
hpy deploys, but does not manage instances. The hpy CLI can create,
run, test and build a HappyView project, and hpy happyview deploy makes an
instance match it (sign in first with hpy happyview login --url https://<slug>.hpy.at). Creating, resizing and deleting instances is
dashboard-only for now.
Interpreter plugins are prereleases. They are published and installable on prerelease channels. Expect to take updates during the beta.
A registry install is a boot dependency. While api.happyproto.at is
unreachable, plugins installed from it are not loaded. This is by design — the
alternative is running bytes nobody re-checked — but it means registry
availability is instance availability for script-backed routes. The Lua
interpreter a new instance comes with was installed from its release URL, not
the registry, so this doesn’t apply to it.
Plugin moderation does not exist yet. The registry namespace is open — anyone can publish any project name. Installs are pinned to the publisher you chose, and bytes are CID-verified, so nobody can swap something underneath you. But there is no takedown path for a bad plugin yet. Install from publishers you recognise, and check the capabilities you are accepting.
Rolling back to v2 is not a path. v3 brings database migrations of its
own (22 on Postgres, 20 on SQLite), and they only go forward: records move into a new record store, and
tombstones, lexicon publishing, registry installs and project deploys each get
new tables. v2 can’t read the result. And a script the codemod rewrote will
not run on v2 — the globals it now reaches through require were never
there. If you are skipping 2.x releases to get here, their
migrations come too, and the spaces work in the 2.x line drops columns
outright. This is why step 1 is a backup.
Checklist
Before you move
- Database backup taken
- Every stored script run through the codemod, with
-- codemod:markers finished by hand - Script bodies copied somewhere you can paste from
- Plugin list and secrets collected
- Lexicons exported
- Long-running scripts reviewed against the instruction limit and the 10-second wall clock
On the new instance
- Instance provisioned and
running - Interpreter plugin installed; boot no longer warns
- Library and auth plugins installed, capabilities accepted, secrets re-entered
- Boot log checked for plugin refusals
- Lexicons uploaded
- Service Identity re-authenticated, if you want lexicon publishing
-
lexicons:publishgranted to the operators who need it - Scripts re-created;
needs_migrationempty andrunnabletrue for every one - Backfills started
- Script limits set under System → General
- Alerting updated for the new
errorcolumn prefixes - Traffic cut over
Where to get help
The fastest path is
Discord, or email
support@happyproto.at — bring your boot log and
the exact error text. The two errors worth reporting immediately,
because they mean something is wrong on our side rather than yours, are a
plugin that will not install from the catalogue, and a 503 from anything other
than /admin/stats.
Reference docs:
- Migrating Scripts to v3 — the script contract, the codemod, every marker
- Plugins — installing, channels, CID verification, publishers
- Publishing lexicons — targets, rules, DNS
- Developing plugins — the SDK and capabilities, if you maintain your own