Update SYNC_SETUP.md to include gt2.ivx.su as an additional replica for config.toml synchronization, enhancing the setup instructions for multiple read-only replicas.
Publish telemt-bot Docker image / build-and-push (push) Successful in 30s

This commit is contained in:
Denozordec
2026-03-11 14:47:38 +07:00
parent f7e8e58262
commit 1e18b2cbd3
+37 -5
View File
@@ -1,10 +1,10 @@
# Синхронизация `config.toml` между `mtg.ivx.su` и `gt1.ivx.su`
# Синхронизация `config.toml` между `mtg.ivx.su`, `gt1.ivx.su` и `gt2.ivx.su`
Целевая схема:
- **A (primary, запись):** `mtg.ivx.su`
- **B (replica, только чтение):** `gt1.ivx.su`
- **B (replica, только чтение):** `gt1.ivx.su`, `gt2.ivx.su`
Изменения вносятся только на A (через API/бот), затем автоматически синхронизируются на B.
Изменения вносятся только на A (через API/бот), затем автоматически синхронизируются на оба B.
## 1) Подготовка `telemt-data` на обоих серверах
@@ -58,7 +58,7 @@ enabled = true
read_only = false
```
### B (`gt1.ivx.su`)
### B (`gt1.ivx.su`, `gt2.ivx.su`)
```toml
[server.api]
@@ -73,7 +73,9 @@ read_only = true
```bash
ssh-keygen -t ed25519 -N "" -f ~/.ssh/telemt_sync
ssh-copy-id -i ~/.ssh/telemt_sync.pub [email protected]
ssh-copy-id -i ~/.ssh/telemt_sync.pub [email protected]
ssh -i ~/.ssh/telemt_sync [email protected] "echo ok"
ssh -i ~/.ssh/telemt_sync [email protected] "echo ok"
```
## 5) Установка `lsyncd` на A (`mtg.ivx.su`)
@@ -92,6 +94,7 @@ settings {
nodaemon = false,
}
-- B1: gt1.ivx.su
sync {
default.rsyncssh,
source = "/opt/telemt-plus/telemt-data/",
@@ -110,6 +113,26 @@ sync {
}
}
}
-- B2: gt2.ivx.su
sync {
default.rsyncssh,
source = "/opt/telemt-plus/telemt-data/",
host = "[email protected]",
targetdir = "/opt/telemt-plus/telemt-data/",
delay = 1,
exclude = { "cache/" },
rsync = {
archive = true,
compress = true,
_extra = {
"--delete",
"--chown=999:999",
"--chmod=Du=rwx,Dg=rx,Do=,Fu=rw,Fg=r,Fo=",
"-e", "ssh -i /root/.ssh/telemt_sync -o StrictHostKeyChecking=accept-new"
}
}
}
```
## 6) Первичная синхронизация (один раз)
@@ -117,12 +140,21 @@ sync {
На `mtg.ivx.su`:
```bash
# B1: gt1.ivx.su
rsync -az --delete \
--chown=999:999 \
--chmod=Du=rwx,Dg=rx,Do=,Fu=rw,Fg=r,Fo= \
-e "ssh -i /root/.ssh/telemt_sync -o StrictHostKeyChecking=accept-new" \
/opt/telemt-plus/telemt-data/ \
[email protected]:/opt/telemt-plus/telemt-data/
# B2: gt2.ivx.su
rsync -az --delete \
--chown=999:999 \
--chmod=Du=rwx,Dg=rx,Do=,Fu=rw,Fg=r,Fo= \
-e "ssh -i /root/.ssh/telemt_sync -o StrictHostKeyChecking=accept-new" \
/opt/telemt-plus/telemt-data/ \
[email protected]:/opt/telemt-plus/telemt-data/
```
## 7) Запуск `lsyncd`
@@ -163,4 +195,4 @@ curl -s http://127.0.0.1:9091/v1/health
- Мутации (`POST/PATCH/DELETE`) делать только на A (`mtg.ivx.su`).
- Бота направлять на API A.
- B (`gt1.ivx.su`) держать как реплику только для чтения.
- B (`gt1.ivx.su`, `gt2.ivx.su`) держать как реплики только для чтения.