nimbus-era-files: role for ERA generating timer

https://github.com/status-im/infra-nimbus/issues/98

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-07-14 00:59:59 +02:00
parent ce48768972
commit 00cfcf569f
No known key found for this signature in database
GPG Key ID: 09AA5403E54D9931
3 changed files with 75 additions and 0 deletions

View File

@ -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.
```

View File

@ -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: ~

View File

@ -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 }}'