Compare commits
No commits in common. "883e903a509a46ca5643a4d29f0c041518a23bff" and "bb62b5dde44ea15399c22fa0631aaed4336c0556" have entirely different histories.
883e903a50
...
bb62b5dde4
8 changed files with 16 additions and 33 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -207,5 +207,3 @@ tags
|
||||||
[._]*.un~
|
[._]*.un~
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/vim,venv,python
|
# End of https://www.toptal.com/developers/gitignore/api/vim,venv,python
|
||||||
|
|
||||||
community_backup/community_backup/configuration.py
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,6 @@ STATIC_URL = "static/"
|
||||||
|
|
||||||
TASKS = {"default": {"BACKEND": "django.tasks.backends.immediate.ImmediateBackend"}}
|
TASKS = {"default": {"BACKEND": "django.tasks.backends.immediate.ImmediateBackend"}}
|
||||||
|
|
||||||
STATIC_ROOT = BASE_DIR.parent.parent / "static"
|
|
||||||
|
|
||||||
# Import settings from configuration.py
|
# Import settings from configuration.py
|
||||||
try:
|
try:
|
||||||
|
|
@ -140,13 +139,6 @@ try:
|
||||||
assert module.BACKUP_HOME_DIR, "The BACKUP_HOME_DIR setting is required."
|
assert module.BACKUP_HOME_DIR, "The BACKUP_HOME_DIR setting is required."
|
||||||
assert module.BACKUP_BORG_DIR, "The BACKUP_BORG_DIR setting is required."
|
assert module.BACKUP_BORG_DIR, "The BACKUP_BORG_DIR setting is required."
|
||||||
assert module.BACKUP_AUTHORIZED_KEYS, "The BACKUP_AUTHORIZED_KEYS setting is required."
|
assert module.BACKUP_AUTHORIZED_KEYS, "The BACKUP_AUTHORIZED_KEYS setting is required."
|
||||||
|
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
print(f"could not find configuration file {config_module}")
|
print(f"could not find configuration file {config_module}")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
BACKUP_USER = module.BACKUP_USER
|
|
||||||
BACKUP_REPO_HOST = module.BACKUP_REPO_HOST
|
|
||||||
BACKUP_HOME_DIR = module.BACKUP_HOME_DIR
|
|
||||||
BACKUP_BORG_DIR = module.BACKUP_BORG_DIR
|
|
||||||
BACKUP_AUTHORIZED_KEYS = module.BACKUP_AUTHORIZED_KEYS
|
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,13 @@ def sync_repos(dry_run=False):
|
||||||
from .models import BorgRepository
|
from .models import BorgRepository
|
||||||
|
|
||||||
repos = BorgRepository.objects.all()
|
repos = BorgRepository.objects.all()
|
||||||
|
print(repos)
|
||||||
|
|
||||||
repos_by_key = defaultdict(list)
|
repos_by_key = defaultdict(list)
|
||||||
for repo in repos:
|
for repo in repos:
|
||||||
repos_by_key[repo.key].append(repo)
|
repos_by_key[repo.key].append(repo)
|
||||||
|
|
||||||
|
print(repos)
|
||||||
# create .ssh directory
|
# create .ssh directory
|
||||||
ssh_dir = settings.BACKUP_AUTHORIZED_KEYS.parent
|
ssh_dir = settings.BACKUP_AUTHORIZED_KEYS.parent
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
|
|
@ -43,8 +45,10 @@ def sync_repos(dry_run=False):
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
authorized_keys.write_text("\n".join(commands) + "\n")
|
authorized_keys.write_text("\n".join(commands) + "\n")
|
||||||
|
|
||||||
|
print(repos)
|
||||||
# remove repositories that do no longer exist
|
# remove repositories that do no longer exist
|
||||||
repo_paths = {repo.path for repo in repos}
|
repo_paths = {repo.path for repo in repos}
|
||||||
|
print(repo_paths)
|
||||||
for user_dir in settings.BACKUP_BORG_DIR.iterdir():
|
for user_dir in settings.BACKUP_BORG_DIR.iterdir():
|
||||||
print(user_dir)
|
print(user_dir)
|
||||||
for dir in user_dir.iterdir():
|
for dir in user_dir.iterdir():
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,13 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<ul class="nav flex-column">
|
<ul class="nav flex-column">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{% url 'imprint' %}">Imprint</a>
|
<a class="nav-link" href="{% url "about" %}">About</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">Imprint</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">Data Protection</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="d-flex">
|
<div class<div class="d-flex">
|
||||||
<h1>Your Borg Repositories</h1>
|
<h1>Your Borg Repositories</h1>
|
||||||
<div class="p-2 ms-auto">
|
<div class="p-2 ms-auto">
|
||||||
<a class="btn btn-primary" href="{% url 'borg_add' %}" role="button">Add Repository</a>
|
<a class="btn btn-primary" href="{% url 'borg_add' %}" role="button">Add Repository</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<row>
|
|
||||||
<p>Create a borg repository by specifying a name and the SSH public key that is allowed to access this repository. The name is only for your convenience. To set up the repository please follow the <a href="https://borgbackup.readthedocs.io/en/stable/">BorgBackup documentation</a>. There is also a <a href="https://borgbackup.readthedocs.io/en/stable/quickstart.html">Quick start guide</a> available.
|
|
||||||
<b>Always use encrypted backups!</b></p>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<table class="table table-striped table-hover">
|
<table class="table table-striped table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
@ -34,6 +30,4 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,4 @@
|
||||||
<row class="text-center p-2">
|
<row class="text-center p-2">
|
||||||
<h1>Welcome to Community Backup!</h1>
|
<h1>Welcome to Community Backup!</h1>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row>
|
|
||||||
<p>This is a service offering space for backups free of charge. This is a hobby project. It comes with no garantuees for anything, especially availability of the service. This service is in a testing phase at the moment. It might be unavailalbe at times and features might change quickly.</p>
|
|
||||||
<p>Currently this service offers only backups via <a href="https://www.borgbackup.org/">Borg Backup</a>.</p>
|
|
||||||
<p>To access this service you need an account. To register for an account you need a voucher. Vouchers are required to control the amount of users, so that there is enough space available for everyone.</p>
|
|
||||||
</row>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,5 @@ urlpatterns = [
|
||||||
name="borg_delete",
|
name="borg_delete",
|
||||||
),
|
),
|
||||||
path("register/", views.RegisterUserView.as_view(), name="register"),
|
path("register/", views.RegisterUserView.as_view(), name="register"),
|
||||||
path("imprint/", views.ImprintView.as_view(), name="imprint"),
|
path("about/", views.AboutView.as_view(), name="about"),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -41,14 +41,9 @@ class MarkdownView(TemplateView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class DataProtectionView(MarkdownView):
|
class AboutView(MarkdownView):
|
||||||
template_name = "markdown.html"
|
template_name = "markdown.html"
|
||||||
md = "dataprotection.md"
|
md = "about.md"
|
||||||
|
|
||||||
|
|
||||||
class ImprintView(MarkdownView):
|
|
||||||
template_name = "markdown.html"
|
|
||||||
md = "imprint.md"
|
|
||||||
|
|
||||||
|
|
||||||
class BorgView(LoginRequiredMixin, ListView):
|
class BorgView(LoginRequiredMixin, ListView):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue