Skip to content

Accounts, roles and sign-in ​

A Foliwake server knows people by e-mail address. Each person has an account. Accounts belong to organisations, and each site belongs to one organisation. An account's role in an organisation decides what it may do there.

There is no open sign-up. The first account is created on the server; everyone else is invited.

Roles ​

RoleWhat it may do
adminEverything below, plus site settings, sources and inviting people
developerRead, preview, sync, branch previews, prepare code; release code, publish or roll back only when given live access
authorRead, sync, preview, publish and unpublish pages

In detail:

Actionadmindeveloperauthor
Read status, pages, sources, branches and historyyesyesyes
Sync sources and update the previewyesyesyes
Publish or unpublish pagesyeswith liveyes
Branch previews and code prepareyesyesno
Release new code (migration commit)yeswith liveno
Roll back the whole site (release rollback)yeswith liveno
Site settings, sources, members and invitationsyesnono

CI keys belong to no person: an organisation's admin makes one for named sites (foliwake account keys create --site …). Its role, ci, reads those sites, prepares and releases their code and updates their branch previews, and nothing else: no pages, no rollback, no people, no keys. A CI key expires after 365 days unless made with another time (at most 730); see CI key expiry and rotation. See release code from CI.

Live access is a flag on a developer's membership: account invite --live. A membership can also be limited to some sites of the organisation (--site, repeat for several). Without --site, it covers every site of the organisation.

The server checks the role on every request. A changed role or a removed member counts at once, also for a computer that is already signed in.

Create the first account ​

Run this on the server, with the server's configuration, once:

bash
foliwake account bootstrap --email owner@example.com --public-origin https://foliwake.example

It creates the owner account, makes it admin of the default organisation and gives it authority over the whole installation. It prints a one-time sign-in link. Existing sites belong to the default organisation.

--public-origin (or FOLIWAKE_PUBLIC_ORIGIN) is the address where browsers reach the dashboard. Sign-in links point there. On your own computer it is the dashboard's local address, for example http://127.0.0.1:8099.

With the Docker image, run it in the container: docker exec foliwake foliwake account link --email you@example.com. See Install with Docker.

Invite people ​

bash
foliwake account invite --email author@example.com --role author
foliwake account invite --email dev@example.com --role developer --live --org acme --site acme-docs

An invitation is accepted when that address signs in within 7 days. A new person gets an account at that moment. Inviting someone who is already a member is refused; change their role instead.

Admins can do the same in the dashboard, under Members: see below.

Organisations ​

foliwake org list lists the organisations you are a member of, with your role (the installation's owner sees all). Only the installation's owner creates one, and becomes its admin:

bash
foliwake org create acme --name "Acme Ltd"

The id is at most 12 lowercase letters, digits and single inner hyphens, starting with a letter: it is part of branch preview hosts (<branch>--<site>--<org>) and of bucket names. A site belongs to one organisation for good: its bucket, branch addresses and linked folders name it, so site set org is refused (SITE_ORG_FIXED). To move a site, delete it and create it again in the other organisation.

What an organisation admin may change ​

An admin of the site's organisation edits its settings (site set, site edit, source add, source enable), with these limits, whether the server keeps its sites in its database or lists them in its project file (foliwake api serve of a local project). A change past them is refused with FIELD_SERVER_OWNED; the installation's owner may make it.

  • Server fields: code, stateDir, storage, org and a source's operator settings stay as the installation set them, and no source may name a path on the server (a local Markdown folder).
  • Credentials: a new credential name must be one of the site's own, <SITE>__… (site my-site: MY_SITE__DRIVE_KEY). A name the installation set stays usable in the field it was set in, nowhere else.
  • Where a source reads from: while a source names a credential the installation set, its settings (the repository address and provider, a Drupal address, a Drive folder, Google documents, …) are the installation's: they decide where that token or service account is sent. To point the source elsewhere, name the site's own credential (<SITE>__…) in the same change; a source without credentials, or with only the site's own, is the organisation's to change.
  • Addresses: every site of a server is served on the same listeners, so a host a site lists is a host it answers on. An organisation admin keeps liveHosts, liveAliases, liveUrl, previewBaseHost, previewUrl and branchHostDomain as they are, removes them (the site then takes its managed addresses), or sets them within the site's own managed names: <site>--<org>.<liveDomain> and <site>.<liveDomain> for live, <site>.<previewDomain> for preview, branch hosts under <previewDomain> or none (null). A custom domain, or any other host, is set by the installation's owner; on a server without managed addresses all of them are.

Delete a site ​

bash
foliwake site delete --site shop

An admin of the site's organisation (or the installation's owner) types the site id again (--confirm <id> without a terminal). The server refuses while an operation of the site runs, while its live release has pages (unpublish them, or pass --force: they stop being served here), and while a membership limited to the site, an open invitation or a CI key names it (a new site with the same id would inherit that access: change or revoke them first). It removes the site's entry and its settings history, records the deletion in the audit, and sets the site's state folder and code checkout aside as <folder>.deleted-<time> beside themselves for the operator to remove. The bucket is not touched: it keeps the site's objects until the installation's operator empties or deletes it with the storage provider's tools; a site with the same id can be created again only after that (STORAGE_BUCKET_OCCUPIED). Only a server that keeps its sites in its database deletes sites.

People sign in to the dashboard with a link sent by e-mail. The link is valid for 15 minutes and works once.

Mail is off by default. To send mail through Resend, set on the server:

VariableValue
FOLIWAKE_MAILresend (unset or none: no mail)
FOLIWAKE_MAIL_FROMThe sender address
FOLIWAKE_RESEND_API_KEYYour Resend API key; keep it in your secret store

