Repository navigation
Self hosting
How to put your own form.md on your own domain for a small team: one virtual machine, the server's own HTTPS certificate, an encrypted data directory, accounts by invitation. The scripts are in deploy/gcp; the same steps work on any Linux host with systemd.
The long, step-by-step version of this page, written for people who have never run a server, is .docs/SELF_HOSTING.md.
| Path | What lives there |
|---|---|
deploy/gcp/provision |
Creates the static address, the firewall rule, the snapshot schedule and the VM in Google Cloud, and prints the DNS records |
deploy/gcp/ship |
Builds the client and a linux binary from your checkout, copies them to the VM and runs install there |
deploy/gcp/install |
Runs on the VM as root: service user, directories, encryption key, env file, systemd unit |
deploy/gcp/instance.env |
The /etc/form-md/env a new VM starts with. Put your host name in it before the first ship
|
deploy/form-md.service |
The hardened systemd unit, shared with the installer script |
install.sh |
The other route: installs a released binary instead of one built from your checkout (Install) |
- One Compute Engine VM (e2-small, Debian 12, 20 GB balanced disk, Shielded VM, OS Login) with a static address and ports 80 and 443 open.
- The server terminating TLS itself with a Let's Encrypt certificate it fetches and renews (TLS-and-ACME).
- The SQLite database and uploads on the VM's disk, encrypted at rest with a key held as a systemd credential, so the service user never reads the key file (Encryption).
- 14 daily disk snapshots.
- Sign-up by invitation, which is the default.
A VM rather than a container platform that scales to zero or to many: the store is one SQLite file with a write-ahead log, which needs a local disk and exactly one server process.
- A domain or subdomain whose DNS records you can edit.
- A Google Cloud project with billing on, and
gcloudsigned in to it on your machine. - Go 1.26 or newer and Node.js 22 or newer on your machine (
deploy/gcp/shipbuilds there). - Your own copy of the repository: a fork, or a clone you keep. You will commit one edited file to it.
-
Put your host name in
deploy/gcp/instance.env, in place ofnotes.example.com. For a bare domain that should also answer on www, list both, comma-separated:FORMMD_ACME_DOMAINS=example.org,www.example.org. AddFORMMD_ACME_EMAIL=you@example.orgif you want the certificate authority to have a contact address. Commit the file to your copy. -
Provision:
GCP_PROJECT=your-project DOMAIN=notes.example.com deploy/gcp/provision
It is safe to run twice: each resource is looked up before it is created. It prints the static address and the DNS records.
-
Create the DNS records it printed, at the registrar or DNS host of the domain:
Type Name Value TTL A your host name the static address 300 A www(only if listed in the env file)the static address 300 CAA (optional) the domain 0 issue "letsencrypt.org"3600 No AAAA record: the VM has no IPv6 address. If the zone is on Cloudflare, the A records must be DNS only, so the certificate authority reaches the VM itself on ports 80 and 443. Wait until
dig +short notes.example.comprints the address. -
Ship and install:
GCP_PROJECT=your-project deploy/gcp/ship
It builds the client and a static linux binary stamped with the
Makefileversion, copies them to the VM with the env file and the unit, and runsdeploy/gcp/installthere. On the first run it prints where the new encryption key is. Copy the key somewhere safe: a backup or a snapshot is unreadable without it. -
Open
https://and your host name at once and create the owner account. Until an owner exists, the set-up screen answers whoever opens the address first. The first request takes a few seconds while the certificate is fetched. -
In Instance settings, General, set Public address to the
https://address and give the instance a name. Links in mail, invitations and sign-in callbacks use the public address. -
Turn on two-factor sign-in for your account (Account settings), then invite the team from Workspace settings. Registration stays By invitation only unless you change it in Instance settings, Sign-in; Email domain allowed lets anyone with an address at your company's domain create an account.
-
Set up mail so invitations and unread notifications are delivered (Mail).
To upgrade, pull the new version into your copy and run deploy/gcp/ship again: it replaces the binary and restarts the service, and leaves the env file and the key alone.
| Variable | Default | Used by | Purpose |
|---|---|---|---|
GCP_PROJECT |
none, required | provision, ship | The Google Cloud project id |
DOMAIN |
none, required | provision | The host name, for the DNS records it prints |
GCP_REGION |
us-central1 |
provision, ship | Region of the address and the snapshot schedule |
GCP_ZONE |
the region's -a zone |
provision, ship | Zone of the VM |
VM_NAME |
form-md |
provision, ship | Name of the VM; the address, firewall rule and schedule are named after it |
VM_MACHINE |
e2-small |
provision | Machine type |
VM_DISK_GB |
20 |
provision | Boot disk size |
VM_TAG |
form-md-web |
provision | Network tag the firewall rule applies to |
VM_ARCH |
amd64 |
ship | Processor the binary is built for |
These are read by the scripts only; the server never reads them.
Any Linux host with systemd, a public address and ports 80 and 443 reachable works the same way. Two routes:
- A release, with the installer script: download
install.shfor the version you want and run it as Install describes, then put the lines ofdeploy/gcp/instance.env(with your host name) in/etc/form-md/env, add the encryption key as in Encryption, andsudo systemctl restart form-md. - Your own build: copy a Linux build of the binary (named
form-md; the first half ofdeploy/gcp/shipshows the commands),deploy/gcp/install,deploy/gcp/instance.envanddeploy/form-md.serviceinto one folder on the host and runsudo bash install ./form-mdthere. It is the same scriptshipruns.
If you cannot open ports 80 and 443, use a tunnel instead (Tunnel).
Out of the box: passwords hashed with argon2id, two-factor sign-in per account, invitation-only registration and a sign-in rate limit, with a fail2ban filter in deploy/fail2ban (Operations). To put an identity provider in front, set up single sign-on in Instance settings, Sign-in: Google, Microsoft, any OpenID Connect provider, or SAML 2.0. Auth0 walks through Auth0.
- Logs:
sudo journalctl -u form-md -n 50on the VM. - Health:
curl -fsS https://notes.example.com/healthz. - Backups: the snapshot schedule keeps 14 daily disk snapshots;
form-md backupmakes a consistent copy while people work (Backup-and-restore). Keep the encryption key with the backups, never inside them. - Checks:
form-md doctor(Operations). - Shell on the VM:
gcloud compute ssh form-md --zone=us-central1-a.
- Changing
/etc/form-md/envneedssudo systemctl restart form-md.installwrites that file only when it is absent, so editingdeploy/gcp/instance.envlater changes nothing on a VM that already has one: edit the file on the VM. - The certificate is fetched on the first HTTPS request, and only once DNS points at the VM. If the address was opened before DNS was right, wait a minute and reload;
journalctl -u form-mdshows the certificate authority's answer. - A proxied (orange cloud) Cloudflare record breaks certificate issuance, because the certificate authority then reaches Cloudflare and not the VM.
- The terminal and Claude Code panel are off on a hosted instance (
FORMMD_TERMINAL=offin the env file): it would be a shell on the VM for the owner. Leave it off unless you want exactly that (Terminal-and-Claude-Code). -
shipwarns, and carries on, when the start-up bundle measures over the development budget on your machine;make buildand CI keep the hard limit. - On another machine type or zone, pass the same
VM_NAME,GCP_REGIONandGCP_ZONEtoshipthat you passed toprovision. - The scripts in
deploy/gcphave been syntax-checked only in this form; runprovisionon a scratch project first.
Install · Configuration · TLS-and-ACME · Encryption · Auth0 · Backup-and-restore · Operations
form.md
Running an instance
Using it
- Data-views
- Offline
- API-and-agents
- Form-family
- Context-and-knowledge
- Terminal-and-Claude-Code
- Extensions
Changing the code