-
Notifications
You must be signed in to change notification settings - Fork 2
09 25 feat sparkles adds ethereum besu service #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
da597ca
1c804cd
5d1b817
5b18cdf
5c71819
4d30d52
9bf4706
527a75b
f18d026
7b1fe20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
|
|
||
| ethereum_cmd: "{{ depin_cmd | default('install') }}" | ||
| ethereum_besu_version: 24.9.1 | ||
| ethereum_teku_version: 24.8.0 | ||
| ethereum_custom_metrics_port: 33006 | ||
| ethereum_besu_download_url: "https://github.com/hyperledger/besu/releases/download/24.9.1/besu-24.9.1.zip" | ||
| ethereum_teku_download_url: "https://artifacts.consensys.net/public/teku/raw/names/teku.zip/versions/24.8.0/teku-24.8.0.zip" | ||
|
|
||
| # Node configuration | ||
|
|
||
| ethereum_network: holesky | ||
| ethereum_besu_rpc_http_host: 0.0.0.0 | ||
| ethereum_public_ip: "" | ||
| ethereum_besu_rpc_ws_host: 0.0.0.0 | ||
| ethereum_besu_metrics_host: 0.0.0.0 | ||
| ethereum_besu_metrics_port: 9545 | ||
|
|
||
| ethereum_teku_ee_endpoint: http://localhost:8551 | ||
| ethereum_teku_checkpoint_sync_url: https://checkpoint-sync.holesky.ethpandaops.io |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| --- | ||
| - name: Install dependencies | ||
| become: true | ||
| ansible.builtin.apt: | ||
| name: | ||
| - openjdk-21-jdk | ||
| state: present | ||
| update_cache: true | ||
|
|
||
| - name: Create program folder for besu | ||
| become: true | ||
| ansible.builtin.file: | ||
| state: directory | ||
| owner: root | ||
| group: root | ||
| mode: '0755' | ||
| dest: /opt/ethereum_besu/{{ ethereum_besu_version }} | ||
|
|
||
| - name: Create program folder for teku | ||
| become: true | ||
| ansible.builtin.file: | ||
| state: directory | ||
| owner: root | ||
| group: root | ||
| mode: '0755' | ||
| dest: /opt/ethereum_teku/{{ ethereum_teku_version }} | ||
|
|
||
| - name: Download besu binary to tmp | ||
| become: true | ||
| ansible.builtin.unarchive: | ||
| remote_src: true | ||
| src: "{{ ethereum_besu_download_url }}" | ||
| dest: /tmp | ||
| failed_when: false | ||
|
|
||
| - name: Download teku binary to tmp | ||
| become: true | ||
| ansible.builtin.unarchive: | ||
| remote_src: true | ||
| src: "{{ ethereum_teku_download_url }}" | ||
| dest: /tmp | ||
| failed_when: false | ||
|
|
||
| - name: Find besu binary | ||
| become: true | ||
| ansible.builtin.find: | ||
| paths: | ||
| - /tmp | ||
| - "{{ ethereum_besu_download_path | default('/tmp') }}" | ||
| patterns: 'besu$' | ||
| use_regex: true | ||
| get_checksum: true | ||
| recurse: true | ||
| register: _download_besu | ||
|
|
||
| - name: Find teku binary | ||
| become: true | ||
| ansible.builtin.find: | ||
| paths: | ||
| - /tmp | ||
| - "{{ ethereum_teku_download_path | default('/tmp') }}" | ||
| patterns: 'teku$' | ||
| use_regex: true | ||
| get_checksum: true | ||
| recurse: true | ||
| register: _download_teku | ||
|
Comment on lines
+10
to
+66
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should try and leverage There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably this should be changed with new phase - because testing with integrating clients and server node can spent weeks to be sure that all works as expected. And changing of this part cannot be tested right now. |
||
|
|
||
| - name: Generate the shared secret | ||
| become: true | ||
| ansible.builtin.shell: openssl rand -hex 32 | tr -d "\n" > /tmp/jwtsecret.hex | ||
|
|
||
| - name: Copy the shared secret to execution client | ||
| become: true | ||
| ansible.builtin.copy: | ||
| remote_src: true | ||
| src: /tmp/jwtsecret.hex | ||
| dest: /opt/ethereum_besu/{{ ethereum_besu_version }}/jwtsecret.hex | ||
|
|
||
| - name: Copy the shared secret to consensus client | ||
| become: true | ||
| ansible.builtin.copy: | ||
| remote_src: true | ||
| src: /tmp/jwtsecret.hex | ||
| dest: /opt/ethereum_teku/{{ ethereum_teku_version }}/jwtsecret.hex | ||
|
|
||
| - name: Get public IP | ||
| uri: | ||
| url: https://ipecho.net/plain | ||
| method: GET | ||
| return_content: yes | ||
| status_code: 200 | ||
| register: public_ip | ||
| ignore_errors: True | ||
|
|
||
| - name: Set the public ip | ||
| set_fact: | ||
| ethereum_public_ip: "{{ public_ip.content }}" | ||
| when: public_ip.status == 200 | ||
|
|
||
| - name: Install execution client | ||
| when: _download_besu['files'] | length > 0 | ||
| become: true | ||
| vars: | ||
| _files: | | ||
| {{ | ||
| _download_besu['files'] | | ||
| selectattr('checksum', 'equalto', ethereum_besu_checksum | default('')) | ||
| }} | ||
| block: | ||
| - name: Copy required files | ||
| ansible.builtin.copy: | ||
| remote_src: true | ||
| src: /tmp/besu-{{ ethereum_besu_version }}/ | ||
| dest: /opt/ethereum_besu/{{ ethereum_besu_version }} | ||
| mode: '0755' | ||
|
|
||
| - name: Copy besu config file | ||
| become: true | ||
| ansible.builtin.template: | ||
| src: templates/config_besu.toml.j2 | ||
| dest: /opt/ethereum_besu/{{ ethereum_besu_version }}/config_besu.toml | ||
| mode: '0777' | ||
|
|
||
| - name: Create besu systemd file | ||
| ansible.builtin.template: | ||
| src: templates/systemd.besu_service.j2 | ||
| dest: /etc/systemd/system/ethereum_besu.service | ||
| mode: '0644' | ||
|
|
||
| - name: Install consensus client | ||
| when: _download_teku['files'] | length > 0 | ||
| become: true | ||
| vars: | ||
| _files: | | ||
| {{ | ||
| _download_teku['files'] | | ||
| selectattr('checksum', 'equalto', ethereum_teku_checksum | default('')) | ||
| }} | ||
| block: | ||
| - name: Copy required files | ||
| ansible.builtin.copy: | ||
| remote_src: true | ||
| src: /tmp/teku-{{ ethereum_teku_version }}/ | ||
| dest: /opt/ethereum_teku/{{ ethereum_teku_version }} | ||
| mode: '0755' | ||
|
|
||
| - name: Copy teku config file | ||
| become: true | ||
| ansible.builtin.template: | ||
| src: templates/config_teku.yaml.j2 | ||
| dest: /opt/ethereum_teku/{{ ethereum_teku_version }}/config_teku.yaml | ||
| mode: '0777' | ||
|
|
||
| - name: Create teku systemd file | ||
| ansible.builtin.template: | ||
| src: templates/systemd.teku_service.j2 | ||
| dest: /etc/systemd/system/ethereum_teku.service | ||
| mode: '0644' | ||
|
|
||
| - name: Start node | ||
| ansible.builtin.include_tasks: | ||
| file: commands/start.yml | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| - name: Uninstall | ||
| ansible.builtin.include_tasks: commands/uninstall.yml | ||
|
|
||
| - name: Install | ||
| ansible.builtin.include_tasks: commands/install.yml | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| ## stop and start service | ||
| - name: Stop | ||
| ansible.builtin.include_tasks: commands/stop.yml | ||
|
|
||
| - name: Start | ||
| ansible.builtin.include_tasks: commands/start.yml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| # Run the ethereum_besu | ||
| - name: Start execution client | ||
| become: true | ||
| ansible.builtin.service: | ||
| name: ethereum_besu | ||
| enabled: true | ||
| daemon_reload: true | ||
| state: started | ||
|
|
||
| - name: Pause for 1 minute for ensure execution client | ||
| ansible.builtin.pause: | ||
| minutes: 1 | ||
|
|
||
| - name: Start consensus client | ||
| become: true | ||
| ansible.builtin.service: | ||
| name: ethereum_teku | ||
| enabled: true | ||
| daemon_reload: true | ||
| state: started | ||
|
|
||
| - name: Assert | ||
| when: "'molecule' in groups" | ||
| block: | ||
| - name: Get service info | ||
| become: true | ||
| ansible.builtin.systemd: | ||
| name: "ethereum_besu" | ||
| register: _ethereum_besu | ||
|
|
||
| - debug: | ||
| var: _ethereum_besu.status.ActiveState | ||
|
|
||
| - name: Ensure besu is active state | ||
| ansible.builtin.assert: | ||
| that: | ||
| - _ethereum_besu['status']['ActiveState']=='active' | ||
| quiet: true | ||
|
|
||
| - name: Set pid | ||
| ansible.builtin.set_fact: | ||
| _presearch_pid: "{{ _ethereum_besu['status']['ExecMainPID'] }}" | ||
|
|
||
| - name: Get service info | ||
| become: true | ||
| ansible.builtin.systemd: | ||
| name: "ethereum_teku" | ||
| register: _ethereum_teku | ||
|
|
||
| - debug: | ||
| var: _ethereum_teku.status.ActiveState | ||
|
|
||
| - name: Ensure teku is active state | ||
| ansible.builtin.assert: | ||
| that: | ||
| - _ethereum_teku['status']['ActiveState']=='active' | ||
| quiet: true | ||
|
|
||
| - name: Set pid | ||
| ansible.builtin.set_fact: | ||
| _presearch_pid: "{{ _ethereum_teku['status']['ExecMainPID'] }}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| --- | ||
| # Stop ethereum_besu | ||
| - name: Stop ethereum_besu | ||
| become: true | ||
| ansible.builtin.systemd: | ||
| name: ethereum_besu | ||
| state: stopped | ||
|
|
||
| - name: Stop ethereum_besu | ||
| become: true | ||
| ansible.builtin.systemd: | ||
| name: ethereum_teku | ||
| state: stopped | ||
|
|
||
| - name: Assert | ||
| when: "'molecule' in groups" | ||
| block: | ||
| - name: Get service info | ||
| become: true | ||
| ansible.builtin.systemd: | ||
| name: "ethereum_besu" | ||
| register: _ethereum_besu | ||
|
|
||
| - name: Debug service status | ||
| debug: | ||
| var: _ethereum_besu.status | ||
|
|
||
| - name: Ensure besu is inactive state | ||
| ansible.builtin.assert: | ||
| that: | ||
| - _ethereum_besu['status']['ActiveState']=='inactive' | ||
| quiet: true | ||
|
|
||
| - name: Get teku service info | ||
| become: true | ||
| ansible.builtin.systemd: | ||
| name: "ethereum_teku" | ||
| register: ethereum_teku | ||
|
|
||
| - name: Debug teku service status | ||
| debug: | ||
| var: ethereum_teku.status | ||
|
|
||
| - name: Ensure teku is inactive state | ||
| ansible.builtin.assert: | ||
| that: | ||
| - ethereum_teku['status']['ActiveState']=='inactive' | ||
| quiet: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| --- | ||
| # Stop the service before uninstalling | ||
| - name: Stop | ||
| ansible.builtin.include_tasks: commands/stop.yml | ||
|
|
||
| # Remove the binary file for ethereum_besu | ||
| - name: Remove systemd service for ethereum_besu | ||
| become: true | ||
| file: | ||
| path: /opt/ethereum_besu | ||
| state: absent | ||
|
|
||
| - name: Remove systemd service for ethereum_besu | ||
| become: true | ||
| file: | ||
| path: /opt/ethereum_teku | ||
| state: absent | ||
|
|
||
| # Remove the systemd service for ethereum_besu | ||
| - name: Delete content & directory | ||
| become: true | ||
| ansible.builtin.file: | ||
| state: absent | ||
| path: "{{ item }}" | ||
| loop: | ||
| - /etc/systemd/system/ethereum_besu.service | ||
| - /opt/ethereum/{{ ethereum_besu_version }} | ||
| loop_control: | ||
| loop_var: item | ||
|
|
||
| - name: Verify that the ethereum service file is removed | ||
| ansible.builtin.stat: | ||
| path: /etc/systemd/system/ethereum.service | ||
| register: ethereum_service_file | ||
|
|
||
| - name: Assert that the ethereumGo service file does not exist | ||
| ansible.builtin.assert: | ||
| that: | ||
| - not ethereum_service_file.stat.exists | ||
|
|
||
| - name: Verify that the program directory is removed | ||
| ansible.builtin.stat: | ||
| path: /opt/ethereum/{{ ethereum_besu_version }} | ||
| register: ethereum_directory | ||
|
|
||
| - name: Assert that the program directory does not exist | ||
| ansible.builtin.assert: | ||
| that: | ||
| - not ethereum_directory.stat.exists |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| - name: Ethereum {{ ethereum_cmd }} | ||
| vars: | ||
| cmd_file: "{{ role_path }}/tasks/commands/{{ ethereum_cmd }}.yml" | ||
| when: cmd_file is file | ||
| ansible.builtin.include_tasks: | ||
| file: "{{ cmd_file }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will probably be dependent on what clients have been selected right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nimbus is a new ethereum consensus client with a different configuration for start.