From 05ebb3b7ad59f98ea4b0580b498f4f26342f8464 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 16 Dec 2023 13:50:19 +0100 Subject: [PATCH] Removed starting of defrost after service is started and used instad the timer to start --- group_vars/all | 28 +++++++++---------- .../backup-docker-to-local.service.j2 | 2 +- .../backup-remote-to-local.service.j2 | 2 +- .../templates/cleanup-backups.service.j2 | 2 +- .../templates/cleanup-disc-space.service.j2 | 2 +- .../cleanup-failed-docker-backups.service.j2 | 2 +- .../templates/heal-docker.service.j2 | 2 +- .../templates/update-docker.service.j2 | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/group_vars/all b/group_vars/all index b00e3667..893e5b8f 100644 --- a/group_vars/all +++ b/group_vars/all @@ -1,33 +1,33 @@ # Server Tact Variables ## Ours in which the server is 100% working. Rest of the time is reserved for maintanance -hours_server_awake: "{{ range(9, 24) | list + range(0, 3) | list }}" +hours_server_awake: "0..2,9..23" ## Random delay for systemd timers to avoid peak loads. randomized_delay_sec: "5min" ## Schedule for Health Checks -on_calendar_health_btrfs: "*-*-* 00:00:00" -on_calendar_health_journalctl: "*-*-* 00:00:00" -on_calendar_health_disc_space: "*-*-* 06,12,18,00:00:00" -on_calendar_health_docker_container: "*-*-* {{ hours_server_awake | join(',') }}:00:00" -on_calendar_health_docker_volumes: "*-*-* {{ hours_server_awake | join(',') }}:15:00" -on_calendar_health_nginx: "*-*-* {{ hours_server_awake | join(',') }}:45:00" +on_calendar_health_btrfs: "*-*-* 00:00:00" # Check once per day the btrfs for errors +on_calendar_health_journalctl: "*-*-* 00:00:00" # Check once per day the journalctl for errors +on_calendar_health_disc_space: "*-*-* 06,12,18,00:00:00" # Check four times per day if there is sufficient disc space +on_calendar_health_docker_container: "*-*-* {{ hours_server_awake }}:00:00" # Check once per hour if the docker containers are healthy +on_calendar_health_docker_volumes: "*-*-* {{ hours_server_awake }}:15:00" # Check once per hour if the docker volumes are healthy +on_calendar_health_nginx: "*-*-* {{ hours_server_awake }}:45:00" ## Schedule for Cleanup Tasks -on_calendar_cleanup_backups: "*-*-* 06,12,18,00:30:00" -on_calendar_cleanup_disc_space: "*-*-* 07,13,19,01:30:00" +on_calendar_cleanup_backups: "*-*-* 00,06,12,18:30:00" # Cleanup backups every 6 hours, MUST be called before disc space cleanup +on_calendar_cleanup_disc_space: "*-*-* 07,13,19,01:30:00" # Cleanup disc space every 6 hours ## Schedule for Backup Tasks on_calendar_backup_docker_to_local: "*-*-* 03:30:00" on_calendar_backup_remote_to_local: "*-*-* 21:30:00" ## Schedule for Maintenance Tasks -on_calendar_heal_docker: "*-*-* {{ hours_server_awake | join(',') }}:30:00" -on_calendar_defrost: "*-*-* *:00,15,30,45:00" -on_calendar_renew_lets_encrypt_certificates: "*-*-* 12,00:30:00" -on_calendar_deploy_mailu_certificates: "*-*-* 13,01:30:00" -on_calendar_msi_keyboard_color: "*-*-* *:*:00" +on_calendar_heal_docker: "*-*-* {{ hours_server_awake }}:30:00" # Heal unhealthy docker instances once per hour +on_calendar_defrost: "*:0/5" # Defrost every 5min +on_calendar_renew_lets_encrypt_certificates: "*-*-* 12,00:30:00" # Renew Mailu certificates twice per day +on_calendar_deploy_mailu_certificates: "*-*-* 13,01:30:00" # Deploy Mailu certificates twice per day +on_calendar_msi_keyboard_color: "*-*-* *:*:00" # Change the keyboard color every minute # Storage Space-Related Configurations diff --git a/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 b/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 index 115693fc..63c3ffae 100644 --- a/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 +++ b/roles/backup-docker-to-local/templates/backup-docker-to-local.service.j2 @@ -5,4 +5,4 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service [Service] Type=oneshot ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_backup_services| join(' ') }} --timeout "{{system_maintenance_timeout_backup_services}}"' -ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file +ExecStart=/bin/sh -c '/usr/bin/python {{backup_docker_to_local_folder}}backup-docker-to-local.py' \ No newline at end of file diff --git a/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 b/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 index 260308b7..54cb98b9 100644 --- a/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 +++ b/roles/backup-remote-to-local/templates/backup-remote-to-local.service.j2 @@ -5,4 +5,4 @@ OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service [Service] Type=oneshot ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_backup_services| join(' ') }} --timeout "{{system_maintenance_timeout_backup_services}}"' -ExecStart=/bin/sh -c '/usr/bin/bash {{docker_backup_remote_to_local_folder}}backups-remote-to-local.sh && systemctl start system-maintenance-service-defrost.service' +ExecStart=/bin/sh -c '/usr/bin/bash {{docker_backup_remote_to_local_folder}}backups-remote-to-local.sh' diff --git a/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 b/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 index 30a3dc07..d8a62113 100644 --- a/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 +++ b/roles/cleanup-backups-service/templates/cleanup-backups.service.j2 @@ -5,4 +5,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services| join(' ') }} --timeout "{{system_maintenance_timeout_backup_services}}"' -ExecStart=/bin/sh -c '/usr/bin/python {{docker_cleanup_backups}}cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}} && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file +ExecStart=/bin/sh -c '/usr/bin/python {{docker_cleanup_backups}}cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}}' \ No newline at end of file diff --git a/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 b/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 index e243e92f..d23eac8e 100644 --- a/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 +++ b/roles/cleanup-disc-space/templates/cleanup-disc-space.service.j2 @@ -5,4 +5,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services| join(' ') }} --timeout "{{system_maintenance_timeout_backup_services}}"' -ExecStart=/bin/sh -c '/bin/bash {{cleanup_disc_space_folder}}cleanup-disc-space.sh {{size_percent_cleanup_disc_space}} && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file +ExecStart=/bin/sh -c '/bin/bash {{cleanup_disc_space_folder}}cleanup-disc-space.sh {{size_percent_cleanup_disc_space}}' \ No newline at end of file diff --git a/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 b/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 index 40fa655a..287400a5 100644 --- a/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 +++ b/roles/cleanup-failed-docker-backups/templates/cleanup-failed-docker-backups.service.j2 @@ -5,4 +5,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services| join(' ') }} --timeout "{{system_maintenance_timeout_backup_services}}"' -ExecStart=/bin/sh -c '/usr/bin/yes | /usr/bin/bash {{backup_docker_to_local_cleanup_folder}}cleanup.sh {{backup_docker_to_local_cleanup_machine_id}} {{backup_docker_to_local_cleanup_trigger_directory}} && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file +ExecStart=/bin/sh -c '/usr/bin/yes | /usr/bin/bash {{backup_docker_to_local_cleanup_folder}}cleanup.sh {{backup_docker_to_local_cleanup_machine_id}} {{backup_docker_to_local_cleanup_trigger_directory}}' \ No newline at end of file diff --git a/roles/heal-docker/templates/heal-docker.service.j2 b/roles/heal-docker/templates/heal-docker.service.j2 index b225eeb3..85b04ba7 100644 --- a/roles/heal-docker/templates/heal-docker.service.j2 +++ b/roles/heal-docker/templates/heal-docker.service.j2 @@ -5,4 +5,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services| join(' ') }} heal-docker --timeout "{{system_maintenance_timeout_heal_docker}}"' -ExecStart=/bin/sh -c '/bin/python {{heal_docker}}heal-docker.py && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file +ExecStart=/bin/sh -c '/bin/python {{heal_docker}}heal-docker.py' \ No newline at end of file diff --git a/roles/update-docker/templates/update-docker.service.j2 b/roles/update-docker/templates/update-docker.service.j2 index 2c1d2eaa..aaf1cc33 100644 --- a/roles/update-docker/templates/update-docker.service.j2 +++ b/roles/update-docker/templates/update-docker.service.j2 @@ -5,4 +5,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_maintenance_service_freezer_script }} freeze {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services | join(' ') }} update-docker --timeout "{{system_maintenance_timeout_heal_docker}}"' -ExecStart=/bin/sh -c '/usr/bin/python {{update_docker_script}} {{path_docker_compose_instances}} && systemctl start system-maintenance-service-defrost.service' \ No newline at end of file +ExecStart=/bin/sh -c '/usr/bin/python {{update_docker_script}} {{path_docker_compose_instances}}' \ No newline at end of file