RiskWrenv0.10.1
GitHub

Configuration

This guide is for whoever runs the server. It covers riskwren.toml and every key in it, environment variables and where secrets go, the data home, single sign-on, scheduled work, email, the optional assistant, PostgreSQL, backups, sizing, upgrades, running behind a reverse proxy, and the guard on demo installations. Deployment puts these together for a server that real people rely on.

Commands here are written uv run riskwren …, as they are run from a checkout of the repository. An installation made as a package, as a service on a host, or in a container runs the same commands as riskwren …, without uv run.

What is configured where#

RiskWren keeps two kinds of settings apart.

KindWhere it livesExamples
How the server runsriskwren.toml and the environmentAddress, port, database, data home
The program and the product's lookThe database, set in the app or by a program packRisk categories, appetite, the scoring method, cadences, vocabularies, name, logo, colors

This guide is about the first. For the second, see Running the program.

The look is the one thing that can live in either place. Most organizations set it in the app. One that needs its brand reproduced exactly can fix it in the file: see [branding].

Where the file is found#

uv run riskwren init writes a commented riskwren.toml in the current directory. Every command looks for the file in this order:

  1. The --config FILE option (short form -c), given before the command.
  2. The RISKWREN_CONFIG environment variable.
  3. ./riskwren.toml.
uv run riskwren --config /etc/riskwren/riskwren.toml doctor

Relative paths in the file are resolved against the file's own directory, not the directory you run from. An installation therefore moves as a unit.

Every section and key#

The file has seven sections: [server], [database], [data], [sso], [mail], [assistant], and [branding]. Every section and every key may be left out, and then takes its default.

SectionNeeded?
[server], [database], [data]How and where the server runs. The defaults serve one machine with SQLite, so a new installation can start with the file init writes
[sso], [mail], [assistant]Optional. Each turns on something that is off until it is set: single sign-on, email, the assistant
[branding]Optional. It fixes the look exactly, in place of what is set in the app

A section or key that RiskWren does not know is an error, not something it ignores. Every problem in the file is reported together.

[server]#

KeyDefaultMeaning
host"127.0.0.1"The address the web server listens on. Keep 127.0.0.1 when a reverse proxy on the same machine terminates TLS. Use 0.0.0.0 only behind one
port8000The port
workers1How many server processes to run. One is enough for SQLite and small teams
base_url""The public address people use to reach RiskWren, such as "https://riskwren.example.org", with no path. Used for the single sign-on redirect address, for links in email, and for the record's address in webhook messages, which leave it out without one. Set it when you use single sign-on or email, and on any server people rely on
session_idle_hours12A sign-in ends after this long without activity. Fractions are allowed: 0.5 is half an hour, as OWASP's verification standard asks at its level 2
session_max_days7A sign-in ends after this long in any case. 0.5 is twelve hours, the same standard's level 2
schedulertrueRun scheduled work inside this server. With false, nothing is sent and no reminder is made unless riskwren jobs run is scheduled some other way. See Scheduled work

host, port, and workers can also be given to uv run riskwren serve as --host, --port, and --workers, which take precedence for that run.

[database]#

KeyDefaultMeaning
url""Empty means SQLite, in a file inside the data home. For PostgreSQL, an address beginning postgresql+psycopg://. See Use PostgreSQL

[data]#

KeyDefaultMeaning
home"var"The data home: the one directory that holds everything not in the database

[sso]#

Single sign-on is optional and off until both issuer and client_id are set. See Single sign-on.

KeyDefaultMeaning
issuer""The identity provider's issuer address. For Microsoft Entra ID, "https://login.microsoftonline.com/<tenant id>/v2.0"
client_id""The client (application) ID the provider gave RiskWren
client_secret_env"RISKWREN_SSO_CLIENT_SECRET"The name of the environment variable that holds the client secret. The secret itself is refused in the file
scopes"openid profile email"What RiskWren asks the provider for. Must include openid
roles_claim"roles"The claim in the ID token that lists a person's application roles or groups
label"Sign in with your organization account"The words on the sign-in button
trust_emailfalseAccept the provider's address for a person without its saying the address is verified. Entra ID does not say, so set this to true for a single Entra ID tenant
create_accountstrueMake an account the first time someone signs in. With false, only people who already have an account can sign in
local_sign_intrueKeep the password form for everyone who has a password. With false, only administrators may sign in with a password

