Initial commit

This commit is contained in:
Zahary Karadjov 2021-04-02 12:34:06 +03:00
commit 8f4a36850c
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
11 changed files with 189 additions and 0 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Status Research & Development GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

56
README.md Normal file
View File

@ -0,0 +1,56 @@
# Description
This role provisions a [RocketPool smart node installer instance](https://github.com/rocket-pool/smartnode-install)
that in turn will install a full-fledged [smart node](https://github.com/rocket-pool/smartnode) using docker-compose.
For general information about RocketPool, please refer to https://medium.com/rocket-pool/rocket-pool-101-faq-ee683af10da9
# Introduction
The smart node installation procedure will create 6 new containers responsible for the various RocketPool components:
```
7278f43c6619 statusim/nimbus-eth2:amd64-v1.0.11 "sh /setup/start-val…" 2 days ago Up 14 hours rocketpool_validator
993511abf7e9 rocketpool/smartnode:v1.0.0-beta.1 "/go/bin/rocketpool …" 2 days ago Up 14 hours rocketpool_watchtower
526b988a4258 rocketpool/smartnode:v1.0.0-beta.1 "/go/bin/rocketpool …" 2 days ago Up 14 hours rocketpool_node
dd235aa746ea rocketpool/smartnode:v1.0.0-beta.1 "/bin/sleep infinity" 2 days ago Up 14 hours rocketpool_api
d63dcecd28bb statusim/nimbus-eth2:amd64-v1.0.11 "sh /setup/start-bea…" 2 days ago Up 14 hours 0.0.0.0:9001->9001/tcp, 0.0.0.0:9001->9001/udp rocketpool_eth2
e8997d22341a rocketpool/smartnode-pow-proxy:v1.0.0-beta.0 "sh /setup/start-nod…" 2 days ago Up 14 hours 0.0.0.0:30303->30303/tcp, 0.0.0.0:30303->30303/udp rocketpool_eth1
```
Config files will be created in `/var/rocketpool`. `/usr/bin/local/rocketpool` will be a simple wrapper
script calling the desired version of the rocketpool binary (installed in /opt/rocketpool) with the necessary
configuration parameters.
The node wallet should be managed manually by executing commands such as `rocketpool wallet restore`
or `rocketpool wallet init`.
# Installation
Add to your `requirements.yml` file:
```yaml
- name: infra-role-rocketpool-smart-node
src: git+git@github.com:status-im/infra-role-rocketpool-smart-node.git
scm: git
```
# Configuration
The supported settings are:
```yaml
rocketpool_smart_node_version: '1.0.0-beta.1'
rocketpool_smart_node_web3_url: '' # When empty, the smart node will use its own Geth instance
rocketpool_smart_node_eth2_graffiti: '' # Nimbus-compatible graffiti string
rocketpool_smart_node_eth2_libp2p_port: 9001
rocketpool_smart_node_eth2_discovery_port: 9001
rocketpool_smart_node_geth_listening_port: 8545
```
# Requirements
Due to being part of Status infra this role assumes availability of certain things:
* Docker for running containers
* The `iptables-persistent` module

8
defaults/main.yml Normal file
View File

@ -0,0 +1,8 @@
---
rocketpool_smart_node_version: '1.0.0-beta.1'
rocketpool_smart_node_web3_url: '' # When empty, the smart node will use its own Geth instance
rocketpool_smart_node_eth2_graffiti: '' # Nimbus-compatible graffiti string
rocketpool_smart_node_eth2_libp2p_port: 9001
rocketpool_smart_node_eth2_discovery_port: 9001
rocketpool_smart_node_geth_listening_port: 8545

4
handlers/main.yml Normal file
View File

@ -0,0 +1,4 @@
---
- name: Save iptables rules
shell: iptables-save > /etc/iptables/rules.v4

12
meta/main.yml Normal file
View File

@ -0,0 +1,12 @@
---
galaxy_info:
author: Zahary Karadjov <zahary@status.im>
description: Setup a Nimbus-based RocketPool smart node
company: Status.im
license: MIT
min_ansible_version: 1.9
platforms:
- name: Ubuntu
versions:
- xenial

17
tasks/config.yml Normal file
View File

@ -0,0 +1,17 @@
---
- name: Create RocketPool settings dir
file:
path: "/var/rocketpool/"
state: directory
owner: root
group: root
mode: 0755
- name: Create RocketPool settings file
template:
src: 'settings.yml.j2'
dest: '/var/rocketpool/settings.yml'
owner: root
group: root
mode: 0644

19
tasks/firewall.yml Normal file
View File

@ -0,0 +1,19 @@
---
- name: 'Enable ports for RocketPool smart node'
iptables:
comment: 'RocketPool Smart Node ports'
action: insert
chain: DOCKER-USER
jump: ACCEPT
source: '0.0.0.0/0'
protocol: '{{ rule.protocol }}'
destination_port: '{{ rule.port }}'
when: '{{rule.port != ""}}'
with_items:
- { protocol: 'tcp', port: '{{ "" if rocketpool_smart_node_web3_url == "" else rocketpool_smart_node_geth_listening_port }}' }
- { protocol: 'tcp', port: '{{ rocketpool_smart_node_eth2_libp2p_port }}' }
- { protocol: 'udp', port: '{{ rocketpool_smart_node_eth2_discovery_port }}' }
loop_control:
loop_var: rule
notify:
- Save iptables rules

23
tasks/install.yml Normal file
View File

@ -0,0 +1,23 @@
---
- name: Create RocketPool destination dir
file:
path: "/opt/rocketpool/{{ rocketpool_smart_node_version }}"
state: directory
owner: root
group: root
mode: 0755
- name: Download RocketPool installer binary
get_url:
url: "https://github.com/rocket-pool/smartnode-install/releases/download/{{rocketpool_smart_node_version}}/rocketpool-cli-linux-amd64"
dest: "/opt/rocketpool/{{ rocketpool_smart_node_version }}/rocketpool"
mode: 0755
- name: Create RocketPool wrapper script
template:
src: 'rocketpool_wrapper.j2'
dest: '/usr/local/bin/rocketpool'
owner: root
group: root
mode: 0755

5
tasks/main.yml Normal file
View File

@ -0,0 +1,5 @@
---
- import_tasks: install.yml
- import_tasks: config.yml
- import_tasks: firewall.yml

View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
/opt/rocketpool/{{rocketpool_smart_node_version}}/rocketpool --config-path /var/rocketpool $@

20
templates/settings.yml.j2 Normal file
View File

@ -0,0 +1,20 @@
chains:
eth1:
client:
selected: "{{ "geth" if rocketpool_smart_node_web3_url == '' else "custom" }}"
params:
- env: INFURA_PROJECT_ID
value: ""
- env: ETHSTATS_LABEL
value: ""
- env: ETHSTATS_LOGIN
value: ""
- env: PROVIDER_URL
value: "{{rocketpool_smart_node_web3_url}}"
eth2:
client:
selected: nimbus
params:
- env: CUSTOM_GRAFFITI
value: "{{rocketpool_smart_node_eth2_graffiti}}"