Store SQLite DB on remote host via SCP for persistence
Instead of syncing JSON files back, the SQLite DB itself is now the persistent store on the remote HAProxy host: - Startup: download remote DB via SCP (skip migration if exists) - After writes: upload local DB via SCP (WAL checkpoint first) - JSON sync removed (sync_servers_json, sync_certs_json deleted) New functions: - ssh_ops: remote_download_file(), remote_upload_file() via SCP - db: sync_db_to_remote(), _try_download_remote_db() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -265,9 +265,9 @@ def add_server_to_config(domain: str, slot: int, ip: str, http_port: int) -> Non
|
||||
ip: Server IP address
|
||||
http_port: HTTP port
|
||||
"""
|
||||
from .db import db_add_server, sync_servers_json
|
||||
from .db import db_add_server, sync_db_to_remote
|
||||
db_add_server(domain, slot, ip, http_port)
|
||||
sync_servers_json()
|
||||
sync_db_to_remote()
|
||||
|
||||
|
||||
def remove_server_from_config(domain: str, slot: int) -> None:
|
||||
@@ -277,9 +277,9 @@ def remove_server_from_config(domain: str, slot: int) -> None:
|
||||
domain: Domain name
|
||||
slot: Server slot to remove
|
||||
"""
|
||||
from .db import db_remove_server, sync_servers_json
|
||||
from .db import db_remove_server, sync_db_to_remote
|
||||
db_remove_server(domain, slot)
|
||||
sync_servers_json()
|
||||
sync_db_to_remote()
|
||||
|
||||
|
||||
def remove_domain_from_config(domain: str) -> None:
|
||||
@@ -288,9 +288,9 @@ def remove_domain_from_config(domain: str) -> None:
|
||||
Args:
|
||||
domain: Domain name to remove
|
||||
"""
|
||||
from .db import db_remove_domain_servers, sync_servers_json
|
||||
from .db import db_remove_domain_servers, sync_db_to_remote
|
||||
db_remove_domain_servers(domain)
|
||||
sync_servers_json()
|
||||
sync_db_to_remote()
|
||||
|
||||
|
||||
def get_shared_domain(domain: str) -> Optional[str]:
|
||||
@@ -313,9 +313,9 @@ def add_shared_domain_to_config(domain: str, shares_with: str) -> None:
|
||||
domain: New domain name
|
||||
shares_with: Existing domain to share pool with
|
||||
"""
|
||||
from .db import db_add_shared_domain, sync_servers_json
|
||||
from .db import db_add_shared_domain, sync_db_to_remote
|
||||
db_add_shared_domain(domain, shares_with)
|
||||
sync_servers_json()
|
||||
sync_db_to_remote()
|
||||
|
||||
|
||||
def get_domains_sharing_pool(pool: str) -> list[str]:
|
||||
@@ -362,9 +362,9 @@ def add_cert_to_config(domain: str) -> None:
|
||||
Args:
|
||||
domain: Domain name to add
|
||||
"""
|
||||
from .db import db_add_cert, sync_certs_json
|
||||
from .db import db_add_cert, sync_db_to_remote
|
||||
db_add_cert(domain)
|
||||
sync_certs_json()
|
||||
sync_db_to_remote()
|
||||
|
||||
|
||||
def remove_cert_from_config(domain: str) -> None:
|
||||
@@ -373,9 +373,9 @@ def remove_cert_from_config(domain: str) -> None:
|
||||
Args:
|
||||
domain: Domain name to remove
|
||||
"""
|
||||
from .db import db_remove_cert, sync_certs_json
|
||||
from .db import db_remove_cert, sync_db_to_remote
|
||||
db_remove_cert(domain)
|
||||
sync_certs_json()
|
||||
sync_db_to_remote()
|
||||
|
||||
|
||||
# Domain map helper functions (used by domains.py)
|
||||
|
||||
Reference in New Issue
Block a user