[mail]#

Email is optional and off until both host and from_address are set. See Email.

KeyDefaultMeaning
host""The SMTP server
port587Its port
security"starttls""starttls" (usual on port 587), "tls" (port 465), or "none"
username""The account to sign in to the mail server with, if it needs one
password_env"RISKWREN_MAIL_PASSWORD"The name of the environment variable that holds the password. The password itself is refused in the file
from_address""The address messages come from
from_name""The name beside it. Empty means the product's name
digest_hour7The hour of the day, in UTC, after which daily summaries are sent

[assistant]#

An assistant that summarizes records and drafts risks. Optional and off; see The assistant.

KeyDefaultMeaning
enabledfalseWhether it is on. While it is off, none of it is installed
provider"openai"The protocol the provider speaks: "openai" (the Chat Completions API, which servers on your own machines speak too), "anthropic" (the Messages API), or "bedrock" (Amazon Bedrock's Converse API)
url""The API's root. Empty means the provider's own service. It must be https:// unless it is on this computer
model""The model to use. Needed when it is on
key_env""The name of the environment variable that holds the key, such as OPENAI_API_KEY. The key itself is refused in the file. A server on this computer may need none. For Bedrock, empty means AWS_BEARER_TOKEN_BEDROCK, or else AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
region"us-east-1"For Bedrock
send"public, internal"The data classes whose records may be sent, besides records with none. Restricted records never are
daily_limit40Exchanges for one person, or one token, in a day
time_limit_seconds90For one exchange, every call to the provider and the tools together
max_tokens1500The longest answer, in the provider's tokens
temperature0.2How much the answers vary

[branding]#

Optional. Leave it out and the look is set in the app, under Admin → Appearance.

Use this section when the look has to be exact: every color by day and after dark, the official logo files, the brand's typefaces. It is also the way to keep a brand in version control, or to give several installations the same look.

What is set here wins over what the app stores, and shows under Admin → Appearance as locked, marked Set in the configuration file. Whatever this section leaves out can still be changed in the app. Nothing here is written to the database, so taking a line out gives that setting back to the app. A change takes effect when the server is restarted.

KeyMeaning
product_nameThe name in the sidebar, the browser tab, and email. Up to 40 characters
organization_nameYour organization's name, on the sign-in page
show_powered_byfalse to hide the small "Powered by RiskWren" link
logo_light, logo_darkImage files for light and dark backgrounds. With no logo_dark, the light one is used for both
faviconThe browser tab icon
sign_in_imageThe picture beside the sign-in form
logo_heightThe logo's height in the sidebar, in pixels, from 20 to 48. The usual is 30. Use it where a brand sets a least width for its logo
fontThe typeface for everything, as a list of font names in order of preference
font_headingsA different typeface for page titles and section headings
sign_in_messageA message on the sign-in page, up to 600 characters
email_footerThe last line of every email
footer_linksUp to five links, each { label = "…", url = "…" }
termsThe organization's own words for kinds of record and for units, each { one = "…", many = "…" }: see below
paletteOne of the built-in palettes: wren, slate, garnet
accent, accent_darkAn accent color over a built-in palette, as hex. Not needed when [branding.colors] is set
rating_rampHow ratings are colored: ordinal, one hue from pale to deep, or signal, green through amber to red

Image paths are relative to the file's folder. Images are PNG, JPEG, WebP, or SVG, up to 2 MB, and are served as they are: RiskWren scales a logo and changes nothing else about it.

Fonts are named, never shipped. A name works on a computer that has the font installed, and the next name in the list is tried on one that does not, so end the list with fonts every computer has. A font that is licensed, as most brand typefaces are, cannot be put on the server for everyone.

Your own words#

Where your organization says department for what RiskWren calls a unit, or vendor for a third party, name the word once and it is used in the menu, in page titles, and for the kinds of record:

[branding.terms]
unit = { one = "Department", many = "Departments" }
third_party = { one = "Vendor", many = "Vendors" }
issue = { one = "Finding", many = "Findings" }

Words can be set for unit, process, system, third_party, service, information, site, issue, exception, and incident, each up to 30 characters. Give both words or neither. Statuses, roles, and the program's own words (its scales, appetite, and vocabularies) are already yours to change under Admin → Program.

Exact colors#

[branding.colors.day] and [branding.colors.night] replace the built-in palettes. Give both, or neither. Each color is a hex value.

ColorWhat it isIf left out
bgThe page behind everythingNeeded
surfaceCards, panels, and fieldsNeeded
textOrdinary textNeeded
mutedSecondary textNeeded
accentLinks, primary buttons, and the selected pageNeeded
on_accentText on a primary buttonBlack or white, whichever reads better
stripeThe second color of the stripe across the top of the pageThe accent
borderHairlines between thingsA step from the surface
border_strong, surface_2, surface_3, subtle, accent_hover, accent_softFiner shades: stronger lines, the sidebar and quieter panels, the faintest text, a button under the pointer, the background of a selected itemWorked out from the colors above, a step lighter or darker on the same hue
[branding]
product_name = "Lantern"
organization_name = "Northmere Institute for Health Research"
logo_light = "brand/northmere.svg"
logo_dark = "brand/northmere-white.svg"
favicon = "brand/northmere-icon.png"
font = ["Inter", "Arial"]

[branding.colors.day]
bg = "#f6f5f2"
surface = "#ffffff"
text = "#1d2733"
muted = "#57606b"
accent = "#1f5f8b"

[branding.colors.night]
bg = "#12171d"
surface = "#1a222b"
text = "#ffffff"
muted = "#b9c2cc"
accent = "#6cb6e6"
on_accent = "#0f1a24"

RiskWren refuses to start with colors that cannot be read. Text on the page and on a card, secondary text, the accent on a card, and text on the accent must each reach a contrast of 4.5 to 1, by day and after dark, and the message says which pair fell short and by how much. A brand color that is too pale for text on white, as a bright yellow or a light blue often is, belongs in stripe, not accent.

Three things are left alone, because they carry meaning: the colors for within appetite, warning, and above it; the colors of the ratings (chosen with rating_ramp); and the colors that tell kinds of record apart. When exact colors are set, people are no longer offered a palette of their own to choose, since there is nothing for it to change. Light and dark mode remain each person's choice.

To check a brand on every screen, run the accessibility audit with it: put the [branding] section in a file of its own, with full paths for its images, and name that file in RISKWREN_DEMO_BRANDING when you run node scripts/a11y-audit.mjs.

RiskWren also gives advice that does not stop it running. serve and doctor warn when several workers share one SQLite file, when base_url is http:// on a host other than localhost, and when email is set up without a base_url for its links.

Environment overrides#

Every key in [server], [database], [data], [sso], [mail], and [assistant] can be set by an environment variable named RISKWREN_<SECTION>_<KEY>, in capitals. The environment wins over the file. [branding] cannot be set this way: it is read only from the file.

A value from the environment is read as the key's kind: a number for a number, and for a switch true or false (or 1 and 0, yes and no, on and off). A wrong value is reported with the variable's name. A variable that names no key is ignored, so check the spelling.

The ones most often set this way:

VariableSets
RISKWREN_SERVER_HOST, RISKWREN_SERVER_PORT, RISKWREN_SERVER_WORKERS[server] host, port, workers
RISKWREN_SERVER_BASE_URL[server] base_url
RISKWREN_SERVER_SCHEDULER[server] scheduler
RISKWREN_SERVER_SESSION_IDLE_HOURS, RISKWREN_SERVER_SESSION_MAX_DAYS[server] session_idle_hours, session_max_days
RISKWREN_DATABASE_URL[database] url, which may carry its password here, unlike in the file
RISKWREN_DATA_HOME[data] home
RISKWREN_SSO_ISSUER, RISKWREN_SSO_CLIENT_ID[sso] issuer, client_id
RISKWREN_MAIL_HOST, RISKWREN_MAIL_FROM_ADDRESS[mail] host, from_address
RISKWREN_ASSISTANT_ENABLED, RISKWREN_ASSISTANT_MODEL[assistant] enabled, model
RISKWREN_SERVER_PORT=8080 uv run riskwren serve

Other variables RiskWren reads#

These are not keys of the file. Most hold a secret, which is why they live only in the environment.

VariableHolds
RISKWREN_CONFIGThe configuration file itself. See Where the file is found
PGPASSWORDThe PostgreSQL password, read by the database driver
RISKWREN_SSO_CLIENT_SECRETThe single sign-on client secret, unless [sso] client_secret_env names another variable
RISKWREN_MAIL_PASSWORDThe mail server's password, unless [mail] password_env names another variable
The variable [assistant] key_env namesThe assistant provider's key. For Bedrock, AWS_BEARER_TOKEN_BEDROCK, or AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (with AWS_SESSION_TOKEN for short-lived keys)
RISKWREN_URL, RISKWREN_TOKENFor riskwren tools only, on someone's own computer: the server's address and the token the tools use. See The API

Secrets are refused in the file#

riskwren.toml is meant to be safe to read, copy, and keep under version control. RiskWren refuses to start if the file holds a secret: a key whose name ends in password, secret, token, or key, or a database address with a password in it.

Put secrets in the environment instead, in the variables listed under Other variables RiskWren reads. For the database, set the password in PGPASSWORD, or put the whole address, password and all, in RISKWREN_DATABASE_URL. Where the file needs to say which variable holds a secret, it names the variable (client_secret_env, password_env, key_env), never the value. Deployment shows where the environment is kept for a container and for a service.

The data home#

The data home is created by init. With the default settings it is ./var.

PathHolds
riskwren.dbThe SQLite database, when no database address is set
brand/Uploaded logos and the tab icon
logs/The server's log, riskwren.log, rotated at 5 MB with five kept
files/Evidence files, each stored once under the SHA-256 of its content. Nothing here is served directly
exports/Reserved for exports
backups.jsonWhen and where the last backup was taken, for doctor and Admin → Operations
.riskwren-homeA marker that says this directory is a data home

Single sign-on#

You do not need this to use RiskWren. A new installation signs in with an email address and a password that RiskWren keeps, and an evaluation or a small team needs nothing else. Single sign-on is something an administrator adds when the organization wants people to use the account they already have, under its own multi-factor authentication and offboarding.

When it is on, it sits beside local accounts and does not replace them. The sign-in page shows the organization's button first, with the password form folded beneath it. An administrator can always sign in with a password, so a provider that is down or misconfigured never locks everyone out.

RiskWren speaks OpenID Connect: the authorization-code flow with PKCE. It works with Microsoft Entra ID and with any provider that follows the standard and signs its ID tokens with RS256.

What you set, and where#

WhatWhere
The provider's issuer and RiskWren's client ID[sso] in riskwren.toml
The client secretAn environment variable, RISKWREN_SSO_CLIENT_SECRET unless you name another
RiskWren's public address[server] base_url, so the redirect address is always the same
Which of the provider's roles or groups give which role hereIn the app: Admin → Single sign-on

The redirect address to give the provider is <base_url>/api/v1/sso/callback. Admin → Single sign-on shows it, before and after you set anything up.

With Microsoft Entra ID#

  1. In the Entra admin center, open App registrations → New registration. Name it, choose Accounts in this organizational directory only, and add a Web redirect URI: your base_url followed by /api/v1/sso/callback.
  2. From the registration's Overview, copy the Application (client) ID and the Directory (tenant) ID.
  3. Under Certificates & secrets, add a client secret and copy its Value. It is shown once.
  4. Under App roles, create a role for each kind of access you want to give from Entra ID, for users and groups. The role's Value is what RiskWren sees: for example RiskWren.Admin, RiskWren.Assessor, RiskWren.Security.Leader.
  5. Under Enterprise applications, open the same application, then Users and groups, and assign people or groups to those roles. Under Properties, set Assignment required to Yes if only assigned people should be able to sign in.
  6. Under Token configuration, add the optional ID claim email.
  7. In riskwren.toml:

``toml [server] base_url = "https://riskwren.example.org" [sso] issuer = "https://login.microsoftonline.com/<tenant id>/v2.0" client_id = "<application id>" trust_email = true ``

  1. Put the secret's value in RISKWREN_SSO_CLIENT_SECRET in the environment RiskWren starts in, and restart it.
  2. Run uv run riskwren doctor. It reads the provider and says whether the secret is set.
  3. Sign in with a password as an administrator, open Admin → Single sign-on, choose Check the connection, and map each app role's value to a role here.

Three things about Entra ID are worth knowing.

With another provider#

Register RiskWren as a confidential web client with the redirect address above. Set issuer to the address whose /.well-known/openid-configuration the provider serves, and client_id to what it gave you. Have it put a person's groups or roles in a claim, and name that claim in roles_claim (many providers call it groups). If the provider says email_verified is true for its addresses, leave trust_email as it is.

Roles from the provider#

Admin → Single sign-on lists mappings. Each says: everyone the provider gives this value gets this role here.

Role hereFor
Works in a unitOne unit. Membership grants nothing by itself; it decides what a member sees
Steward, LeaderOne unit, and everything beneath it. A leader's mapping also says what they may accept
Assessor, ManagerThe whole organization, or one unit
Auditor, AdministratorThe whole organization

Who a person is#

A person is known by the provider's own identifier for them, never by an address alone. The first time someone signs in:

A disabled account cannot come in through the provider. Signing out of RiskWren does not sign anyone out of the provider.

Passwords, once it is on#

With local_sign_in = true, anyone who has a password may still use it. With false, only administrators may. There is no setting that removes the administrator's password, on purpose: it is the way in when the provider cannot be reached.

Try it on a laptop#

scripts/dev_identity_provider.py is a stand-in provider for trying this out. It has a fixed list of people and no passwords, and its signing key is published in the file, so it proves nothing and listens only on the machine it runs on.

uv run python scripts/dev_identity_provider.py

Then set issuer = "http://127.0.0.1:8099", client_id = "riskwren-dev", and trust_email = true under [sso], and start RiskWren with RISKWREN_SSO_CLIENT_SECRET=dev-secret in its environment.

Scheduled work#

RiskWren does six things by itself, so that nobody has to remember to. Each job has a key, which names it to riskwren jobs run.

JobKeyHow oftenWhat it does
The calendarcalendarEvery hourBrings risks up to date when a plan passes its date or an acceptance ends
RemindersremindersEvery hourReminds people of what is nearly due, and tells stewards and leaders what stays late; marks an evidence request met once its evidence is attached. See Reminders
EmailmailEvery minuteQueues notices and daily summaries and sends what is waiting, where email is set up
WebhookswebhooksEvery minuteTells the addresses an administrator registered of what has happened, and tries again those that did not answer. See webhooks
MeasuresmeasuresEvery six hoursTakes the day's snapshot of every measure, for its trend; a later one the same day replaces it
HousekeepingtidyEvery dayRemoves run records older than ninety days and sign-ins that were never finished

The tidy job clears out RiskWren's own bookkeeping and changes no record. It has nothing to do with Reports → Tidy, the page that finds missing facts and duplicate records.

The server runs the jobs while it is up, looking for what is due every twenty seconds. Nothing needs to be installed or scheduled.

Running the jobs from the operating system#

To run the jobs from the operating system's scheduler instead of inside the server, set scheduler = false under [server] (or RISKWREN_SERVER_SCHEDULER=false) and run uv run riskwren jobs run every minute, from cron or a systemd timer, with the same configuration and environment as the server. A longer interval works, but email and webhooks then wait that long.

With the scheduler off and nothing else running the jobs, nothing is sent: no reminders are made, no email leaves, no webhook is told, risks are not brought up to date with the calendar, and measures have no trend. Notices of what is assigned to someone or decided for them are written as it happens, so those still appear in the app; they are not emailed. doctor warns when the scheduler is off and nothing has run for two days, and when the last run of any job failed.

Email#

You do not need this to use RiskWren. Notices and reminders are read in the app, under the bell at the top right, and on Home. Email sends the same notices to people's inboxes as well, for organizations that want that.

  1. Under [mail] in riskwren.toml, set host and from_address. If the mail server needs a sign-in, set username, and put the password in the RISKWREN_MAIL_PASSWORD environment variable.
  2. Set base_url under [server], so that messages can link back.
  3. Restart RiskWren, and run uv run riskwren doctor: it connects and signs in to the mail server, and sends nothing.
  4. Send yourself a message with Send me a test message under Admin → Operations, or send one to any account with uv run riskwren mail test you@example.org. Either says whether the mail server took it.

Then each person chooses, under Your account: each notice as it happens, one summary a day, or no email. The choice appears only once email is set up.

The assistant#

You do not need this to use RiskWren, and it is off. Turned on, it summarizes a record and drafts a risk from someone's own description, for whoever is signed in and from what they may see; The assistant in RiskWren describes what people see. While it is off, none of it is installed and nothing is sent anywhere. Administrators see how it is set up, check that the provider answers, and read every exchange under Admin → Assistant.

  1. Choose a provider the organization trusts with what people may see: its own model server (Ollama, vLLM, or anything that speaks the Chat Completions API), or a service it has an agreement with.
  2. Under [assistant], set enabled = true, the provider, the model, and, for a server of your own, its url. Put the key, if one is needed, in an environment variable and name it in key_env.
  3. Decide what may be sent: send lists the data classes whose records may go to the provider.
  4. Restart RiskWren, and use Check the connection under Admin → Assistant.
ProviderproviderurlThe key
A model server of the organization's own, on this computer or its network"openai"Its address, such as "http://127.0.0.1:11434/v1"; https:// unless it is on this computerOften none
A service that speaks the Chat Completions API"openai"Empty for the default service, or the service's addressThe variable named in key_env
A service that speaks the Messages API"anthropic"Empty for the default serviceThe variable named in key_env
Amazon Bedrock"bedrock"Empty; set regionAWS_BEARER_TOKEN_BEDROCK, or access keys

For a model on the same computer, with nothing leaving it:

[assistant]
enabled = true
provider = "openai"
url = "http://127.0.0.1:11434/v1"
model = "granite4:3b"

What it is careful about:

Use PostgreSQL#

SQLite is the default and needs no setup. Use PostgreSQL when many people will use RiskWren at once or you want more than one server process. The features and the data model are the same on both, and the test suite runs on both.

  1. Install the driver, which is optional:

``bash uv sync --extra postgres ``

  1. Create an empty database and a role that owns it, with your usual PostgreSQL tools.
  2. Set the address in riskwren.toml, without the password:

``toml [database] url = "postgresql+psycopg://riskwren@db.example.org:5432/riskwren" ``

  1. Put the password in the environment, then set up and check:

``bash export PGPASSWORD=… uv run riskwren init uv run riskwren doctor ``

To move an existing installation from SQLite to PostgreSQL, or back, see Move between SQLite and PostgreSQL.

Back up and restore#

uv run riskwren backup /backups/riskwren-2026-12-01.zip

backup writes the whole installation to one file: every table, every file the data home stores (evidence, attachments, uploaded logos), and a manifest that counts and fingerprints each of them and says which version of RiskWren took it. It reads everything as of one moment, so the server can go on running and people can go on working while it does. The file must not exist already. It holds everything, so keep it as carefully as the database itself: somewhere other than the server, and encrypted where your other backups are.

Some things are not in it, and are kept with the server's own configuration instead:

Not in a backupWhy
riskwren.tomlIt describes the server, not the records. Keep it in version control
The secrets in the environmentThey live only in the environment
The image files a [branding] section namesThey sit beside the configuration file, not in the data home
The data home's exports and logsExports can be made again, and logs belong to the machine

Take one every day, from a scheduled task, and keep the files away from the server; Deployment shows how for a container and for a service. doctor --production fails when no backup has been taken and warns when the last is more than two days old.

To restore, use the installation's riskwren.toml, pointed at an empty database and a data home with no files in it (for SQLite, a new data home is enough; for PostgreSQL, create an empty database), and do not run init first, since that makes a database that is no longer empty. Then:

uv run riskwren --config new/riskwren.toml restore /backups/riskwren-2026-12-01.zip

restore goes only into an empty database and a data home without files, so that nothing already there is overwritten or mixed in. It needs the same version of RiskWren that took the backup: restore with that version, then upgrade. Once loaded, every table is read back and fingerprinted, every file is checked, and the history is verified, and it says so; anything that does not match is named, and the command exits with 1. restore --describe FILE says what a backup holds, and which version took it, without restoring it.

Restore a backup now and then, onto a spare machine, to know that it works: Deployment has the steps. When something goes wrong covers restoring after a loss.

Move between SQLite and PostgreSQL#

A backup is the same whichever database it was taken from, so moving is a backup from one and a restore into the other:

uv run riskwren backup move.zip                       # with the old riskwren.toml
uv sync --extra postgres
export RISKWREN_DATABASE_URL=postgresql+psycopg://riskwren@db.example.org:5432/riskwren
uv run riskwren --config new/riskwren.toml restore move.zip

Stop the server before the backup, so that nothing is written after it, and start it on the new configuration once the restore says that everything matches. People stay signed in: their sessions move with everything else.

Sizing#

RiskWren was measured with 10,000 records (systems, processes, risks, and controls), on one laptop with 10 cores (scripts/measure.py, which anyone can run). Each simulated person read the pages people read most, one after another, with no pause between them, which is far harder than real use:

One person25 people at once, 2 workers25 people at once, 8 workers
A record, a list, the heat map, notices (median)under 15 ms200 to 300 ms25 to 80 ms
Home, search, and the dashboards (median)40 to 120 ms0.7 to 1.1 s0.5 to 0.7 s
Requests a second2881

Nothing failed. With one person, every page answered in under 120 milliseconds; the dearest pages are home, the risk dashboard, and the compliance dashboard, which count across the whole register for each person, and their cost does not grow with the number of records. With many people at once, RiskWren is limited by the processor: give it a worker for each core it may use (workers under [server]), and use PostgreSQL once there are several workers. A person reading and writing pauses between clicks, so 80 requests a second serves many hundreds of people at once.

Upgrade#

From a checkout of the repository:

  1. Read the new release's entry in the changelog. Its Upgrading from part says which migrations it brings, what it adds, and what looks or behaves differently afterwards.
  2. Stop the server, so that nothing is written after the backup.
  3. Back up, before updating the code: uv run riskwren backup /backups/riskwren-before-upgrade.zip. Once the code is newer than the database, backup refuses until db upgrade has run.
  4. Update the code (git pull, or check out the release's tag), then uv sync, adding --extra postgres if the installation uses PostgreSQL: without it, uv sync removes the driver.
  5. uv run riskwren db upgrade.
  6. uv run riskwren doctor.
  7. Start the server.

db upgrade applies any migrations the database has not had, and adds what is new in the default program and the starter libraries without overwriting what you have shaped. It refuses a database that a newer version of RiskWren has already upgraded. serve refuses to start on a schema that is behind, and uv run riskwren db current shows where the database is.

An upgrade cannot be undone except by restoring: to go back, restore the backup from step 3, with the version that took it, into an empty database. Deployment has the same steps for a container and for a service.

Run behind a reverse proxy#

RiskWren speaks plain HTTP and expects a reverse proxy to terminate TLS in front of it. The repository's deploy/ folder has examples for Caddy and nginx: see Behind a proxy.

The app sets its own security headers, including a content security policy with no inline script or style and no third-party origins, so the proxy does not need to add them.

If reporting without a name is open (see Incidents), RiskWren keeps nothing about who sends a report, but the proxy's access log, and the server's own, may record the address of every request. To keep reports at /report and /api/v1/anonymous-reports from being tied to an address, leave those paths out of the logs, or keep no addresses in them.

The demo and the network#

A demo organization signs in anyone who asks as any of its sample people, with no password. So a demo's server listens only on the machine it runs on: serve refuses any other host, and the sample sign-in refuses requests from other machines.

If you do want to show a demo to others on a network you trust:

uv run riskwren --config demo/riskwren.toml serve --host 0.0.0.0 --demo-on-network

Anyone who can reach it can then sign in as the demo's risk manager or administrator. Never do this with a database that holds anything real; a demo database holds nothing that is.

Describes RiskWren 0.10.1. Apache License 2.0. Screenshots show an invented organization; every person and record in them is fictional.