Sites and instances

A site is a record: its content, templates, theme, domains and credentials. An instance is a running process that serves one. The two are separate on purpose — you can move a site between instances, and one machine can serve several sites.

One instance, one shape

An instance is configured by five things:

Setting Meaning
DATABASE_URL The database this instance reads and writes
SNOLLA_SITE_ID The site this instance serves
SNOLLA_SITE_MODE single — the database holds exactly this site, or shared — the database holds several and the request's host names the one to serve
PORT Where the instance listens
NODE_ENV production on anything reachable; see Access and credentials

single is the ordinary deployment: one database per site, one instance in front of it, nothing to disambiguate. The instance refuses to boot if the database turns out to hold more than one site, rather than serving the wrong content.

shared is the shape a hosting operator runs: many sites on one database, one instance deciding per request which site it serves, from the host name — a host that no site claims gets nothing. Nothing else about the engine changes; what changes is who is responsible for the database. If your site lives on a shared deployment, you get an identifier and a domain and own neither of the rest. Reading a page of this documentation should not make anyone put two production sites into one database by setting a variable: that shape is provisioned, not toggled.

What has to exist before the first request

Three records have to line up, and each has its own way of getting there:

  1. The site — created and provisioned on the deployment, with its own identifier. A deployment's tooling calls a site a tenant: same record, the name the commands use. Its identifier is what the instance gets in SNOLLA_SITE_ID, and what every admin API write carries as siteId.
  2. The administrator, bound to that site — an account that can write, and a personal access token bound to it. A token issued for one site is refused by another: the binding, not the token, is what keeps sites apart. snolla tenant create provisions the site together with its first administrator credential; the admin:provision script in Access and credentials is the path for a database you set up yourself.
  3. The content — templates and pages, either pushed from a local project or written through the admin API.

The site record is not optional bookkeeping: without it, an instance has nothing to serve, and the admin API has nowhere to bind an administrator.

Serving several sites on one machine

Two instances on one machine are two ports, two databases and two environment files — nothing is shared. The pieces that do know about the whole machine are the deployment's own tools:

These commands are documented in the CLI reference; how a platform team runs node reconcile is its own story, not a prerequisite for using a site.

Moving a site

A site is portable because its content lives in its database, not in the instance: dump the site as a typed bundle and write it into another database, then point an instance at it. snolla site export, snolla site import and snolla site move do that; snolla assets check then proves the storage backend holds every object the bundle promised, byte for byte. The bundle is content, never a raw database dump — so it survives a change of engine dialect.

Related