Appearance
Configuration and storage
Four files, four roles
What a site is travels with its code; what an installation is stays on the server; secrets live in neither.
| File or setting | Who writes it | What it holds |
|---|---|---|
site.yaml (with query.yaml, access.yaml) in the site's repository | the site's developers | how the site behaves: authoring dialect, delivery, indexes, access. It goes into every code release and rolls back with it (site settings). |
foliwake.config.json in the site's repository: the project file | foliwake create, then the developers | what foliwake dev and page check need on a developer's computer: code.root and the content sources. Nothing about storage, hosts or keys. |
.foliwake/connection.json in the project folder (not committed) | foliwake site create / site link | which server and site the commands in this folder go to: {server, site, org}. |
The server's settings: /data/foliwake.config.json and its site database | the server at its first start, foliwake docker configure, the dashboard, foliwake site set | storage, state, addresses and hosts, cache, the names of key variables. Values of secrets are in the server's environment or stored with foliwake credential set, never in a file of the repository. |
One rule decides where a setting belongs: the repository holds what is the same for every installation of the site, the server's site entry what is the same for every developer, and the environment or credential set the values.
The project file
A minimal project file names the code and the content, nothing else:
json
{
"version": 1,
"sites": [
{
"code": { "root": "." },
"sources": [{ "id": "content", "plugin": "local-markdown", "owns": ["/"], "settings": { "root": "./content" } }]
}
]
}Such an entry, without storage, is a local project: foliwake dev, page check and the block commands use it. Its id defaults to site, its state folder to ./.foliwake and its hosts to <id>.localhost and preview.<id>.localhost; name them only if you need others. It has no store, so it needs no keys. Preview, publication and code releases refuse it with SITE_HAS_NO_STORAGE: they run on a server (--server <address>, or link the folder with foliwake site link).
An entry that names storage is a full site, as a server keeps it: it also needs stateDir, liveHosts and previewBaseHost, and a local foliwake serve all or foliwake admin can run it (below). A file with installation addresses, provisioning or a site store is a server's file; every site there names its storage.
Paths resolve relative to the configuration file. A command uses, in this order: --config <file>, then FOLIWAKE_CONFIG, then foliwake.config.json in the current folder (only that folder, not its parents; the command says on stderr that it found it). With several configured sites, add --site <id> to site commands.
A file found in the folder that names credentials is used only after you trust it on this computer, like direnv allow: a configuration decides which address receives the credentials named in it, so a cloned repository's file must not do that unread. A file that names no credential variable, no storage, no source other than a local Markdown folder and no address beyond this computer (a minimal project file) needs no trust: it sends nothing anywhere. Read it, then run foliwake config trust: it shows where each site sends which variables and records the file's path and contents (in ~/.config/foliwake/trusted-configs.json, or FOLIWAKE_CONFIG_DIR). Any change to the file makes it untrusted again. A file you name with --config or FOLIWAKE_CONFIG needs no trust. foliwake create trusts the file it writes.
Credential fields (accessKeyEnv, secretKeyEnv, previewTokenEnv, cache tokens, source credentials, and passwordEnv in foliwake.remote.json) must name variables of their own: always a string, not a system variable (PATH, HOME, USER, …) or one that configures Git or a language runtime (GIT_…, SSH_…, NODE_…, NPM_CONFIG_…, PYTHON…, RUBY…, PERL5…, JAVA_…, …) and not one of Foliwake's own variables (FOLIWAKE_TOKEN, FOLIWAKE_SERVER, FOLIWAKE_AUTH_SECRET, …). The documented defaults (FOLIWAKE_S3_ACCESS_KEY, FOLIWAKE_S3_SECRET_KEY, FOLIWAKE_STORAGE_ACCESS_KEY_ID, FOLIWAKE_STORAGE_SECRET_ACCESS_KEY, FOLIWAKE_PREVIEW_TOKEN) stay allowed.
When you are signed in to a Foliwake server, a command without --config or FOLIWAKE_CONFIG goes to that server, except in a folder that has a foliwake.config.json: there it works on that local project. --server or FOLIWAKE_SERVER still send it to a server.
bash
export FOLIWAKE_CONFIG="$HOME/my-site/foliwake.config.json"
pnpm foliwake site list
pnpm foliwake page checkA full local installation
The quickstart has a complete local configuration with storage, for trying publication on one computer. code.repository: null binds a local-only Git checkout. If set to a remote URL, the checkout's origin must match. Give every site its own bucket, state directory and hosts. Restart serve all after configuration changes.
For local trials, pnpm store:up starts SeaweedFS on 127.0.0.1:8333. init creates a missing site bucket; other commands do not. Storage credentials and preview or cache tokens belong in environment variables, referenced by name in the configuration. Do not put secret values in the JSON file. A storage without accessKeyEnv/secretKeyEnv gets FOLIWAKE_S3_ACCESS_KEY/FOLIWAKE_S3_SECRET_KEY or the local test keys, and only when its endpoint is on this computer (127.0.0.1, localhost, *.localhost, [::1]); any other http(s) endpoint without them is refused.
Back up the bucket, stateDir and your content and frontend sources. The bucket holds published releases; the state directory holds workflow history and pending work. Restore state while commands are stopped, then use pnpm foliwake operation recover --wait (see troubleshooting). Treat recovery as an operator procedure and inspect the resulting status before resuming publication.
To start a site's storage over (an emptied bucket, a fresh state, release 1 again), use pnpm foliwake site reset-storage --site <id>, or «Reset storage» in the dashboard's Storage screen; only the installation's owner may. It prints what is lost first and asks you to type the site id. It archives the state under <stateDir>/archive/ instead of deleting it, deletes only the objects of that site's own bucket, binds bucket and state again, prepares the code and syncs the sources; it publishes nothing. Live is empty (no pages) until you publish again. On R2 or S3, the site's storage key needs permission to delete objects. If it stops, it names the step; run it again to go on from there. Restart origin and integration afterwards.
The optional local Varnish cache runs with pnpm cache:up -- --config <file> and stops with pnpm cache:down. Preview traffic is never cached. For a server installation, see install with Docker. The configuration dashboard runs with pnpm foliwake admin --port 0 and listens on loopback. It provides configuration, source checks, preview, selected-page publication and new code releases. Sign in with an e-mail link; on your own computer, create your account once with pnpm foliwake account bootstrap --email you@example.com --public-origin http://127.0.0.1:<port>, using the port the dashboard printed, and open the link it prints. See accounts, roles and sign-in. Keep sign-in links private. Explicit previewUrl and liveUrl settings control the links shown to authors; an external preview URL is not proof of access protection. liveUrl also gives every live page its canonical link (site settings).
Images are resized by Foliwake by default: every published image is stored at its original width and at those of 480, 960 and 1600 px that are smaller (a GIF at its original width only), which works with any storage and cache. A site behind an image CDN can set "media": {"resize": "cdn", "cdnBase": "https://media.example.com"} (or choose «Resized by a CDN» under Settings › Media): Foliwake then stores each image once, at its original width (metadata still stripped, every image still checked), and live pages ask Cloudflare Images on that host for the same widths. Preview pages keep using Foliwake's own image. Cloudflare's free plan includes 5,000 unique transformations a month; each image counts once per width it lists (one to four) and output format.
Content images load lazily by default ("media": {"loading": "lazy"}, the same as leaving it out): the images of a page's first section keep the browser's normal loading, and the first of them also gets fetchpriority="high"; every later image gets loading="lazy" decoding="async", so the browser fetches it only when it comes near the screen. A page without sections (no authoring: blocks-v3) keeps only its first image eager. Set "media": {"loading": "eager"} (it combines with resize; or foliwake site set media.loading eager) for a host that needs every image while the HTML loads, such as an offline copy: the pages then carry no loading attributes at all. The setting applies to pages prepared after the change, in preview and live, in the full page and in .plain.html alike; foliwake dev always uses the default.
