Queue off-site transfers and protect their local sources
This commit is contained in:
1 parent
6b78db3684
commit
ab16c9db62
8 files changed
+345
-5
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from ipaddress import ip_address
|
||||
@@ -7,6 +8,7 @@ from urllib.parse import urlsplit
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
from .domain_names import canonical_domain
|
||||
from .offsite_backup import destination_labels
|
||||
from .service_health import load_health_targets
|
||||
|
||||
|
||||
@@ -302,6 +304,16 @@ if ROUNDCUBE_URL:
|
||||
)
|
||||
|
||||
LOCAL_ACCOUNT_BACKUPS = os.environ.get("COULOBRE_LOCAL_ACCOUNT_BACKUPS") == "1"
|
||||
try:
|
||||
OFFSITE_BACKUP_DESTINATIONS = destination_labels(
|
||||
json.loads(
|
||||
os.environ.get("COULOBRE_OFFSITE_BACKUP_DESTINATIONS", "{}")
|
||||
)
|
||||
)
|
||||
except (ValueError, RecursionError) as error:
|
||||
raise ImproperlyConfigured(
|
||||
f"COULOBRE_OFFSITE_BACKUP_DESTINATIONS: {error}"
|
||||
) from None
|
||||
LOCAL_ACCOUNT_BACKUP_MAIL = (
|
||||
os.environ.get("COULOBRE_LOCAL_ACCOUNT_BACKUP_MAIL") == "1"
|
||||
)
|
||||
@@ -420,3 +432,9 @@ if LOCAL_BACKUP_RETENTION:
|
||||
"schedule": 300.0,
|
||||
"options": {"expires": 295.0},
|
||||
}
|
||||
if LOCAL_ACCOUNT_BACKUPS and OFFSITE_BACKUP_DESTINATIONS:
|
||||
CELERY_BEAT_SCHEDULE["dispatch-offsite-backups"] = {
|
||||
"task": "coulobre.hosting.tasks.dispatch_offsite_backups",
|
||||
"schedule": 15.0,
|
||||
"options": {"expires": 14.0},
|
||||
}
|
||||
Reference in new issue
Block a user