Without mail, an operator prints a link for an existing account and passes it on (--public-origin or FOLIWAKE_PUBLIC_ORIGIN as above):

bash
foliwake account link --email author@example.com

The sign-in page answers the same way for every address, so it does not reveal who has an account. It limits how many links can be asked for.

The dashboard ​

foliwake admin serves the dashboard on 127.0.0.1 (port 8099 by default). It asks you to sign in by e-mail link. Every account that is a member of an organisation can sign in; what it sees depends on its role:

admindeveloperauthor
Members of the organisationsee and managesee—
Invitations: invite, resend, revokeyes——
Signed-in computers (your own)yesyesyes
Sites, settings, sources, pages, historywith installation authoritywith installation authoritywith installation authority

The site screens still manage the whole installation, so they need the owner account (or another account with installation authority). Other accounts see the organisation and account screens only; page work for authors and developers in the dashboard comes later (use the CLI meanwhile).

Members ​

Members lists the people of your organisation: e-mail, role, live access for developers, and the sites they may act on (all, or some).

  • Invite someone: e-mail, role, live access, sites. When the server sends mail, the person gets an invitation mail. Without mail, the dashboard shows the sign-in address to pass on. The invitation is accepted when that address signs in within 7 days.
  • Invitations: open ones, with who invited and when they expire. Resend replaces an invitation with a new one for another 7 days (expired ones stay listed for 30 days, so you can resend them). Revoke ends it. To protect the server's mail and the people invited, an admin can send at most 30 invitations an hour in an organisation, and one address gets at most 3 an hour; beyond that the dashboard asks you to try again later.
  • Change a member's role, live access or sites. If someone else changed the same member in the meantime, the change is refused and the list shows the current state.
  • Remove a member. A changed role or a removed member counts at once, also on computers already signed in.
  • An organisation always keeps at least one admin over all its sites: the last one cannot be demoted, limited to some sites or removed. Make someone else admin first.

Only an admin over all sites of the organisation manages people. Every change is recorded with the account that made it.

Signed-in computers ​

Signed-in computers lists the computers where you ran foliwake login: the computer's name, when it signed in, when it was last used and when it ends (90 days after its last use; 30 days for an account with installation authority, which may run the whole server). Revoke signs one computer out; Sign out everywhere signs out all of them. A revoked computer stops at its next command.

Behind a gateway or reverse proxy, set:

  • FOLIWAKE_PUBLIC_ORIGIN: the dashboard's public https:// address;
  • FOLIWAKE_TRUST_PROXY=1: sign-in limits then use the client address the gateway passes on, not the gateway's own address. Without it the server warns once when X-Forwarded-For arrives: all browsers would share the gateway's address and its limits.

On https the sign-in cookies are __Host- cookies: only the dashboard's own host can set them, not a site on a sibling host of the same domain. A server upgraded to this naming signs every browser out once.

Sign in from the CLI ​

Commands that act on a site can run against a Foliwake server instead of a local configuration. Sign this computer in once:

bash
foliwake login https://foliwake.example
foliwake whoami
foliwake logout

login prints a one-time code and opens the browser at the server's approval page (use --no-browser to only print the address). The address is the dashboard's: foliwake server and every Docker install answer the CLI there too, locally (http://localhost:8080) or behind a proxy. A dashboard started on its own with foliwake admin needs foliwake api serve beside it. The token is kept in the system keychain: the macOS Keychain, or Secret Service on Linux. Without a keychain, --insecure-storage keeps it in a file only you can read. whoami shows the server, your account and your memberships. logout revokes the token on the server and forgets it here.

Approving a sign-in ​

On the approval page (/device) you type the code your terminal shows, then the page shows the request before you approve:

  • Started from: the address the sign-in came from, as the server saw it (behind a proxy, only with FOLIWAKE_TRUST_PROXY=1), and the address of your browser beside it;
  • Started at: when, in UTC;
  • the computer and client names, marked reported by the device: whoever started the sign-in chose them, so they prove nothing.

A link cannot approve a sign-in, even one that carries a code: the page it opens asks for the code again. Approve only a sign-in you started yourself, just now. If someone sends you an approval link or a code to type, do not continue: whoever started that sign-in would get a key with everything your account may do.

Which commands go to the server ​

A command that supports --server goes, in this order, to:

  1. the server named by --server;
  2. the local configuration named by --config or FOLIWAKE_CONFIG;
  3. the server of the folder's .foliwake/connection.json (written by site create or site link), whose site is also the default for --site;
  4. the server named by FOLIWAKE_SERVER;
  5. the local project, when the current folder has a trusted foliwake.config.json;
  6. the default server: the first one you signed in to, or the one foliwake servers use chose (login --default makes a new sign-in the default);
  7. otherwise, a local configuration is required.

These commands are those of the open CLI, @foliwake/cli, which the engine includes as a plugin: npx @foliwake/cli … runs the same command against a server without the engine, with steps 2, 5 and 7 left out. foliwake servers lists your sign-ins. The built-in name cloud is Foliwake Cloud (https://cloud.foliwake.org); login names no server by default.

The CLI reference marks these commands with a --server flag: the site, page, source, operation, branch, code, migration and release commands, and whoami. operation recover --break-lock needs the site's local configuration. In a project folder linked to a site (.foliwake/connection.json, written by site create or site link), preview and publish go to that site's server; create --server … --create-site makes the site there. Other commands always run locally: dev, admin, serve, server, the blocks, docker and account commands, and config trust. Local commands need no sign-in.

CI ​

In CI, set FOLIWAKE_SERVER and FOLIWAKE_TOKEN. The token is sent only to that server, never to another one named by --server, and nothing is stored on the machine.