Initial support for nethermind

This commit is contained in:
phahulin 2019-09-09 17:15:16 +03:00
parent aeed15cd62
commit dc82ad1137
27 changed files with 137 additions and 303 deletions

View File

@ -26,7 +26,7 @@
vars:
volumes:
- device_name: /dev/sda1
volume_size: 128
volume_size: 256
delete_on_termination: true
tasks:
- name: Launch instance

View File

@ -2,7 +2,7 @@
- name: Create bootnode security group
hosts: localhost
gather_facts: False
tasks:
tasks:
- name: Create Security group
ec2_group:
ec2_access_key: "{{ access_key }}"
@ -26,7 +26,7 @@
vars:
volumes:
- device_name: /dev/sda1
volume_size: 128
volume_size: 256
delete_on_termination: true
tasks:
- name: Launch instance
@ -34,7 +34,7 @@
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
key_name: "{{ awskeypair_name }}"
instance_tags:
instance_tags:
Name: "{{ bootnode_instance_name }}"
group: "{{ bootnode_security_group }}"
instance_type: "{{ bootnode_instance_type }}"

View File

@ -2,7 +2,7 @@
- name: Create explorer security group
hosts: localhost
gather_facts: False
tasks:
tasks:
- name: Create Security group
ec2_group:
ec2_access_key: "{{ access_key }}"
@ -26,7 +26,7 @@
vars:
volumes:
- device_name: /dev/sda1
volume_size: 128
volume_size: 256
delete_on_termination: true
tasks:
- name: Launch instance
@ -34,7 +34,7 @@
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
key_name: "{{ awskeypair_name }}"
instance_tags:
instance_tags:
Name: "{{ explorer_instance_name }}"
group: "{{ explorer_security_group }}"
instance_type: "{{ explorer_instance_type }}"

View File

