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, or KiB, MiB, GiB, powers of 1024). In the file a bare integer is milliseconds for a duration and bytes for a size.
  • --store, --gateway.trusted-proxies and --triggers.allow-cidrs may 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 in MIMIC_STORE) or in the file, readable by the server's user alone; or the password alone in PGPASSWORD or a PGPASSFILE. A URL with a password given as a flag is refused.
  • The bootstrap superuser's password comes from --bootstrap-password-file or MIMIC_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

OptionDefaultMeaning
postgres-urlnoneThe home store's URL; required. MIMIC_POSTGRES_URL stands in for it
storenoneAnother store of the deployment, NAME=URL, once for each
postgres.pool-size64The connections the pool holds to each store (4 to 1000); one more of its own to each
deployment-namemimicRecorded at the first start; a store of another deployment is refused
bootstrap-adminnoneThe superuser created at the first start if absent; needs a password
bootstrap-password-filenoneA file holding its password (or MIMIC_BOOTSTRAP_PASSWORD); trailing line breaks are dropped

Listeners and TLS

OptionDefaultMeaning
listen.public0.0.0.0:7700The API and sessions; 0.0.0.0:443 by default with ACME
listen.operations127.0.0.1:7702/livez, /readyz, /status and /metrics, unauthenticated
public-urlnoneThe public base URL; ACME orders a certificate for its host
public-tls.modeautofiles, acme or off; auto picks one
public-tls.certnoneThe public listener's certificate chain, PEM, leaf first; with .key
public-tls.keynoneIts key, PEM
acme.directoryLet's EncryptThe ACME directory certificates are ordered from (https)
acme.emailnoneThe ACME account's contact
acme.http-listennoneAnswer http-01 challenges here (0.0.0.0:80) rather than tls-alpn-01
gateway.trusted-proxiesnoneProxies (addresses or networks) whose X-Forwarded-For names the source
listen.internalnoneWhere peers forward to this process; none: it runs alone
advertise.internallisten.internalThe address peers dial
internal.secret-filenoneThe deployment's internal secret, at least 32 bytes, the same for every process
internal.tls-certnoneCertificates instead of a secret: this process's certificate
internal.tls-keynoneIts key
internal.tls-canoneThe CA peers' certificates chain to
internal.tls-peer-namenoneA name (SAN URI or DNS name) every peer's certificate must carry

See Network and TLS.

Runtime

OptionDefaultMeaning
lease-ttl5sHow long a partition's lease lives unrenewed (1 s to 10 min)
drain-timeout20sHow long a stopping process may take to hand its partitions over before it exits anyway
resident-memoryhalf of the memoryWhat resident documents and their buffers hold in all: half of GOMEMLIMIT, else half of the host's memory
backup.merge-segments256The backup segments this process's read-backs and restores hold open at once (about 1.8 MiB each)
sealer.keys-filenoneThe keys that seal and open backups (see Backups)
triggers.allow-cidrsnoneAddress ranges webhooks may reach besides public ones
triggers.allow-httpoffLets endpoints be plain http and webhooks reach any address: development only
migrations.allow-unfiltered-sandboxoffOn Linux, runs migration sandboxes without their system-call filter
log.formatjsonjson (an object a line) or pretty (key=value pairs)
log.filterinfoThe 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,2

Each 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.

SettingDefaultMeaning
cors_originsnoneBrowser origins allowed to call the API: *, or origins separated by commas
session_protocols4,3,2The session protocol versions served: 4,3,2, 4,3, 3,2, 3 or 2
access_max_staleness_ms10000How stale a process's view of access data may be, in milliseconds (7000 to 3600000; no unit)
password_iterations600000The iterations new password hashes take (100000 to 2000000); a login rehashes a weaker stored hash
audit_retention400dHow long audit entries are kept (1 d to 3,653 d)
usage_retention35dHow 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.