Skip to content
mofcloud

Scaling and high availability

Last updated:

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.

Two MOF + Dash + MCP behind a load balancer and two workers, all on one PostgreSQLHigh availability: serves the webWorkers: run syncsLoad balancerMOF + Dash + MCPMOF + Dash + MCPWorkerWorkerPostgreSQL
Either half works on its own: the left side for uptime, workers next to a single server for faster syncs.

What each process does

RoleSettingWebSyncs
Full MOFNothing (default)YesYes
WorkerRK_CONFIG_0_CONTENT_MODE_WORKER=trueNoYes
Web onlyRK_CONFIG_0_CONTENT_MODE_WEB=trueYesNo

Admin → System → MOF processes shows every running process and its role.

High availability

  1. On every server, use the External PostgreSQL compose.yaml with the same database.
  2. Start one server and take the Admin password from its log, then start the others.
  3. Point the load balancer at port 80 on each server, with an active health check on /v1/mof/site-info every 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
compose.yaml
# 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:
Pinned stable releases
MOFv2.0.15
mofcloud/mof:v2.0.15

Database 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

Terminal
docker compose config --quiet
docker compose up -d
docker compose ps

To add more workers on this machine:

Terminal
docker compose up -d --scale mof-worker=3
docker compose logs --tail=100 mof-worker

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