@ -1,126 +0,0 @@
### This file is used as a reference only and contains all possible options for all roles.
### Values set in this file are used for illustration only.
###
### To connect to an actual network, please follow instructions provided to you
### on how to generate a valid `group_vars/all` file for the network.
###
---
ssh_root:
- "{{ lookup('file', 'files/admins.pub') }}"
snmp_syslocation: "USA"
snmp_ipsubnet: "172.16.0.0/16"
nameservers:
- "8.8.8.8"
- "8.8.4.4"
ntpservers:
- ""
access_key: "INSERT KEY HERE"
secret_key: "INSERT SECRET HERE"
awskeypair_name: "keypairname"
image: "ami-0b383171"
region: "us-east-1"
vpc_subnet_id: "subnet-ID-number"
NODE_FULLNAME: "INSERT NODENAME"
NODE_ADMIN_EMAIL: "INSERT@EMAIL"
NETSTATS_SERVER: "INSERT SERVERNAME"
NETSTATS_SECRET: "INSERT SECRET"
MINING_KEYFILE: "INSERT HERE"
MINING_ADDRESS: "INSERT HERE"
MINING_KEYPASS: "INSERT HERE"
MAIN_REPO_FETCH: "poanetwork"
GENESIS_BRANCH: "master"
GENESIS_NETWORK_NAME: "PoANetwork"
MOC_ADDRESS: "INSERT HERE"
MOC_KEYPASS: "INSERT HERE"
MOC_KEYFILE: "INSERT HERE"
SCRIPTS_MOC_BRANCH: "master"
SCRIPTS_VALIDATOR_BRANCH: "master"
BLK_GAS_LIMIT: "6700000"
NODE_PWD: "node.pwd"
NODE_SOURCE_DEB: "https://deb.nodesource.com/node_8.x"
PARITY_BIN_LOC: "https://releases.parity.io/ethereum/v2.2.1/x86_64-unknown-linux-gnu/parity"
PARITY_BIN_SHA256: "dfdb0ba6d8847a164600baad7008c1a8715126aca21bb0909e7184f2b3bf2d21"
ORCHESTRATOR_BIN_LOC: ""
ORCHESTRATOR_BIN_SHA256: ""
#bootnode
bootnode_instance_type: "t2.large"
bootnode_instance_name: "bootnode"
bootnode_count_instances: "1"
bootnode_security_group: "{{ MAIN_REPO_FETCH }}-{{ GENESIS_BRANCH }}-bootnode-security"
bootnode_archive: "off"
bootnode_orchestrator: "off"
#netstat
netstat_instance_type: "t2.large"
netstat_instance_name: "netstat"
netstat_count_instances: "1"
netstat_security_group: "{{ MAIN_REPO_FETCH }}-{{ GENESIS_BRANCH }}-netstat-security"
#validator
validator_instance_type: "t2.large"
validator_instance_name: "validator"
validator_count_instances: "1"
validator_security_group: "{{ MAIN_REPO_FETCH }}-{{ GENESIS_BRANCH }}-validator-security"
validator_archive: "off"
#moc
moc_instance_type: "t2.large"
moc_instance_name: "moc"
moc_count_instances: "1"
moc_security_group: "{{ MAIN_REPO_FETCH }}-{{ GENESIS_BRANCH }}-moc-security"
moc_archive: "off"
#explorer
explorer_instance_type: "t2.large"
explorer_instance_name: "explorer"
explorer_count_instances: "1"
explorer_security_group: "{{ MAIN_REPO_FETCH }}-{{ GENESIS_BRANCH }}-explorer-security"
#Blockscout
blockscout_instance_type: "t2.large"
blockscout_instance_name: "blockscout"
blockscout_count_instances: "1"
blockscout_security_group: "{{ MAIN_REPO_FETCH }}-{{ GENESIS_BRANCH }}-blockscout-security"
reboot_after_completion: true
blockscout_version: "a8c4c72c54"
db_user: "INSERT HERE"
db_user_password: "INSERT HERE"
#restrict network access to instances
allow_bootnode_ssh: true
allow_bootnode_p2p: true
allow_bootnode_rpc: true
associate_bootnode_elastic_ip: false
allow_explorer_ssh: true
allow_explorer_p2p: true
allow_explorer_http: true
allow_moc_ssh: true
allow_moc_p2p: true
allow_netstat_ssh: true
allow_netstat_http: true
allow_validator_ssh: true
allow_validator_p2p: true
associate_validator_elastic_ip: false
allow_blockscout_ssh: true
allow_blockscout_p2p: true
allow_blockscout_http: false

View File

@ -24,6 +24,9 @@ NODE_PWD: "node.pwd" # don't change this one
NODE_SOURCE_DEB: "https://deb.nodesource.com/node_8.x"
PARITY_BIN_LOC: "https://releases.parity.io/ethereum/v2.6.2/x86_64-unknown-linux-gnu/parity"
PARITY_BIN_SHA256: "593c2f622fbb04a4baccd3388b66d2d1b1a5bd207201335ab5b26a3ed95d182f"
NETHERMIND_ZIP_LOC: "https://github.com/NethermindEth/nethermind/releases/download/1.0.3/nethermind-linux-amd64-1.0.3-712d3ed-20190905.zip"
NETHERMIND_ZIP_SHA256: "ba4213943e2e7da0d49a4b446114cd971c139cc9b0e04d403f5b4a9e8a31c97f"
BC_CLIENT: "parity"
ORCHESTRATOR_BIN_LOC: ""
ORCHESTRATOR_BIN_SHA256: ""
@ -32,6 +35,7 @@ SCRIPTS_VALIDATOR_BRANCH: "core"
MAIN_REPO_FETCH: "poanetwork"
GENESIS_BRANCH: "core"
GENESIS_NETWORK_NAME: "Core"
NETHERMIND_NETWORK_NAME: "poacore"
MOC_ADDRESS: "0xcf260ea317555637c55f70e55dba8d5ad8414cb0"
BLK_GAS_LIMIT: "8000000"

View File

@ -26,7 +26,7 @@
vars:
volumes:
- device_name: /dev/sda1
volume_size: 128
volume_size: 256
delete_on_termination: true
tasks:
- name: Launch instance

