Configuration
The options of mimicd serve with their variables and defaults, checking and reloading them, the deployment settings, and the earlier server's options.
A process is configured by the options of mimicd serve. What every process
of a deployment must agree on (backups, browser origins, retentions) is
not an option but a deployment setting, stored in the home store and
followed by every process without a restart.
How options are set
Every option is a flag (--listen.public), an environment variable
(MIMIC_ and the option's name in upper case, with - and . as _:
MIMIC_LISTEN_PUBLIC), and a key of the TOML file that --config (or
MIMIC_CONFIG) names, its dotted name a table (public in [listen]) or a
dotted key (listen.public). A flag wins over the environment, which wins
over the file, which wins over the default; an option takes its value from
one source only.
# /etc/mimicd/mimicd.toml (the store's URL in MIMIC_POSTGRES_URL)
deployment-name = "acme-prod"
bootstrap-admin = "admin"
bootstrap-password-file = "/etc/mimicd/admin-password"
public-url = "https://mimic.example.com"
[listen]
public = "0.0.0.0:443"
operations = "127.0.0.1:7702"
[acme]
email = "ops@example.com"
[gateway]
trusted-proxies = ["10.0.0.0/8"]
[log]
format = "json"
filter = "info"The repository's mimicd/mimicd.example.toml is a commented file to start
from. mimicd serve --help lists every option with its variable and
default.
- Durations are an integer with a unit (
ms,s,m,h,d). Sizes are an integer with an optional unit (B,KB,MB,GB, powers of 1000, orKiB,MiB,GiB, powers of 1024). In the file a bare integer is milliseconds for a duration and bytes for a size. --store,--gateway.trusted-proxiesand--triggers.allow-cidrsmay be given more than once: as repeated flags, as an array in the file, or as lines of their variable. Every other option is given once.- A variable that is set but empty counts as unset. A
MIMIC_variable that names no option is warned of at start and otherwise ignored. - The container image sets
MIMIC_LISTEN_OPERATIONS=0.0.0.0:7702. Give the operations listener by flag or variable there: a file's value does not apply over a variable.
Secrets
Secrets never come from a flag, which process listings show to other users of the host.
- The store's URL, when it holds a password, is given in
MIMIC_POSTGRES_URL(other stores inMIMIC_STORE) or in the file, readable by the server's user alone; or the password alone inPGPASSWORDor aPGPASSFILE. A URL with a password given as a flag is refused. - The bootstrap superuser's password comes from
--bootstrap-password-fileorMIMIC_BOOTSTRAP_PASSWORD, never both. - The internal secret and the sealer's keys are files
(
--internal.secret-file,--sealer.keys-file).
--check shows every password as <redacted>.
Options
Store and deployment
| Option | Default | Meaning |
|---|---|---|
postgres-url | none | The home store's URL; required. MIMIC_POSTGRES_URL stands in for it |
store | none | Another store of the deployment, NAME=URL, once for each |
postgres.pool-size | 64 | The connections the pool holds to each store (4 to 1000); one more of its own to each |
deployment-name | mimic | Recorded at the first start; a store of another deployment is refused |
bootstrap-admin | none | The superuser created at the first start if absent; needs a password |
bootstrap-password-file | none | A file holding its password (or MIMIC_BOOTSTRAP_PASSWORD); trailing line breaks are dropped |
Listeners and TLS
| Option | Default | Meaning |
|---|---|---|
listen.public | 0.0.0.0:7700 | The API and sessions; 0.0.0.0:443 by default with ACME |
listen.operations | 127.0.0.1:7702 | /livez, /readyz, /status and /metrics, unauthenticated |
public-url | none | The public base URL; ACME orders a certificate for its host |
public-tls.mode | auto | files, acme or off; auto picks one |
public-tls.cert | none | The public listener's certificate chain, PEM, leaf first; with .key |
public-tls.key | none | Its key, PEM |
acme.directory | Let's Encrypt | The ACME directory certificates are ordered from (https) |
acme.email | none | The ACME account's contact |
acme.http-listen | none | Answer http-01 challenges here (0.0.0.0:80) rather than tls-alpn-01 |
gateway.trusted-proxies | none | Proxies (addresses or networks) whose X-Forwarded-For names the source |
listen.internal | none | Where peers forward to this process; none: it runs alone |
advertise.internal | listen.internal | The address peers dial |
internal.secret-file | none | The deployment's internal secret, at least 32 bytes, the same for every process |
internal.tls-cert | none | Certificates instead of a secret: this process's certificate |
internal.tls-key | none | Its key |
internal.tls-ca | none | The CA peers' certificates chain to |
internal.tls-peer-name | none | A name (SAN URI or DNS name) every peer's certificate must carry |
See Network and TLS.
Runtime
| Option | Default | Meaning |
|---|---|---|
lease-ttl | 5s | How long a partition's lease lives unrenewed (1 s to 10 min) |
drain-timeout | 20s | How long a stopping process may take to hand its partitions over before it exits anyway |
resident-memory | half of the memory | What resident documents and their buffers hold in all: half of GOMEMLIMIT, else half of the host's memory |
backup.merge-segments | 256 | The backup segments this process's read-backs and restores hold open at once (about 1.8 MiB each) |
sealer.keys-file | none | The keys that seal and open backups (see Backups) |
triggers.allow-cidrs | none | Address ranges webhooks may reach besides public ones |
triggers.allow-http | off | Lets endpoints be plain http and webhooks reach any address: development only |
migrations.allow-unfiltered-sandbox | off | On Linux, runs migration sandboxes without their system-call filter |
log.format | json | json (an object a line) or pretty (key=value pairs) |
log.filter | info | The level logged from: error, warn, info, debug, trace, or off |
Checking a configuration
mimicd serve reads every source and checks every option before it opens
anything, reports every problem at once (each naming its option and
source), and exits with code 2. mimicd serve --check reads and checks the
same and, when the options are valid, prints them as lines of a TOML file,
each with its source, names the MIMIC_ variables that name no option, and
exits 0. It opens no listener and no store.
Checked as a process starts, never by --check, and refused with exit
code 5, which a restart does not change: PostgreSQL's settings that lose
acknowledged writes, a PostgreSQL older than 16, a schema of a later build,
the deployment's name the store records, and each --store's identity. A
store that cannot be reached, or a listener that cannot be bound, exits
with code 1.
Reloading
SIGHUP reads every source again (the file again; the flags and the
environment are the process's own) and checks it all. If any option does
not validate, none is applied: those in force stay, and a warning lists the
problems the next start would refuse. Of the options that changed,
gateway.trusted-proxies applies to requests that begin after it and
log.filter to lines logged after it; a warning names the others, which
apply at the next start. The public listener's certificate files are read
again on SIGHUP and every 30 seconds.
Deployment settings
Deployment settings are rows of the home store, at their defaults while none is stored. Every process reads them every second and follows a change without a restart.
mimicd admin settings list # those stored
mimicd admin settings get # every setting, its default where none is stored
mimicd admin settings set cors_origins=https://app.example.com session_protocols=4,3,2Each takes the home's URL. set takes several NAME=VALUE pairs and sets
all or none: a value out of bounds, or a combination that breaks a relation
between settings, is refused (exit code 2). A change is audited.
GET /v1/admin/settings (with status.read) answers the same.
| Setting | Default | Meaning |
|---|---|---|
cors_origins | none | Browser origins allowed to call the API: *, or origins separated by commas |
session_protocols | 4,3,2 | The session protocol versions served: 4,3,2, 4,3, 3,2, 3 or 2 |
access_max_staleness_ms | 10000 | How stale a process's view of access data may be, in milliseconds (7000 to 3600000; no unit) |
password_iterations | 600000 | The iterations new password hashes take (100000 to 2000000); a login rehashes a weaker stored hash |
audit_retention | 400d | How long audit entries are kept (1 d to 3,653 d) |
usage_retention | 35d | How long the usage history is kept (1 d to 3,653 d) |
backup_*, sealer_* | Backups' schedule, retention, destination and sealing: see Backups |
A duration setting takes an integer with a unit, as options do, or a bare
number of milliseconds; access_max_staleness_ms takes the bare number
alone.
The earlier server's options
mimicd serve has no data directory and no node identity: a process keeps
no state of its own. The earlier server's options (data-dir, node,
roles, zone, join, token, peer-tls.*, object-store.url,
memory, threads and the rest) are not options of this server, and are
refused as any unknown option is (exit code 2). Its settings for Raft,
placement, shards and replication are gone with what they configured, and
retry_horizon is the constant 30 days.