Satu server sudah cukup untuk sebagian besar tim. Tambahkan mesin hanya jika MOF harus tetap berjalan saat server gagal, atau jika akun cloud begitu banyak sehingga sinkronisasi terus mengantre.
Fungsi setiap proses
| Peran | Pengaturan | Web | Sinkronisasi |
|---|---|---|---|
| MOF lengkap | Tidak ada (default) | Ya | Ya |
| Worker | RK_CONFIG_0_CONTENT_MODE_WORKER=true | Tidak | Ya |
| Hanya web | RK_CONFIG_0_CONTENT_MODE_WEB=true | Ya | Tidak |
Admin → Sistem → Proses MOF menampilkan setiap proses yang berjalan beserta perannya.
Ketersediaan tinggi
- Di setiap server, gunakan compose.yaml PostgreSQL eksternal dengan database yang sama.
- Jalankan satu server dan ambil kata sandi Admin dari log-nya, lalu jalankan server lainnya.
- Arahkan load balancer ke port 80 di setiap server, dengan health check aktif pada
/v1/mof/site-infosetiap beberapa detik.
Pemeriksaan melewati Dash ke MOF, sehingga server yang MOF-nya berhenti akan menjawab 502 dan dikeluarkan. Tanpa pemeriksaan aktif (proxy yang hanya pasif), permintaan pertama setelah kegagalan menunggu timeout sebelum pindah ke server lain.
Gunakan versi image yang sama di semua tempat. Dengan OAuth browser, MOF_PUBLIC_URL dan MOF_MCP_OAUTH_SECRET juga harus sama. Kunci masuk, kunci enkripsi, dan lisensi tersimpan di database; tidak ada yang perlu dilakukan di sana.
Di Kubernetes, MOF, MCP, dan Dash adalah Deployment terpisah, jadi tambahkan replika saja: kubectl -n mof scale deployment/mof deployment/dash --replicas=2. Upgrade tetap menghentikan setiap Pod MOF sebentar (strategi Recreate), sehingga semua replika menjalankan satu versi.
Worker tambahan
Gunakan database dan versi MOF yang sama dengan deployment utama. Worker tidak membuka port.
Unduh compose.yaml
Docker Hub · MOF v2.0.15
Unduh compose.yaml ↓Lihat file dan image
# 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
Unduh compose.yaml ↓Lihat file dan image
# 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
Unduh compose.yaml ↓Lihat file dan image
# 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.15Koneksi database
Isi koneksi database yang sama dengan deployment utama:
RK_POSTGRES_0_ADDR- Alamat:port
RK_POSTGRES_0_USER- Nama pengguna
RK_POSTGRES_0_PASS- Kata sandi
Data yang ada dan akses database
Role memerlukan izin login dan CREATEDB. Mengubah alamat tidak memigrasikan data atau mereset kata sandi. Lakukan backup dan restore secara terpisah sebelum berganti database.
Mulai
docker compose config --quiet
docker compose up -d
docker compose psUntuk menambah worker di mesin ini:
docker compose up -d --scale mof-worker=3
docker compose logs --tail=100 mof-workerSetiap worker menjalankan 2 job sinkronisasi (tagihan, resource, ekspor) dan 2 job operasi (menghapus akun, membersihkan tagihan, menerapkan tag virtual) sekaligus. Hapus komentar dan naikkan RK_CONFIG_0_CONTENT_JOBS_SYNCWORKERS di compose.yaml jika mesin memiliki memori lebih; RK_CONFIG_0_CONTENT_JOBS_OPSWORKERS melakukan hal yang sama untuk job operasi.