View File

@ -2,7 +2,7 @@
- name: Create netstat security group
hosts: localhost
gather_facts: False
tasks:
tasks:
- name: Create Security group
ec2_group:
ec2_access_key: "{{ access_key }}"
@ -26,7 +26,7 @@
vars:
volumes:
- device_name: /dev/sda1
volume_size: 128
volume_size: 256
delete_on_termination: true
tasks:
- name: Launch instance
@ -34,7 +34,7 @@
ec2_access_key: "{{ access_key }}"
ec2_secret_key: "{{ secret_key }}"
key_name: "{{ awskeypair_name }}"
instance_tags:
instance_tags:
Name: "{{ netstat_instance_name }}"
group: "{{ netstat_security_group }}"
instance_type: "{{ netstat_instance_type }}"

View File

@ -0,0 +1,27 @@
---
- name: Download spec.json and bootnodes.txt
get_url: url={{ item }} dest={{ home }}/ mode=0644
with_items:
- "https://raw.githubusercontent.com/{{ MAIN_REPO_FETCH }}/poa-chain-spec/{{ GENESIS_BRANCH }}/spec.json"
- "https://raw.githubusercontent.com/{{ MAIN_REPO_FETCH }}/poa-chain-spec/{{ GENESIS_BRANCH }}/bootnodes.txt"
- name: Copy original chainspec before update
copy:
remote_src: yes
src: "{{ home }}/spec.json"
dest: "{{ home }}/spec-nethermind.json"
owner: "{{ username }}"
group: "{{ username }}"
- name: Update chainspec for nethermind
lineinfile:
path: "{{ home }}/spec-nethermind.json"
insertbefore: "eip140Transition"
line: "{{ item }}"
with_items:
- '"eip152Transition": "0xFFFFFFFF",'
- '"eip1108Transition": "0xFFFFFFFF",'
- '"eip1344Transition": "0xFFFFFFFF",'
- '"eip1884Transition": "0xFFFFFFFF",'
- '"eip2028Transition": "0xFFFFFFFF",'
- '"eip2200Transition": "0xFFFFFFFF",'

View File

@ -1,21 +1,5 @@
---
- name: Create directory parity_data/keys/NetworkName
file:
path: "{{ home }}/parity_data/keys/{{ GENESIS_NETWORK_NAME }}"
state: directory
mode: 0700
owner: "{{ username }}"
group: "{{ username }}"
- name: Create logs directories
file:
path: "/{{ home }}/logs/old"
state: directory
mode: 0755
owner: "{{ username }}"
group: "{{ username }}"
- name: Download spec.json
- name: Download spec.json and bootnodes.txt
get_url: url={{ item }} dest={{ home }}/ mode=0644
with_items:
- "https://raw.githubusercontent.com/{{ MAIN_REPO_FETCH }}/poa-chain-spec/{{ GENESIS_BRANCH }}/spec.json"

View File

@ -1,12 +1,4 @@
---
- name: Create logs directories
file:
path: "/{{ home }}/logs/old"
state: directory
mode: 0755
owner: "{{ username }}"
group: "{{ username }}"
- git: repo=https://github.com/{{ MAIN_REPO_FETCH }}/eth-netstats dest={{ home }}/eth-netstats
- file: path={{ home }}/eth-netstats owner={{ username }} group={{ username }} recurse=yes

View File

@ -1,4 +1,12 @@
---
- name: Create logs directories
file:
path: "/{{ home }}/logs/old"
state: directory
mode: 0755
owner: "{{ username }}"
group: "{{ username }}"
- name: Install poa-logrotate conf
template: src=poa-logrotate.conf.j2 dest={{ home }}/poa-logrotate.conf owner=root group=root mode=0644

View File

@ -0,0 +1,3 @@
---
- name: restart poa-nethermind
service: name=poa-nethermind state=restarted

View File

