From d0b7158423740e099a4e56cf741fc33d892e2b0a Mon Sep 17 00:00:00 2001 From: Johannes Erwerle Date: Tue, 12 May 2026 15:17:06 +0200 Subject: [PATCH 1/6] improved overflows in the borg repository table --- community_backup/webui/templates/borg_list.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/community_backup/webui/templates/borg_list.html b/community_backup/webui/templates/borg_list.html index f2e550b..303a9eb 100644 --- a/community_backup/webui/templates/borg_list.html +++ b/community_backup/webui/templates/borg_list.html @@ -25,8 +25,8 @@ {% for repo in object_list %} {{ repo.name }} - {{ repo.truncated_key }} - {{ repo.repo_url }} + {{ repo.truncated_key }} + {{ repo.repo_url }} {% if repo.used_quota < 0 %}not initialized{% else %}{{ repo.used_quota }}/{{ repo.quota }} GB{% endif %} Edit Delete From ea9346d25da9a81eba74b1970581868f66bf3a0f Mon Sep 17 00:00:00 2001 From: Johannes Erwerle Date: Wed, 13 May 2026 00:01:04 +0200 Subject: [PATCH 2/6] Added SSH public keys to the borg repository listing --- README.md | 22 +++++++++++++++++++ .../community_backup/context_processors.py | 7 ++++++ .../community_backup/example_configuration.py | 15 +++++++++++++ community_backup/community_backup/settings.py | 2 ++ .../webui/templates/borg_list.html | 15 +++++++++++++ 5 files changed, 61 insertions(+) diff --git a/README.md b/README.md index 6d5a710..d3ab045 100644 --- a/README.md +++ b/README.md @@ -146,3 +146,25 @@ Django debug setting. ```python ADDITIONAL_FOOTER_NAV_ITEMS = [""" +{% if BORG_SERVER_PUBKEYS %} +
+
+

Borg Server Public Keys

+
+
    + {% for key, fingerprint in BORG_SERVER_PUBKEYS %} +
  • + {{ key }}
    + {{ fingerprint }} +
  • + {% endfor %} +
+
+{% endif %} From 95fde8e58f97132397ba985c425942ddc218a15e Mon Sep 17 00:00:00 2001 From: Johannes Erwerle Date: Wed, 13 May 2026 00:05:04 +0200 Subject: [PATCH 3/6] added systemd service and timer for quota update --- README.md | 8 ++++++++ .../contrib/communitybackup-quota-update.service | 9 +++++++++ .../contrib/communitybackup-quota-update.timer | 9 +++++++++ .../webui/management/commands/update_used_quota.py | 4 ---- 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 community_backup/contrib/communitybackup-quota-update.service create mode 100644 community_backup/contrib/communitybackup-quota-update.timer diff --git a/README.md b/README.md index d3ab045..3722f82 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,14 @@ Create a superuser account ``` +### Repository Quota Updates + +The repository quotas in the UI are updated after each backup. +To update the quota during an operation the `update_used_quota` management command can be executed on a regular basis. + +There are example configs for systemd-timers in `contrib/communitybackup-quota-update.service` and `contrib/communitybackup-quota-update.timer`. Adjust the paths and the timers to your needs. + + ## Custom pages Some pages are specific to your installation. E.g. an imprint. diff --git a/community_backup/contrib/communitybackup-quota-update.service b/community_backup/contrib/communitybackup-quota-update.service new file mode 100644 index 0000000..6c5bf1e --- /dev/null +++ b/community_backup/contrib/communitybackup-quota-update.service @@ -0,0 +1,9 @@ +[Unit] +Description=Update the used quota + +[Service] +User=borg +Group=borg +WorkingDirectory=/opt/community_backup/community-backup/community_backup/ +ExecStart=/opt/community_backup/venv/bin/python manage.py update_used_quota +PrivateTmp=true diff --git a/community_backup/contrib/communitybackup-quota-update.timer b/community_backup/contrib/communitybackup-quota-update.timer new file mode 100644 index 0000000..a29eced --- /dev/null +++ b/community_backup/contrib/communitybackup-quota-update.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Update the used quota on a regular basis + +[Timer] +OnCalendar=*-*-* *:0/5:00 +RandomizedDelaySec=120 + +[Install] +WantedBy=timers.target diff --git a/community_backup/webui/management/commands/update_used_quota.py b/community_backup/webui/management/commands/update_used_quota.py index b19e661..a5ec1cd 100644 --- a/community_backup/webui/management/commands/update_used_quota.py +++ b/community_backup/webui/management/commands/update_used_quota.py @@ -10,8 +10,6 @@ class Command(BaseCommand): parser.add_argument("--repository-id", type=int, nargs="+") def handle(self, *args, **options): - print(options) - qs = BorgRepository.objects.all() if options.get("user_id"): @@ -20,8 +18,6 @@ class Command(BaseCommand): if options.get("repository_id"): qs = qs.filter(pk__in=options.get("repository_id")) - print(qs) - for repo in qs: repo.refresh_quota() From a942a0b8c63e88b97725b05dda64967e580e986b Mon Sep 17 00:00:00 2001 From: Johannes Erwerle Date: Wed, 13 May 2026 00:06:20 +0200 Subject: [PATCH 4/6] bumped version to 0.11 --- community_backup/community_backup/settings.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/community_backup/community_backup/settings.py b/community_backup/community_backup/settings.py index 2f0876e..e46f420 100644 --- a/community_backup/community_backup/settings.py +++ b/community_backup/community_backup/settings.py @@ -117,7 +117,7 @@ TASKS = {"default": {"BACKEND": "django.tasks.backends.immediate.ImmediateBacken STATIC_ROOT = BASE_DIR.parent.parent / "static" -RELEASE_VERSION = "0.10" +RELEASE_VERSION = "0.11" # Import settings from configuration.py try: diff --git a/pyproject.toml b/pyproject.toml index 4295f15..b3c7394 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "community_backup" -version = "0.10" +version = "0.11" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" From 71e72fb98bcf4dcf7a149b86715a160ab4ef86f5 Mon Sep 17 00:00:00 2001 From: Johannes Erwerle Date: Fri, 5 Jun 2026 11:11:55 +0200 Subject: [PATCH 5/6] Added command to bulk-create vouchers --- .../webui/management/commands/add_vouchers.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 community_backup/webui/management/commands/add_vouchers.py diff --git a/community_backup/webui/management/commands/add_vouchers.py b/community_backup/webui/management/commands/add_vouchers.py new file mode 100644 index 0000000..f983d92 --- /dev/null +++ b/community_backup/webui/management/commands/add_vouchers.py @@ -0,0 +1,39 @@ +from django.core.management.base import BaseCommand +from random import choices +from ...models import Voucher + + +class Command(BaseCommand): + help = "bulk-add vouchers with a given prefix and generate a latex output to render them" + + def add_arguments(self, parser): + parser.add_argument("prefix", type=str) + parser.add_argument("amount", type=int) + + def handle(self, *args, **options): + unabmigous_characters = "abcdefghijkmnopqrstuvwxyzACDEFHJKLMNPQRTUVWXY1234679" + + vouchers = set() + while len(vouchers) < options["amount"]: + random_part = "".join(choices(unabmigous_characters, k=5)) + vouchers.add(f"{options['prefix']}-{random_part}") + + Voucher.objects.bulk_create(Voucher(code=v) for v in vouchers) + + header = r"""\begin{document} +\begin{center} +""" + output = header + even = False + for v in vouchers: + output += f"\\voucher{{{v}}}" + if even: + output += "\\newline\n" + else: + output += "\n" + even = not even + + output += r"""\end{center} +\end{document}""" + + print(output) From a0b69596c873e0cfa4c0d4c1e82b8ed677565805 Mon Sep 17 00:00:00 2001 From: Johannes Erwerle Date: Fri, 5 Jun 2026 11:13:11 +0200 Subject: [PATCH 6/6] bumped version to 0.12 --- community_backup/community_backup/settings.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/community_backup/community_backup/settings.py b/community_backup/community_backup/settings.py index e46f420..f784284 100644 --- a/community_backup/community_backup/settings.py +++ b/community_backup/community_backup/settings.py @@ -117,7 +117,7 @@ TASKS = {"default": {"BACKEND": "django.tasks.backends.immediate.ImmediateBacken STATIC_ROOT = BASE_DIR.parent.parent / "static" -RELEASE_VERSION = "0.11" +RELEASE_VERSION = "0.12" # Import settings from configuration.py try: diff --git a/pyproject.toml b/pyproject.toml index b3c7394..2412b09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "community_backup" -version = "0.11" +version = "0.12" description = "Add your description here" readme = "README.md" requires-python = ">=3.13"