diff --git a/ansible/roles/nimbus-era-files/README.md b/ansible/roles/nimbus-era-files/README.md new file mode 100644 index 0000000..f7cefa2 --- /dev/null +++ b/ansible/roles/nimbus-era-files/README.md @@ -0,0 +1,38 @@ +# Description + +This role configures a Systemd timer which generates Nimbus ERA files weekly. + +The purpose of those is to save space by sharing the same historical data between nodes. + +Read more about ERA files [here](https://github.com/status-im/nimbus-eth2/blob/unstable/docs/e2store.md#era-files). + +# Configuration + +```yaml +nimbus_era_files_timer_name: 'nimbus-era-files-update' +nimbus_era_files_timer_path: '/data/era' +nimbus_era_files_nclidb_path: '/data/nimbus/repo/build/bin/ncli_db' +nimbus_era_files_db_path: '/data/nimbus/data/db' +``` + +# Management + +The timer runs weekly with 12h random delay by default, but you can start it manually: +``` + > systemctl -o cat status nimbus-era-files-update +● nimbus-era-files-update.service - Update Nimbus beacon node ERA files + Loaded: loaded (/etc/systemd/system/nimbus-era-files-update.service; static; vendor preset: enabled) + Active: inactive (dead) since Wed 2022-07-13 20:22:16 UTC; 2h 31min ago +TriggeredBy: ● nimbus-era-files-update.timer + Docs: https://github.com/status-im/infra-role-systemd-timer + Process: 153635 ExecStart=/data/beacon-node-mainnet-stable-01/repo/build/ncli_db exportEra --db=/data/beacon-node-mainnet-stable-01/data/shared_mainnet_0/db (code=exited, status=0/SUCCESS) + Main PID: 153635 (code=exited, status=0/SUCCESS) + +Written all complete eras +All time are ms + Average, StdDev, Min, Max, Samples, Test + 565.673, 41.529, 486.430, 635.203, 45, tState + 1107.374, 147.118, 685.914, 1293.401, 45, tBlocks +nimbus-era-files-update.service: Succeeded. +Finished Update Nimbus beacon node ERA files. +``` diff --git a/ansible/roles/nimbus-era-files/defaults/main.yml b/ansible/roles/nimbus-era-files/defaults/main.yml new file mode 100644 index 0000000..f2e0c05 --- /dev/null +++ b/ansible/roles/nimbus-era-files/defaults/main.yml @@ -0,0 +1,14 @@ +--- +nimbus_era_files_timer_name: 'nimbus-era-files-update' +nimbus_era_files_timer_path: '/data/era' +nimbus_era_files_timer_user: 'nimbus' +nimbus_era_files_timer_group: 'staff' +nimbus_era_files_timer_frequency: 'weekly' +nimbus_era_files_timer_timeout_sec: 82800 +nimbus_era_files_timer_random_delay_sec: '{{ 60 * 60 * 12 }}' +nimbus_era_files_timer_ionice_class: 'idle' +nimbus_era_files_timer_script: '{{ nimbus_era_files_timer_path }}/update.sh' + +# Mandatory +#nimbus_era_files_nclidb_path: ~ +#nimbus_era_files_db_path: ~ diff --git a/ansible/roles/nimbus-era-files/tasks/main.yml b/ansible/roles/nimbus-era-files/tasks/main.yml new file mode 100644 index 0000000..ff8f300 --- /dev/null +++ b/ansible/roles/nimbus-era-files/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- name: Create ERA files directory + file: + path: '{{ nimbus_era_files_timer_path }}' + owner: '{{ nimbus_era_files_timer_user }}' + group: '{{ nimbus_era_files_timer_group }}' + state: 'directory' + +- 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_name: '{{ nimbus_era_files_timer_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: 'exportEra --db={{ nimbus_era_files_db_path }}'