mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-07-19 23:04:25 +02:00
Finished backup update
This commit is contained in:
parent
807fab42c3
commit
1bdfb71f2f
@ -5,7 +5,7 @@ docker:
|
|||||||
image: "mariadb"
|
image: "mariadb"
|
||||||
name: "mariadb"
|
name: "mariadb"
|
||||||
backup:
|
backup:
|
||||||
datase_routine: true
|
database_routine: true
|
||||||
network: "mariadb"
|
network: "mariadb"
|
||||||
volumes:
|
volumes:
|
||||||
data: "mariadb_data"
|
data: "mariadb_data"
|
@ -4,4 +4,4 @@ docker:
|
|||||||
image: memcached
|
image: memcached
|
||||||
version: latest
|
version: latest
|
||||||
backup:
|
backup:
|
||||||
enabled: false
|
disabled: true
|
@ -8,7 +8,7 @@ docker:
|
|||||||
# Rolling release isn't recommended
|
# Rolling release isn't recommended
|
||||||
version: "latest"
|
version: "latest"
|
||||||
backup:
|
backup:
|
||||||
datase_routine: true
|
database_routine: true
|
||||||
volumes:
|
volumes:
|
||||||
data: "postgres_data"
|
data: "postgres_data"
|
||||||
network: "postgres"
|
network: "postgres"
|
@ -4,4 +4,4 @@ docker:
|
|||||||
image: redis
|
image: redis
|
||||||
version: alpine
|
version: alpine
|
||||||
backup:
|
backup:
|
||||||
enabled: false
|
disabled: true
|
2
roles/sys-bkp-docker-2-loc/Todo.md
Normal file
2
roles/sys-bkp-docker-2-loc/Todo.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Todos
|
||||||
|
- Add to all of the applications the correct backup procedures.
|
@ -20,17 +20,17 @@ bkp_docker_to_local_disabled: >-
|
|||||||
# CLI argument strings (only set if list not empty)
|
# CLI argument strings (only set if list not empty)
|
||||||
bkp_docker_to_local_database_routine_cli: >-
|
bkp_docker_to_local_database_routine_cli: >-
|
||||||
{% if bkp_docker_to_local_database_routine | length > 0 -%}
|
{% 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 %}
|
{%- endif %}
|
||||||
|
|
||||||
bkp_docker_to_local_no_stop_required_cli: >-
|
bkp_docker_to_local_no_stop_required_cli: >-
|
||||||
{% if bkp_docker_to_local_no_stop_required | length > 0 -%}
|
{% 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 %}
|
{%- endif %}
|
||||||
|
|
||||||
bkp_docker_to_local_disabled_cli: >-
|
bkp_docker_to_local_disabled_cli: >-
|
||||||
{% if bkp_docker_to_local_disabled | length > 0 -%}
|
{% 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 %}
|
{%- endif %}
|
||||||
|
|
||||||
# List of CLI args for convenience (e.g. for looping or joining)
|
# List of CLI args for convenience (e.g. for looping or joining)
|
||||||
@ -43,4 +43,3 @@ bkp_docker_to_local_exec: >-
|
|||||||
/usr/bin/python {{ backup_docker_to_local_folder }}backup-docker-to-local.py
|
/usr/bin/python {{ backup_docker_to_local_folder }}backup-docker-to-local.py
|
||||||
--compose-dir {{ path_docker_compose_instances }}
|
--compose-dir {{ path_docker_compose_instances }}
|
||||||
{{ bkp_docker_to_local_cli_args_list | select('string') | join(' ') }}
|
{{ bkp_docker_to_local_cli_args_list | select('string') | join(' ') }}
|
||||||
| trim
|
|
@ -19,15 +19,17 @@ docker:
|
|||||||
database:
|
database:
|
||||||
enabled: true
|
enabled: true
|
||||||
nextcloud:
|
nextcloud:
|
||||||
name: "nextcloud"
|
name: "nextcloud"
|
||||||
image: "nextcloud"
|
image: "nextcloud"
|
||||||
version: "latest-fpm-alpine"
|
version: "latest-fpm-alpine"
|
||||||
backup:
|
backup:
|
||||||
no_stop_required: true
|
no_stop_required: true
|
||||||
proxy:
|
proxy:
|
||||||
name: "nextcloud-proxy"
|
name: "nextcloud-proxy"
|
||||||
image: "nginx"
|
image: "nginx"
|
||||||
version: "alpine"
|
version: "alpine"
|
||||||
|
backup:
|
||||||
|
no_stop_required: true
|
||||||
cron:
|
cron:
|
||||||
name: "nextcloud-cron"
|
name: "nextcloud-cron"
|
||||||
talk:
|
talk:
|
||||||
|
@ -7,7 +7,9 @@ docker:
|
|||||||
enabled: false # Enable the database
|
enabled: false # Enable the database
|
||||||
{{ application_id }}:
|
{{ application_id }}:
|
||||||
backup:
|
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: ""
|
image: ""
|
||||||
version: "latest"
|
version: "latest"
|
||||||
name: "web-app-{{ application_id }}"
|
name: "web-app-{{ application_id }}"
|
||||||
|
1
templates/roles/web-app/tasks/reset.yml.j2
Normal file
1
templates/roles/web-app/tasks/reset.yml.j2
Normal file
@ -0,0 +1 @@
|
|||||||
|
# This file contains reset procedures which will be executed at the begining of the role for cleanup
|
37
tests/integration/test_roles_naming.py
Normal file
37
tests/integration/test_roles_naming.py
Normal 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 a–z, 0–9, '-', 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()
|
Loading…
x
Reference in New Issue
Block a user