Skip to content
Snippets Groups Projects
Commit 4963c360 authored by Tom Teichler's avatar Tom Teichler :beers: Committed by root
Browse files

Re-add django-dbbackup

parent 0159e3a7
No related branches found
No related tags found
1 merge request!223Resolve "Re-add django-dbbackup"
......@@ -55,6 +55,7 @@ INSTALLED_APPS = [
"django.contrib.humanize",
"polymorphic",
"django_global_request",
"dbbackup",
"settings_context_processor",
"sass_processor",
"easyaudit",
......@@ -407,6 +408,16 @@ MAINTENANCE_MODE_STATE_FILE_PATH = _settings.get(
"maintenance.statefile", "maintenance_mode_state.txt"
)
DBBACKUP_STORAGE = _settings.get("backup.storage", "django.core.files.storage.FileSystemStorage")
DBBACKUP_STORAGE_OPTIONS = {"location": _settings.get("backup.location", "/var/backups/aleksis")}
DBBACKUP_CLEANUP_KEEP = _settings.get("backup.database.keep", 10)
DBBACKUP_CLEANUP_KEEP_MEDIA = _settings.get("backup.media.keep", 10)
DBBACKUP_GPG_RECIPIENT = _settings.get("backup.gpg_recipient", None)
DBBACKUP_COMPRESS_DB = _settings.get("backup.database.compress", True)
DBBACKUP_ENCRYPT_DB = _settings.get("backup.database.encrypt", DBBACKUP_GPG_RECIPIENT is not None)
DBBACKUP_COMPRESS_MEDIA = _settings.get("backup.media.compress", True)
DBBACKUP_ENCRYPT_MEDIA = _settings.get("backup.media.encrypt", DBBACKUP_GPG_RECIPIENT is not None)
IMPERSONATE = {"USE_HTTP_REFERER": True, "REQUIRE_SUPERUSER": True, "ALLOW_SUPERUSER": True}
DJANGO_TABLES2_TEMPLATE = "django_tables2/materialize.html"
......
from django.core import management
from .util.core_helpers import celery_optional
from .util.notifications import send_notification as _send_notification
......@@ -5,3 +7,12 @@ from .util.notifications import send_notification as _send_notification
@celery_optional
def send_notification(notification: int, resend: bool = False) -> None:
_send_notification(notification, resend)
@celery_optional
def backup_data() -> None:
db_options = "-z " * settings.DBBACKUP_COMPRESS_DB + "-e" * settings.DBBACKUP_ENCRYPT_DB
media_options = "-z " * settings.DBBACKUP_COMPRESS_MEDIA + "-e" * settings.DBBACKUP_ENCRYPT_MEDIA
management.call_command("dbbackup", db_options)
management.call_command("mediabackup", media_options)
......@@ -68,6 +68,7 @@ django-otp = "0.7.5"
django-colorfield = "^0.2.1"
django-bleach = "^0.6.1"
django-memoize = "^2.2.1"
django-dbbackup = "^3.3.0"
[tool.poetry.extras]
ldap = ["django-auth-ldap"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment