Self-hosting¶
Run Mimos on your own server from the published images. You need Docker with Compose 2.23.1 or later, and a reverse proxy that serves HTTPS. No checkout or build is needed.
What runs¶
| Service | Image | Port (default) |
|---|---|---|
web |
ghcr.io/noahhhx/mimos-web |
127.0.0.1:3000 |
api |
ghcr.io/noahhhx/mimos-api |
127.0.0.1:8080 |
keycloak |
ghcr.io/noahhhx/mimos-keycloak |
127.0.0.1:8081 |
country-week |
ghcr.io/noahhhx/mimos-country-week |
internal only |
postgres |
postgres:18 (databases mimos, keycloak) |
internal only |
Tags¶
Images are published only for releases. A release tag v1.2.3 publishes:
latest, the newest release. This is the default.1.2, the newest release in that minor line.1.2.3, that exact release.
Set the tag with MIMOS_VERSION in .env.
Set up¶
- Get
deploy/selfhost/compose.ymlanddeploy/selfhost/.env.exampleinto a directory on the server, and copy.env.exampleto.env. -
Choose three HTTPS URLs and set them in
.env. Subdomains are the simplest:Variable Example Proxies to WEB_ORIGINhttps://mimos.example.homeWEB_PORTAPI_PUBLIC_URLhttps://api.mimos.example.homeAPI_PORTKEYCLOAK_PUBLIC_URLhttps://auth.mimos.example.homeKEYCLOAK_PORT -
Generate
POSTGRES_PASSWORDandKEYCLOAK_ADMIN_PASSWORD, for example withopenssl rand -base64 24, andMIMOS_SECRET_KEYwithopenssl rand -base64 32. Mimos encrypts the intervals.icu API keys people connect underMIMOS_SECRET_KEY. Keep it: if it changes, each connected person enters their key again. Leave it empty to turn intervals.icu off. A value that is not 32 bytes in base64 stops the API from starting. - If the repository's packages are private, log in once with a GitHub
token that has
read:packages:docker login ghcr.io -u <github-user>. - Start it:
docker compose up -d --wait.
Why HTTPS¶
The browser signs in with Authorization Code + PKCE, and PKCE uses the Web
Crypto API, which browsers only offer on https:// pages and
http://localhost. A page served as http://192.168.1.10:3000 cannot sign
in. A certificate from your proxy's internal CA works, as long as the
devices you use trust that CA. The same rule covers the camera: the Log
page's barcode scanner can use it only on an https:// page.
Reverse proxy¶
Forward each URL to its port and send the usual X-Forwarded-For,
X-Forwarded-Proto and X-Forwarded-Host headers. Keycloak builds its
URLs from them, and so does the API when it tells AI agents where to sign
in. The API trusts these headers only from private-network and loopback
addresses, where a proxy in front of it runs. The defaults bind to 127.0.0.1, which suits a proxy on the
same host. If the proxy runs on another machine, set BIND_ADDRESS=0.0.0.0.
A Caddy example:
mimos.example.home {
reverse_proxy 127.0.0.1:3000
}
api.mimos.example.home {
reverse_proxy 127.0.0.1:8080
}
auth.mimos.example.home {
reverse_proxy 127.0.0.1:8081
}
First sign-in¶
The realm ships with no users. Self-registration is enabled, so the first
person can choose Create account on the home page. Alternatively, create users in the
Keycloak admin console at KEYCLOAK_PUBLIC_URL/admin as admin with
KEYCLOAK_ADMIN_PASSWORD. That admin is a temporary bootstrap account:
create a permanent admin in the master realm and delete it.
To close sign-up, do both of these:
- Turn off User registration in the
mimosrealm's Realm settings → Login. This is what stops new accounts. - Set
SIGNUP=closedin.envand rundocker compose up -d. This hides Create account, which would otherwise lead to Keycloak's "Registration not allowed" page.
How long people stay signed in¶
The realm keeps a session for 30 days without use and for a year at most,
so people sign in once per device. To change either, open the mimos
realm's Realm settings → Sessions and set SSO Session Idle and
SSO Session Max.
Keycloak imports the realm only on the first start. An instance set up before these values were in the realm keeps Keycloak's defaults of 30 minutes and 10 hours, so people are asked to sign in on almost every visit. Set the two values by hand to fix that: 30 days and 365 days match a new instance. After the upgrade that brought these values, everyone signs in once more, and from then on stays signed in.
Changing URLs later¶
The web app and API read their URLs at start, so edit .env and
docker compose up -d. Keycloak imports the realm only on the first start,
so also update the mimos-web client's Valid redirect URIs and Web
origins in the admin console, and the link in the mimos realm's HTML
Display name (Realm settings → General).
The HTML display name is the Mimos brand above the sign-in and register
forms, and it links back to the web app's home page. An instance set up
before that link existed shows plain text there. To add the link, set
HTML Display name to <a href="WEB_ORIGIN/">Mimos</a>, with your
WEB_ORIGIN in place of WEB_ORIGIN.
Upgrades and backups¶
docker compose pull && docker compose up -d --wait upgrades. Migrations
run on start and only go forward.
Everything is in the postgres-data volume, in two databases. Recipe
pictures are stored in the mimos database too, so it grows with them,
and so do its dumps:
docker compose exec -T postgres pg_dump -U mimos mimos > mimos.sql
docker compose exec -T postgres pg_dump -U mimos keycloak > keycloak.sql
Country of the Week keeps each household's wheel (chosen and removed
countries) in an SQLite file on the country-week-data volume. Copy it
out while the plugin runs:
Each user can also export their own data from Your data in the app's profile menu (see Your data).
Plugins¶
The stack registers the reference plugin, Country of the Week. A registered plugin is only available: someone in each household turns it on in the Plugins page, for everyone in the household, before it sees their week or suggests anything (see Plugins).
Adding a plugin¶
Run the plugin as another service in compose.yml, then register it on
the api service with the next free index:
MIMOS_PLUGINS_1_ID: my-plugin # optional; must match its manifest
MIMOS_PLUGINS_1_URL: http://my-plugin:8080
MIMOS_PLUGINS_1_TIMEOUT: 2s # optional, default 2s
MIMOS_PLUGINS_1_SHAREDSECRET: ... # optional, for plugins off this host
Registrations take effect on docker compose up -d. A misconfigured
registration, such as two plugins with the same id, stops the API from
starting, so you notice it straight away. A plugin that is down or slow
never does: it logs a warning and contributes nothing until it's back.
Without plugins¶
Delete the country-week service, its country-week-data volume, and
the two MIMOS_PLUGINS_0_* lines from compose.yml.
intervals.icu¶
People can connect their own intervals.icu account on the Fuel page, so
their planned workouts and completed activities feed their fuel targets
(see Bring in training from intervals.icu).
Each person uses a personal API key from their intervals.icu settings, so
there is no app to register. The API reaches https://intervals.icu, so
the server needs outbound HTTPS.
- Turning it on. It is on whenever
MIMOS_SECRET_KEYis set. Leave the key empty, or addMIMOS_INTERVALSICU_ENABLED: "false"to theapiservice's environment, and the Fuel page offers training entered by hand only. - The key. Mimos encrypts each person's intervals.icu API key under
MIMOS_SECRET_KEY(AES-256-GCM) and never shows it again. Generate it once withopenssl rand -base64 32and back it up with your.env. If it changes, no stored key opens any more: every connection reads as needing its key again, and each person re-enters theirs on the Fuel page. Training already synced stays until they do. - How often it syncs. Every 30 minutes, each connected person in
turn; their Refresh button syncs them at once. Set
MIMOS_INTERVALSICU_SYNCINTERVALon theapiservice (such as15m, at least1m) to change it. A sync makes four requests to intervals.icu, well inside the 5,000 a day it allows each key. When intervals.icu asks Mimos to slow down, Mimos waits as long as it says before that person's next sync.
Open Food Facts¶
Mimos looks packaged food up by its barcode in
Open Food Facts, the open product
database, so people can log it from its name and nutrition. It needs no
key or account. The API sends Open Food Facts the barcode and nothing
else: not who asked, not their address, since the API makes the request
rather than the browser. Nothing it answers is stored. The server needs
outbound HTTPS to world.openfoodfacts.org.
- Turning it off. It is on by default. Set
MIMOS_OPENFOODFACTS_ENABLED=falsein.envand every barcode lookup answers "not found" without leaving your server. - Limits. Open Food Facts allows 100 product lookups a minute from one address. Past that, or while it is down, a lookup fails and can be tried again.
- Scanning. Browsers without their own barcode reader (Safari, Firefox) read barcodes with a reader that the web image serves itself, so reading a barcode calls no outside service. Only the lookup leaves your server.
AI agents¶
Users can connect AI agents such as Claude Code to Mimos over MCP, at your
API URL followed by /mcp (see Use Mimos from an AI agent).
Agents sign in through Keycloak as the mimos-agent client, which the
realm includes. Claude on claude.ai connects from Anthropic's servers, so
it needs the API and Keycloak on public HTTPS URLs; Claude Code does not.
Add the agent client to an existing instance¶
Keycloak imports the realm only on the first start, so an instance set up
before agent support has no mimos-agent client. Add it in the admin
console:
- Open
KEYCLOAK_PUBLIC_URL/admin, sign in as an admin, and switch to themimosrealm. - Go to Clients and choose Create client.
- Set Client ID to
mimos-agentand choose Next. - Leave Client authentication off. Under Authentication flow, tick only Standard flow, then choose Next.
- Add these four Valid redirect URIs, then choose Save:
http://localhost/callbackhttp://127.0.0.1/callbackhttp://[::1]/callbackhttps://claude.ai/api/mcp/auth_callback
- Open the client's Advanced tab. Under Advanced settings, set
Proof Key for Code Exchange Code Challenge Method to
S256and choose Save.
The loopback redirect URIs have no port on purpose: Keycloak then accepts any port, which agents on your computer pick at random.
The Android app¶
People can use Mimos from the Android app. They type your web address, the
one they open in a browser, and sign in through Keycloak in their phone's
browser as the mimos-mobile client, which the realm includes. The app
needs your web, API, and Keycloak on HTTPS URLs, as the web app does (see
Why HTTPS).
The app learns the rest from your web address: it reads
/runtime-config.json there, which names MIMOS_API_URL and
MIMOS_OIDC_AUTHORITY. Both must be addresses the phone can reach, the
same ones a browser uses, never an internal host name such as api. A
phone on mobile data reaches only what is public; a phone on your home
network also reaches addresses only that network answers.
Add the Android app client to an existing instance¶
Keycloak imports the realm only on the first start, so an instance set up
before the app has no mimos-mobile client. Add it in the admin console:
- Open
KEYCLOAK_PUBLIC_URL/admin, sign in as an admin, and switch to themimosrealm. - Go to Clients and choose Create client.
- Set Client ID to
mimos-mobileand choose Next. - Leave Client authentication off. Under Authentication flow, tick only Standard flow, then choose Next.
- Set Valid redirect URIs to
io.github.noahhhx.mimos.oauth:/oauth2redirect, then choose Save. Open the client's Settings tab again and, under Logout settings, set Valid post logout redirect URIs to the same value and choose Save. - Open the client's Advanced tab. Under Advanced settings, set
Proof Key for Code Exchange Code Challenge Method to
S256and choose Save.
The redirect URI is the app's own, not a web address: Android hands it to the app when Keycloak redirects there. Leave Web origins empty.