@ -0,0 +1,64 @@
---
- name: Install nethermind-specific packages
apt:
name: "{{ item }}"
state: "latest"
with_items:
- libsnappy-dev
- libc6-dev
- libc6
- unzip
- name: Create directory nethermind_data/
file:
path: "{{ home }}/nethermind_data/"
state: directory
mode: 0700
owner: "{{ username }}"
group: "{{ username }}"
- name: Download nethermind zip
get_url:
url: "{{ NETHERMIND_ZIP_LOC }}"
dest: "{{ home }}/{{ NETHERMIND_ZIP_LOC | basename }}"
mode: 0755
checksum: "sha256:{{ NETHERMIND_ZIP_SHA256 }}"
owner: "{{ username }}"
group: "{{ username }}"
notify:
- restart poa-nethermind
- name: Unzip nethermind zip
unarchive:
remote_src: yes
src: "{{ home }}/{{ NETHERMIND_ZIP_LOC | basename }}"
dest: "{{ home }}/"
owner: "{{ username }}"
group: "{{ username }}"
- name: Copy original config before update
copy:
remote_src: yes
src: "{{ home }}/configs/{{ NETHERMIND_NETWORK_NAME }}.cfg"
dest: "{{ home }}/node.cfg"
owner: "{{ username }}"
group: "{{ username }}"
- name: Update config values
lineinfile:
path: "{{ home }}/node.cfg"
regexp: "{{ item.key }}"
line: '"{{ item.key }}": {{ item.rawvalue }}'
with_items:
- { key: 'JsonRpcEnabled', rawvalue: "true," }
- { key: 'ChainSpecPath', rawvalue: '"{{ home }}/spec-nethermind.json",' }
- { key: 'BaseDbPath', rawvalue: '"{{ home }}/nethermind_data/{{ NETHERMIND_NETWORK_NAME }}",' }
- { key: 'LogFileName', rawvalue: '"{{ home }}/logs/nethermind.log"' }
- name: Install poa-nethermind service
template: src=poa-nethermind.j2 dest=/etc/systemd/system/poa-nethermind.service owner=root group=root mode=0755
notify:
- restart poa-nethermind
- name: Ensure poa-nethermind is running and enabled to start at boot
service: name=poa-nethermind state=started enabled=yes

View File

@ -0,0 +1,14 @@
[Unit]
Description=poa nethermind service
After=network.target
[Service]
User={{ username }}
Group={{ username }}
WorkingDirectory=/home/{{ username }}
ExecStart={{ home }}/Nethermind.Runner --config node.cfg
Restart=always
LimitNOFILE=1000000
[Install]
WantedBy=default.target

View File

@ -7,14 +7,6 @@
owner: "{{ username }}"
group: "{{ username }}"
- name: Create logs directories
file:
path: "/{{ home }}/logs/old"
state: directory
mode: 0755
owner: "{{ username }}"
group: "{{ username }}"
- name: Download parity-bin
get_url: url="{{ PARITY_BIN_LOC }}" dest={{ home }}/parity mode=0755 checksum="sha256:{{ PARITY_BIN_SHA256 }}"
notify:

View File

@ -1,26 +0,0 @@
[
{
"name" : "netstats_daemon",
"script" : "app.js",
"log_date_format" : "YYYY-MM-DD HH:mm:SS Z",
"error_file" : "/home/{{ username }}/logs/netstats_daemon.err",
"out_file" : "/home/{{ username }}/logs/netstats_daemon.out",
"merge_logs" : false,
"watch" : false,
"max_restarts" : 100,
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",
"env":
{
"NODE_ENV" : "production",
"RPC_HOST" : "localhost",
"RPC_PORT" : "8545",
"LISTENING_PORT" : "30303",
"INSTANCE_NAME" : "{{ NODE_FULLNAME }}",
"CONTACT_DETAILS" : "{{ NODE_ADMIN_EMAIL }}",
"WS_SERVER" : "{{ NETSTATS_SERVER }}",
"WS_SECRET" : "{{ NETSTATS_SECRET }}",
"VERBOSITY" : 2
}
}
]

View File

