From 0eff309f15c91b11d71e5c4d939659d20188e88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 7 Dec 2022 16:27:07 +0100 Subject: [PATCH] nimbus-era-files: add support for Darwin platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Necessary for Prater MacOS host. Signed-off-by: Jakub SokoĊ‚owski --- ansible/requirements.yml | 11 +++-- .../roles/nimbus-era-files/tasks/darwin.yml | 31 +++++++++++++ .../roles/nimbus-era-files/tasks/linux.yml | 36 +++++++++++++++ ansible/roles/nimbus-era-files/tasks/main.yml | 45 +------------------ .../nimbus-era-files/templates/verify.sh.j2 | 9 ++++ 5 files changed, 86 insertions(+), 46 deletions(-) create mode 100644 ansible/roles/nimbus-era-files/tasks/darwin.yml create mode 100644 ansible/roles/nimbus-era-files/tasks/linux.yml create mode 100644 ansible/roles/nimbus-era-files/templates/verify.sh.j2 diff --git a/ansible/requirements.yml b/ansible/requirements.yml index b22225e..f136fcd 100644 --- a/ansible/requirements.yml +++ b/ansible/requirements.yml @@ -56,12 +56,12 @@ - name: infra-role-beacon-node-macos src: git@github.com:status-im/infra-role-beacon-node-macos.git - version: 0500bb3c31c31a1f8d795e2660c4d4df322b8022 + version: ba40b3afc3453f975dd4a48f593788c960474f31 scm: git - name: infra-role-validator-client src: git@github.com:status-im/infra-role-validator-client.git - version: 628585f27f65db1fdedd9de850649a63e5996a83 + version: 95fb05ae039b22a346d7e84d95b1f76bd1e2d55d scm: git - name: infra-role-nimbus-eth1 @@ -106,7 +106,12 @@ - name: systemd-timer src: git@github.com:status-im/infra-role-systemd-timer.git - version: 0cc94695f3dada39213a87fbe923cd90e2a7d2c2 + version: 24b9f3c82b0f2cc89211e40b0abce07e983e67c1 + scm: git + +- name: launchd-timer + src: git@github.com:status-im/infra-role-launchd-timer.git + version: d73da3f46608a3a6522e4de5ec51ef6be8e46f0d scm: git - name: swap-file diff --git a/ansible/roles/nimbus-era-files/tasks/darwin.yml b/ansible/roles/nimbus-era-files/tasks/darwin.yml new file mode 100644 index 0000000..36a8ae9 --- /dev/null +++ b/ansible/roles/nimbus-era-files/tasks/darwin.yml @@ -0,0 +1,31 @@ +--- +- name: Create timer for ERA file updates + include_role: name=launchd-timer + vars: + launchd_timer_description: 'Update Nimbus beacon node ERA files' + launchd_timer_start_on_creation: false + launchd_timer_enabled: '{{ nimbus_era_files_timer_enabled }}' + launchd_timer_name: '{{ nimbus_era_files_timer_update_name }}' + launchd_timer_user: '{{ nimbus_era_files_timer_user }}' + launchd_timer_group: '{{ nimbus_era_files_timer_group }}' + launchd_timer_frequency: '{{ nimbus_era_files_timer_frequency }}' + launchd_timer_timeout_sec: '{{ nimbus_era_files_timer_timeout_sec }}' + launchd_timer_work_dir: '{{ nimbus_era_files_timer_path }}' + launchd_timer_script_path: '{{ nimbus_era_files_nclidb_path }}' + launchd_timer_script_args: > + --network={{ nimbus_era_files_network }} exportEra --db={{ nimbus_era_files_db_path }} + +- name: Create timer for ERA file verification + include_role: name=launchd-timer + vars: + launchd_timer_description: 'Verify Nimbus beacon node ERA files' + launchd_timer_start_on_creation: false + launchd_timer_consul_warning: true + launchd_timer_enabled: '{{ nimbus_era_files_timer_enabled }}' + launchd_timer_name: '{{ nimbus_era_files_timer_verify_name }}' + launchd_timer_user: '{{ nimbus_era_files_timer_user }}' + launchd_timer_group: '{{ nimbus_era_files_timer_group }}' + launchd_timer_frequency: '{{ nimbus_era_files_timer_frequency }}' + launchd_timer_timeout_sec: '{{ nimbus_era_files_timer_timeout_sec }}' + launchd_timer_work_dir: '{{ nimbus_era_files_timer_path }}' + launchd_timer_script_content: '{{ lookup("template", "verify.sh.j2") }}' diff --git a/ansible/roles/nimbus-era-files/tasks/linux.yml b/ansible/roles/nimbus-era-files/tasks/linux.yml new file mode 100644 index 0000000..52b1f6a --- /dev/null +++ b/ansible/roles/nimbus-era-files/tasks/linux.yml @@ -0,0 +1,36 @@ +--- +- name: Create timer for ERA file updates + include_role: name=systemd-timer + vars: + systemd_timer_description: 'Update Nimbus beacon node ERA files' + systemd_timer_start_on_creation: false + systemd_timer_enabled: '{{ nimbus_era_files_timer_enabled }}' + systemd_timer_name: '{{ nimbus_era_files_timer_update_name }}' + systemd_timer_user: '{{ nimbus_era_files_timer_user }}' + systemd_timer_group: '{{ nimbus_era_files_timer_group }}' + systemd_timer_frequency: '{{ nimbus_era_files_timer_frequency }}' + systemd_timer_random_delay_sec: '{{ nimbus_era_files_timer_random_delay_sec }}' + systemd_timer_timeout_sec: '{{ nimbus_era_files_timer_timeout_sec }}' + systemd_timer_ionice_class: '{{ nimbus_era_files_timer_ionice_class }}' + systemd_timer_work_dir: '{{ nimbus_era_files_timer_path }}' + systemd_timer_script_path: '{{ nimbus_era_files_nclidb_path }}' + systemd_timer_script_args: > + --network={{ nimbus_era_files_network }} exportEra --db={{ nimbus_era_files_db_path }} + +- name: Create timer for ERA file verification + include_role: name=systemd-timer + vars: + systemd_timer_description: 'Verify Nimbus beacon node ERA files' + systemd_timer_start_on_creation: false + systemd_timer_consul_warning: true + systemd_timer_enabled: '{{ nimbus_era_files_timer_enabled }}' + systemd_timer_name: '{{ nimbus_era_files_timer_verify_name }}' + systemd_timer_user: '{{ nimbus_era_files_timer_user }}' + systemd_timer_group: '{{ nimbus_era_files_timer_group }}' + systemd_timer_frequency: '{{ nimbus_era_files_timer_frequency }}' + systemd_timer_random_delay_sec: '{{ nimbus_era_files_timer_random_delay_sec }}' + systemd_timer_timeout_sec: '{{ nimbus_era_files_timer_timeout_sec }}' + systemd_timer_ionice_class: '{{ nimbus_era_files_timer_ionice_class }}' + systemd_timer_work_dir: '{{ nimbus_era_files_timer_path }}' + systemd_timer_after_extra: '{{ nimbus_era_files_timer_update_name }}.service' + launchd_timer_script_content: '{{ lookup("template", "verify.sh.j2") }}' diff --git a/ansible/roles/nimbus-era-files/tasks/main.yml b/ansible/roles/nimbus-era-files/tasks/main.yml index 8307c41..5907cc0 100644 --- a/ansible/roles/nimbus-era-files/tasks/main.yml +++ b/ansible/roles/nimbus-era-files/tasks/main.yml @@ -7,46 +7,5 @@ state: 'directory' mode: '0755' -- name: Create timer for ERA file updates - include_role: name=systemd-timer - vars: - systemd_timer_description: 'Update Nimbus beacon node ERA files' - systemd_timer_start_on_creation: false - systemd_timer_enabled: '{{ nimbus_era_files_timer_enabled }}' - systemd_timer_name: '{{ nimbus_era_files_timer_update_name }}' - systemd_timer_user: '{{ nimbus_era_files_timer_user }}' - systemd_timer_group: '{{ nimbus_era_files_timer_group }}' - systemd_timer_frequency: '{{ nimbus_era_files_timer_frequency }}' - systemd_timer_random_delay_sec: '{{ nimbus_era_files_timer_random_delay_sec }}' - systemd_timer_timeout_sec: '{{ nimbus_era_files_timer_timeout_sec }}' - systemd_timer_ionice_class: '{{ nimbus_era_files_timer_ionice_class }}' - systemd_timer_work_dir: '{{ nimbus_era_files_timer_path }}' - systemd_timer_script_path: '{{ nimbus_era_files_nclidb_path }}' - systemd_timer_script_args: > - --network={{ nimbus_era_files_network }} exportEra --db={{ nimbus_era_files_db_path }} - -- name: Create timer for ERA file verification - include_role: name=systemd-timer - vars: - systemd_timer_description: 'Verify Nimbus beacon node ERA files' - systemd_timer_start_on_creation: false - systemd_timer_consul_warning: true - systemd_timer_enabled: '{{ nimbus_era_files_timer_enabled }}' - systemd_timer_name: '{{ nimbus_era_files_timer_verify_name }}' - systemd_timer_user: '{{ nimbus_era_files_timer_user }}' - systemd_timer_group: '{{ nimbus_era_files_timer_group }}' - systemd_timer_frequency: '{{ nimbus_era_files_timer_frequency }}' - systemd_timer_random_delay_sec: '{{ nimbus_era_files_timer_random_delay_sec }}' - systemd_timer_timeout_sec: '{{ nimbus_era_files_timer_timeout_sec }}' - systemd_timer_ionice_class: '{{ nimbus_era_files_timer_ionice_class }}' - systemd_timer_work_dir: '{{ nimbus_era_files_timer_path }}' - systemd_timer_after_extra: '{{ nimbus_era_files_timer_update_name }}.service' - systemd_timer_script_content: | - #!/usr/bin/env bash - set -e - for ERA_FILE in {{ nimbus_era_files_timer_path }}/*; do - echo "Checking: ${ERA_FILE}" - {{ nimbus_era_files_nclidb_path }} \ - --network={{ nimbus_era_files_network }} \ - verifyEra --eraFile="${ERA_FILE}" - done +- name: Create ERA generating timer + include_tasks: '{{ ansible_system | lower }}.yml' diff --git a/ansible/roles/nimbus-era-files/templates/verify.sh.j2 b/ansible/roles/nimbus-era-files/templates/verify.sh.j2 new file mode 100644 index 0000000..6752a80 --- /dev/null +++ b/ansible/roles/nimbus-era-files/templates/verify.sh.j2 @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# vim: ft=bash +set -e +for ERA_FILE in {{ nimbus_era_files_timer_path }}/*; do + echo "Checking: ${ERA_FILE}" + {{ nimbus_era_files_nclidb_path }} \ + --network={{ nimbus_era_files_network }} \ + verifyEra --eraFile="${ERA_FILE}" +done