One server is enough for most teams. Add machines only when MOF must stay up through a server failure, or when there are so many cloud accounts that syncs keep queueing.
What each process does
| Role | Setting | Web | Syncs |
|---|---|---|---|
| Full MOF | Nothing (default) | Yes | Yes |
| Worker | RK_CONFIG_0_CONTENT_MODE_WORKER=true | No | Yes |
| Web only | RK_CONFIG_0_CONTENT_MODE_WEB=true | Yes | No |
Admin → System → MOF processes shows every running process and its role.
High availability
- On every server, use the External PostgreSQL compose.yaml with the same database.
- Start one server and take the Admin password from its log, then start the others.
- Point the load balancer at port 80 on each server, with an active health check on
/v1/mof/site-infoevery few seconds.
The check goes through Dash to MOF, so a server whose MOF has stopped answers 502 and is taken out. Without an active check (passive-only proxies), the first request after a failure waits for a timeout before it moves to another server.
Use the same image versions everywhere. With browser OAuth, MOF_PUBLIC_URL and MOF_MCP_OAUTH_SECRET must match too. The sign-in key, encryption key and license live in the database; nothing to do there.
On Kubernetes, MOF, MCP and Dash are separate Deployments, so add replicas instead: kubectl -n mof scale deployment/mof deployment/dash --replicas=2. Upgrades still stop every MOF Pod briefly (strategy Recreate), so all replicas run one version.
More workers
Use the same database and MOF version as the main deployment. Workers open no port.
Download compose.yaml
Docker Hub · MOF v2.0.15
Download compose.yaml ↓View file and images
# MOF v2.0.15 — Linux amd64 / dockerhub
# Use the same database connection and MOF version as the main deployment.
# Private-network PostgreSQL without TLS. TLS-only databases are not supported by this release.
name: mof-worker
x-logging: &logging
driver: json-file
options:
max-size: "20m"
max-file: "5"
services:
mof-worker:
image: mofcloud/mof:v2.0.15
restart: unless-stopped
logging: *logging
environment:
RK_POSTGRES_0_ADDR: "db.example.com:5432"
RK_POSTGRES_0_USER: "mof"
RK_POSTGRES_0_PASS: "REPLACE_WITH_YOUR_DATABASE_PASSWORD"
RK_CONFIG_0_CONTENT_MODE_WORKER: "true"
# Optional, default 2: jobs run at the same time in this process, for syncs (bills,
# resources, exports) and ops (delete an account, purge bills, apply a virtual tag filter).
# RK_CONFIG_0_CONTENT_JOBS_SYNCWORKERS: "2"
# RK_CONFIG_0_CONTENT_JOBS_OPSWORKERS: "2"
volumes:
- offer-cache:/usr/src/mof/offer-cache
volumes:
offer-cache:
mofcloud/mof:v2.0.15Alibaba Cloud ACR · MOF v2.0.15
Download compose.yaml ↓View file and images
# MOF v2.0.15 — Linux amd64 / acr
# Use the same database connection and MOF version as the main deployment.
# Private-network PostgreSQL without TLS. TLS-only databases are not supported by this release.
name: mof-worker
x-logging: &logging
driver: json-file
options:
max-size: "20m"
max-file: "5"
services:
mof-worker:
image: registry.cn-hangzhou.aliyuncs.com/mofcloud/mof:v2.0.15
restart: unless-stopped
logging: *logging
environment:
RK_POSTGRES_0_ADDR: "db.example.com:5432"
RK_POSTGRES_0_USER: "mof"
RK_POSTGRES_0_PASS: "REPLACE_WITH_YOUR_DATABASE_PASSWORD"
RK_CONFIG_0_CONTENT_MODE_WORKER: "true"
# Optional, default 2: jobs run at the same time in this process, for syncs (bills,
# resources, exports) and ops (delete an account, purge bills, apply a virtual tag filter).
# RK_CONFIG_0_CONTENT_JOBS_SYNCWORKERS: "2"
# RK_CONFIG_0_CONTENT_JOBS_OPSWORKERS: "2"
volumes:
- offer-cache:/usr/src/mof/offer-cache
volumes:
offer-cache:
registry.cn-hangzhou.aliyuncs.com/mofcloud/mof:v2.0.15GHCR · MOF v2.0.15
Download compose.yaml ↓View file and images
# MOF v2.0.15 — Linux amd64 / ghcr
# Use the same database connection and MOF version as the main deployment.
# Private-network PostgreSQL without TLS. TLS-only databases are not supported by this release.
name: mof-worker
x-logging: &logging
driver: json-file
options:
max-size: "20m"
max-file: "5"
services:
mof-worker:
image: ghcr.io/mofcloud/mof:v2.0.15
restart: unless-stopped
logging: *logging
environment:
RK_POSTGRES_0_ADDR: "db.example.com:5432"
RK_POSTGRES_0_USER: "mof"
RK_POSTGRES_0_PASS: "REPLACE_WITH_YOUR_DATABASE_PASSWORD"
RK_CONFIG_0_CONTENT_MODE_WORKER: "true"
# Optional, default 2: jobs run at the same time in this process, for syncs (bills,
# resources, exports) and ops (delete an account, purge bills, apply a virtual tag filter).
# RK_CONFIG_0_CONTENT_JOBS_SYNCWORKERS: "2"
# RK_CONFIG_0_CONTENT_JOBS_OPSWORKERS: "2"
volumes:
- offer-cache:/usr/src/mof/offer-cache
volumes:
offer-cache:
ghcr.io/mofcloud/mof:v2.0.15Database connection
Fill in the same database connection as the main deployment:
RK_POSTGRES_0_ADDR- Address:port
RK_POSTGRES_0_USER- Username
RK_POSTGRES_0_PASS- Password
Existing data and database access
The role needs login and CREATEDB permissions. Changing the address does not migrate data or reset passwords. Back up and restore separately before switching databases.
Start
docker compose config --quiet
docker compose up -d
docker compose psTo add more workers on this machine:
docker compose up -d --scale mof-worker=3
docker compose logs --tail=100 mof-workerEach worker runs 2 sync jobs (bills, resources, exports) and 2 ops jobs (delete an account, purge bills, apply a virtual tag) at a time. Uncomment and raise RK_CONFIG_0_CONTENT_JOBS_SYNCWORKERS in compose.yaml if the machine has spare memory; RK_CONFIG_0_CONTENT_JOBS_OPSWORKERS does the same for ops jobs.