Finished backup update

This commit is contained in:
Kevin Veen-Birkenbach 2025-07-17 00:34:54 +02:00
parent 807fab42c3
commit 1bdfb71f2f
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
10 changed files with 56 additions and 13 deletions

View File

@ -5,7 +5,7 @@ docker:
image: "mariadb"
name: "mariadb"
backup:
datase_routine: true
database_routine: true
network: "mariadb"
volumes:
data: "mariadb_data"

View File

@ -4,4 +4,4 @@ docker:
image: memcached
version: latest
backup:
enabled: false
disabled: true

View File

@ -8,7 +8,7 @@ docker:
# Rolling release isn't recommended
version: "latest"
backup:
datase_routine: true
database_routine: true
volumes:
data: "postgres_data"
network: "postgres"

View File

@ -4,4 +4,4 @@ docker:
image: redis
version: alpine
backup:
enabled: false
disabled: true

View File

@ -0,0 +1,2 @@
# Todos
- Add to all of the applications the correct backup procedures.

View File

@ -20,17 +20,17 @@ bkp_docker_to_local_disabled: >-
# CLI argument strings (only set if list not empty)
bkp_docker_to_local_database_routine_cli: >-
{% if bkp_docker_to_local_database_routine | length > 0 -%}
--database-containers="{{ bkp_docker_to_local_database_routine | join(' ') }}"
--database-containers {{ bkp_docker_to_local_database_routine | join(' ') }}
{%- endif %}
bkp_docker_to_local_no_stop_required_cli: >-
{% if bkp_docker_to_local_no_stop_required | length > 0 -%}
--images-no-stop-required="{{ bkp_docker_to_local_no_stop_required | join(' ') }}"
--images-no-stop-required {{ bkp_docker_to_local_no_stop_required | join(' ') }}
{%- endif %}
bkp_docker_to_local_disabled_cli: >-
{% if bkp_docker_to_local_disabled | length > 0 -%}
--images-no-backup-required="{{ bkp_docker_to_local_disabled | join(' ') }}"
--images-no-backup-required {{ bkp_docker_to_local_disabled | join(' ') }}
{%- endif %}
# List of CLI args for convenience (e.g. for looping or joining)
@ -42,5 +42,4 @@ bkp_docker_to_local_cli_args_list:
bkp_docker_to_local_exec: >-
/usr/bin/python {{ backup_docker_to_local_folder }}backup-docker-to-local.py
--compose-dir {{ path_docker_compose_instances }}
{{ bkp_docker_to_local_cli_args_list | select('string') | join(' ') }}
| trim
{{ bkp_docker_to_local_cli_args_list | select('string') | join(' ') }}

View File

@ -19,15 +19,17 @@ docker:
database:
enabled: true
nextcloud:
name: "nextcloud"
image: "nextcloud"
version: "latest-fpm-alpine"
name: "nextcloud"
image: "nextcloud"
version: "latest-fpm-alpine"
backup:
no_stop_required: true
proxy:
name: "nextcloud-proxy"
image: "nginx"
version: "alpine"
backup:
no_stop_required: true
cron:
name: "nextcloud-cron"
talk:

View File

@ -7,7 +7,9 @@ docker:
enabled: false # Enable the database
{{ application_id }}:
backup:
no_stop_required: true
no_stop_required: true # The images that don't need to stop
disabled: true # Disables the image
database_routine: true # Instead of copying a database routine will be triggered for this container
image: ""
version: "latest"
name: "web-app-{{ application_id }}"

View File

@ -0,0 +1 @@
# This file contains reset procedures which will be executed at the begining of the role for cleanup

View File

@ -0,0 +1,37 @@
import unittest
import re
from pathlib import Path
# Regex:
# - one or more lowercase letters, digits or hyphens
# - optionally exactly one '_' followed by one or more lowercase letters, digits or hyphens
ROLE_NAME_PATTERN = re.compile(r'^[a-z0-9-]+(?:_[a-z0-9-]+)?$')
class TestRoleNames(unittest.TestCase):
def test_role_names_follow_naming_convention(self):
# go up from tests/integration/test_roles_naming.py to project root, then into roles/
roles_dir = Path(__file__).resolve().parents[2] / "roles"
self.assertTrue(
roles_dir.is_dir(),
f"'roles/' directory not found at {roles_dir}"
)
invalid_names = []
for role_path in roles_dir.iterdir():
if not role_path.is_dir():
# skip non-directories
continue
name = role_path.name
if not ROLE_NAME_PATTERN.fullmatch(name):
invalid_names.append(name)
self.assertFalse(
invalid_names,
"The following role directory names violate the naming convention "
"(only az, 09, '-', max one '_', and '_' must be followed by at least one character):\n"
+ "\n".join(f"- {n}" for n in invalid_names)
)
if __name__ == "__main__":
unittest.main()