@ -1,19 +0,0 @@
[
{
"name" : "explorer",
"script" : "./bin/www",
"log_date_format" : "YYYY-MM-DD HH:mm:SS Z",
"error_file" : "/home/{{ username }}/logs/explorer.err",
"out_file" : "/home/{{ username }}/logs/explorer.out",
"merge_logs" : false,
"watch" : false,
"max_restarts" : 100,
"exec_interpreter" : "node",
"exec_mode" : "fork_mode",
"env":
{
"NODE_ENV" : "production",
"PORT" : 4000,
}
}
]

View File

@ -1,12 +0,0 @@
var web3 = require('web3');
var net = require('net');
var config = function () {
this.logFormat = "combined";
this.ipcPath = "/home/{{ username }}/parity_data/jsonrpc.ipc";
this.provider = new web3.providers.IpcProvider(this.ipcPath, net);
this.bootstrapUrl = "https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/yeti/bootstrap.min.css";
this.names = {
"{{ MOC_ADDRESS }}": "Owner",
};
}
module.exports = config;

View File

@ -1,13 +0,0 @@
[Unit]
Description=poa chain explorer service
After=poa-pm2.service
[Service]
Type=oneshot
RemainAfterExit=true
User={{ username }}
Group={{ username }}
Environment=MYVAR=myval
WorkingDirectory=/home/{{ username }}/chain-explorer
ExecStart=/usr/bin/pm2 startOrRestart app.json
[Install]
WantedBy=multi-user.target

View File

@ -1,12 +0,0 @@
[Unit]
Description=poa dashboard service
After=network.target
[Service]
User={{ username }}
Group={{ username }}
Environment=MYVAR=myval
WorkingDirectory=/home/{{ username }}/eth-netstats
Restart=always
ExecStart=/usr/bin/npm start
[Install]
WantedBy=multi-user.target

View File

@ -1,20 +0,0 @@
/home/{{ username }}/logs/*.log {
rotate 10
size 200M
missingok
compress
copytruncate
dateext
dateformat %Y-%m-%d-%s
olddir old
}
/home/{{ username }}/.pm2/pm2.log {
su {{ username }} {{ username }}
rotate 10
size 200M
missingok
compress
copytruncate
dateext
dateformat %Y-%m-%d-%s
}

View File

@ -1,2 +0,0 @@
#!/bin/bash
/usr/sbin/logrotate /home/{{ username }}/poa-logrotate.conf

View File

@ -1,13 +0,0 @@
[Unit]
Description=poa netstats service
After=poa-pm2.service
[Service]
Type=oneshot
RemainAfterExit=true
User={{ username }}
Group={{ username }}
Environment=MYVAR=myval
WorkingDirectory=/home/{{ username }}/eth-net-intelligence-api
ExecStart=/usr/bin/pm2 startOrRestart app.json
[Install]
WantedBy=multi-user.target

View File

@ -1,13 +0,0 @@
[Unit]
Description=poa pm2 service
After=network.target
[Service]
Type=oneshot
RemainAfterExit=true
User={{ username }}
Group={{ username }}
Environment=MYVAR=myval
WorkingDirectory=/home/{{ username }}
ExecStart=/usr/bin/pm2 ping
[Install]
WantedBy=multi-user.target

View File

@ -21,9 +21,11 @@
- usermanager
# - logentries
- nodejs
- bootnode
- { role: bootnode-parity, when: "BC_CLIENT == 'parity'" }
- { role: bootnode-nethermind, when: "BC_CLIENT == 'nethermind'" }
- poa-logrotate
- poa-parity
- { role: poa-parity, when: "BC_CLIENT == 'parity'" }
- { role: poa-nethermind, when: "BC_CLIENT == 'nethermind'" }
- poa-pm2
- poa-netstats
- { role: poa-orchestrator, when: "(bootnode_orchestrator or 'off') == 'on'" }

View File

@ -26,7 +26,7 @@
vars:
volumes:
- device_name: /dev/sda1
volume_size: 128
volume_size: 256
delete_on_termination: true
tasks:
- name: Launch instance