Ein Server reicht für die meisten Teams. Fügen Sie nur dann Maschinen hinzu, wenn MOF einen Serverausfall überstehen muss oder wenn es so viele Cloud-Konten gibt, dass sich Synchronisierungen ständig stauen.
Was jeder Prozess tut
| Rolle | Einstellung | Web | Synchronisierungen |
|---|---|---|---|
| Vollständiges MOF | Nichts (Standard) | Ja | Ja |
| Worker | RK_CONFIG_0_CONTENT_MODE_WORKER=true | Nein | Ja |
| Nur Web | RK_CONFIG_0_CONTENT_MODE_WEB=true | Ja | Nein |
Admin → System → MOF-Prozesse zeigt jeden laufenden Prozess und seine Rolle.
Hochverfügbarkeit
- Verwenden Sie auf jedem Server die compose.yaml für externes PostgreSQL mit derselben Datenbank.
- Starten Sie einen Server und entnehmen Sie das Admin-Passwort seinem Log, dann starten Sie die anderen.
- Richten Sie den Load Balancer auf Port 80 jedes Servers aus, mit einem aktiven Health Check auf
/v1/mof/site-infoalle paar Sekunden.
Der Check läuft über Dash zu MOF, sodass ein Server, dessen MOF gestoppt ist, mit 502 antwortet und herausgenommen wird. Ohne aktiven Check (nur passive Proxys) wartet die erste Anfrage nach einem Ausfall auf ein Timeout, bevor sie zu einem anderen Server wechselt.
Verwenden Sie überall dieselben Image-Versionen. Bei Browser-OAuth müssen auch MOF_PUBLIC_URL und MOF_MCP_OAUTH_SECRET übereinstimmen. Anmeldeschlüssel, Verschlüsselungsschlüssel und Lizenz liegen in der Datenbank; dort ist nichts zu tun.
Unter Kubernetes sind MOF, MCP und Dash getrennte Deployments, fügen Sie also stattdessen Replikas hinzu: kubectl -n mof scale deployment/mof deployment/dash --replicas=2. Upgrades stoppen weiterhin jeden MOF-Pod kurz (Strategie Recreate), sodass alle Replikas eine Version ausführen.
Mehr Worker
Verwenden Sie dieselbe Datenbank und MOF-Version wie das Haupt-Deployment. Worker öffnen keinen Port.
compose.yaml herunterladen
Docker Hub · MOF v2.0.15
Herunterladen compose.yaml ↓Datei und Images anzeigen
# 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
Herunterladen compose.yaml ↓Datei und Images anzeigen
# 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
Herunterladen compose.yaml ↓Datei und Images anzeigen
# 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.15Datenbankverbindung
Tragen Sie dieselbe Datenbankverbindung wie beim Haupt-Deployment ein:
RK_POSTGRES_0_ADDR- Adresse:Port
RK_POSTGRES_0_USER- Benutzername
RK_POSTGRES_0_PASS- Passwort
Vorhandene Daten und Datenbankzugriff
Die Rolle benötigt die Berechtigungen LOGIN und CREATEDB. Eine Adressänderung migriert keine Daten und setzt keine Passwörter zurück. Sichern und stellen Sie separat wieder her, bevor Sie die Datenbank wechseln.
Starten
docker compose config --quiet
docker compose up -d
docker compose psUm auf dieser Maschine weitere Worker hinzuzufügen:
docker compose up -d --scale mof-worker=3
docker compose logs --tail=100 mof-workerJeder Worker führt gleichzeitig 2 Synchronisierungsjobs (Rechnungen, Ressourcen, Exporte) und 2 Ops-Jobs (Konto löschen, Rechnungen bereinigen, virtuellen Tag anwenden) aus. Entkommentieren und erhöhen Sie RK_CONFIG_0_CONTENT_JOBS_SYNCWORKERS in compose.yaml, wenn die Maschine freien Speicher hat; RK_CONFIG_0_CONTENT_JOBS_OPSWORKERS tut dasselbe für Ops-Jobs.