Playbook and instructions for Update-parity-version
This commit is contained in:
parent
3188ea047c
commit
db27b1dcb9
|
@ -4,3 +4,4 @@
|
||||||
2. [Make a spec.json hard-fork](./docs/Spec-hardfork.md)
|
2. [Make a spec.json hard-fork](./docs/Spec-hardfork.md)
|
||||||
3. [Update scripts for validator nodes](./docs/Update-scripts-validator.md)
|
3. [Update scripts for validator nodes](./docs/Update-scripts-validator.md)
|
||||||
4. [Set min_gas_price for validator nodes](./docs/Set-min-gas-price.md)
|
4. [Set min_gas_price for validator nodes](./docs/Set-min-gas-price.md)
|
||||||
|
5. [Update parity version](./docs/Update-parity-version.md)
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
## Update parity to a newer version
|
||||||
|
|
||||||
|
0. this guide assumes that you're running this playbook from the same machine that you used to make initial deployment of your node. So that you already have `python` and `ansible` installed, and you have the correct ssh keypair to root-access the node.
|
||||||
|
|
||||||
|
### Running the update
|
||||||
|
1. clone this repository if you haven't done so before
|
||||||
|
```
|
||||||
|
git clone https://github.com/poanetwork/poa-devops.git
|
||||||
|
cd poa-devops
|
||||||
|
```
|
||||||
|
or pull the latest changes
|
||||||
|
```
|
||||||
|
cd poa-devops
|
||||||
|
git pull origin master
|
||||||
|
```
|
||||||
|
|
||||||
|
2. create `group_vars/all` file:
|
||||||
|
```
|
||||||
|
cp group_vars/upd-parity-version.example group_vars/all
|
||||||
|
```
|
||||||
|
and change the following variables:
|
||||||
|
* `poa_role` - role of the node on the network (one of `bootnode`, `validator`, `moc`, `explorer`)
|
||||||
|
|
||||||
|
don't change other options
|
||||||
|
|
||||||
|
3. create/edit `hosts` file and put your node's ip address (assuming it's 192.0.2.1) there with the following header:
|
||||||
|
```
|
||||||
|
[upd-parity-version]
|
||||||
|
192.0.2.1
|
||||||
|
```
|
||||||
|
**NOTE**: if you're updating an existing file, make sure you remove other tags `[...]` and ips.
|
||||||
|
|
||||||
|
4. run the playbook:
|
||||||
|
```
|
||||||
|
ansible-playbook -i hosts upd-parity-version.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Verifying the update
|
||||||
|
0. playbook run should be completed without errors
|
||||||
|
|
||||||
|
1. open network statistic webpage:
|
||||||
|
- for sokol test network: https://sokol-netstat.poa.network
|
||||||
|
- for core main network: https://core-netstat.poa.network
|
||||||
|
|
||||||
|
check that your node is "green" and is catching new blocks. It may take 2-3 minutes to fully start and reconnect
|
||||||
|
|
||||||
|
2. connect to the node
|
||||||
|
```
|
||||||
|
ssh root@192.0.2.1
|
||||||
|
```
|
||||||
|
and check parity version (replace `bootnode` with correct role name ,e.g. `validator`):
|
||||||
|
```
|
||||||
|
/home/bootnode/parity --version
|
||||||
|
```
|
||||||
|
sample output:
|
||||||
|
```
|
||||||
|
Parity
|
||||||
|
version Parity/v1.9.2-beta-0feb0bb-20180201/x86_64-linux-gnu/rustc1.23.0
|
||||||
|
Copyright 2015, 2016, 2017, 2018 Parity Technologies (UK) Ltd
|
||||||
|
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
|
||||||
|
This is free software: you are free to change and redistribute it.
|
||||||
|
There is NO WARRANTY, to the extent permitted by law.
|
||||||
|
|
||||||
|
By Wood/Paronyan/Kotewicz/Drwięga/Volf
|
||||||
|
Habermeier/Czaban/Greeff/Gotchac/Redmann
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
3. during the following day check status of your node on network status webpage and associated functions (e.g. for validators - are block rewards still being sent from your mining key to your payout key).
|
||||||
|
|
||||||
|
### Rollback to the previous version (in case of problems)
|
||||||
|
**NOTE**: if you get any errors please consult the POA Team first, probably you have a minor issue and don't need to rollback
|
||||||
|
|
||||||
|
1. connect to the node:
|
||||||
|
```
|
||||||
|
ssh root@192.0.2.1
|
||||||
|
```
|
||||||
|
|
||||||
|
2. switch to your home folder (replace `bootnode` with correct role name):
|
||||||
|
```
|
||||||
|
cd /home/bootnode
|
||||||
|
```
|
||||||
|
|
||||||
|
3. stop services:
|
||||||
|
```
|
||||||
|
systemctl stop poa-netstats
|
||||||
|
systemctl stop poa-parity
|
||||||
|
```
|
||||||
|
|
||||||
|
4. locate the backup folder:
|
||||||
|
```
|
||||||
|
ls backups-version
|
||||||
|
```
|
||||||
|
it contains folders labeled by the time backup was created in format`<year><month><day>T<hour><minute><second>`, e.g.
|
||||||
|
```
|
||||||
|
# ls backups-version
|
||||||
|
20180208T152105 20180209T214517
|
||||||
|
```
|
||||||
|
copy the version number that corresponds to this day. In the following examples we assume that it's `20180209T214517`.
|
||||||
|
|
||||||
|
5. make sure you have your mining key data (keyfile, password, address) available to you
|
||||||
|
|
||||||
|
6. remove files from the new version:
|
||||||
|
```
|
||||||
|
rm -rf parity_data
|
||||||
|
rm parity
|
||||||
|
rm node.toml
|
||||||
|
```
|
||||||
|
|
||||||
|
7. restore previous versions of these files from backup (note dots `.` at the end of each line here, they are important):
|
||||||
|
```
|
||||||
|
cp -a backups-version/20180209T214517/parity .
|
||||||
|
cp -a backups-version/20180209T214517/parity_data .
|
||||||
|
cp -a backups-version/20180209T214517/node.toml .
|
||||||
|
```
|
||||||
|
|
||||||
|
8. check parity version (must be previous one):
|
||||||
|
```
|
||||||
|
./parity --version
|
||||||
|
```
|
||||||
|
sample output:
|
||||||
|
```
|
||||||
|
Parity
|
||||||
|
version Parity/v1.8.4-beta-483c306-20171213/x86_64-linux-gnu/rustc1.22.1
|
||||||
|
Copyright 2015, 2016, 2017 Parity Technologies (UK) Ltd
|
||||||
|
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
|
||||||
|
This is free software: you are free to change and redistribute it.
|
||||||
|
There is NO WARRANTY, to the extent permitted by law.
|
||||||
|
|
||||||
|
By Wood/Paronyan/Kotewicz/Drwięga/Volf
|
||||||
|
Habermeier/Czaban/Greeff/Gotchac/Redmann
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
9. restart services
|
||||||
|
```
|
||||||
|
systemctl start poa-parity
|
||||||
|
systemctl start poa-netstats
|
||||||
|
```
|
||||||
|
|
||||||
|
10. open network statistic webpage:
|
||||||
|
- for sokol test network: https://sokol-netstat.poa.network
|
||||||
|
- for core main network: https://core-netstat.poa.network
|
||||||
|
|
||||||
|
check that your node is "green" and is catching new blocks. It may take 2-3 minutes to fully start and reconnect
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
# bootnode | moc | validator | explorer | netstat
|
# bootnode | moc | validator | explorer | netstat
|
||||||
poa_role: "moc"
|
poa_role: "bootnode"
|
||||||
|
|
||||||
# repo to fetch HFs from
|
# repo to fetch HFs from
|
||||||
MAIN_REPO_FETCH: "poanetwork"
|
MAIN_REPO_FETCH: "poanetwork"
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
# bootnode | moc | validator | explorer | netstat
|
||||||
|
poa_role: "validator"
|
||||||
|
|
||||||
|
# repo to fetch new binaries from
|
||||||
|
PARITY_BIN_LOC: "http://d1h4xl4cr1h0mo.cloudfront.net/v1.9.2/x86_64-unknown-linux-gnu/parity"
|
||||||
|
PARITY_BIN_SHA256: "3604a030388cd2c22ebe687787413522106c697610426e09b3c5da4fe70bbd33"
|
||||||
|
|
||||||
|
# backup options
|
||||||
|
backup_parity_data: "on"
|
||||||
|
|
||||||
|
# do full resync
|
||||||
|
resync: "on"
|
||||||
|
|
||||||
|
# strings to remove from node.toml
|
||||||
|
bootnode_node_toml_lines_to_remove:
|
||||||
|
- section: "rpc"
|
||||||
|
option: "threads"
|
||||||
|
|
||||||
|
# strings to add in node.toml
|
||||||
|
bootnode_node_toml_lines_to_add:
|
||||||
|
- section: "rpc"
|
||||||
|
option: "processing_threads"
|
||||||
|
value: 4
|
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
# bootnode | moc | validator | explorer | netstat
|
||||||
|
poa_role: "bootnode"
|
||||||
|
|
||||||
|
# repo to fetch new binaries from
|
||||||
|
PARITY_BIN_LOC: "http://d1h4xl4cr1h0mo.cloudfront.net/v1.9.2/x86_64-unknown-linux-gnu/parity"
|
||||||
|
PARITY_BIN_SHA256: "3604a030388cd2c22ebe687787413522106c697610426e09b3c5da4fe70bbd33"
|
||||||
|
|
||||||
|
# backup options
|
||||||
|
backup_parity_data: "on"
|
||||||
|
|
||||||
|
# do full resync
|
||||||
|
resync: "on"
|
||||||
|
|
||||||
|
# strings to remove from node.toml
|
||||||
|
bootnode_node_toml_lines_to_remove:
|
||||||
|
- section: "rpc"
|
||||||
|
option: "threads"
|
||||||
|
|
||||||
|
# strings to add in node.toml
|
||||||
|
bootnode_node_toml_lines_to_add:
|
||||||
|
- section: "rpc"
|
||||||
|
option: "processing_threads"
|
||||||
|
value: 4
|
|
@ -0,0 +1,68 @@
|
||||||
|
---
|
||||||
|
- name: Check that node role is correct
|
||||||
|
stat:
|
||||||
|
path: "{{ home }}"
|
||||||
|
register: role_home_folder
|
||||||
|
failed_when: not role_home_folder.stat.exists
|
||||||
|
|
||||||
|
- name: Check that the netstats service is installed
|
||||||
|
stat:
|
||||||
|
path: /etc/systemd/system/poa-netstats.service
|
||||||
|
register: netstats_service_file
|
||||||
|
|
||||||
|
- name: Shutdown poa-netstats service
|
||||||
|
service: name=poa-netstats state=stopped
|
||||||
|
when: netstats_service_file.stat.exists
|
||||||
|
|
||||||
|
- name: Shutdown poa-parity service
|
||||||
|
service: name=poa-parity state=stopped
|
||||||
|
|
||||||
|
- name: Create directory for parity-version backups
|
||||||
|
file: path="{{ backups_folder }}" state=directory
|
||||||
|
|
||||||
|
- name: Backup parity binary
|
||||||
|
command: cp -a {{ home }}/parity {{ backups_folder }}/parity
|
||||||
|
|
||||||
|
- name: Backup parity_data
|
||||||
|
command: cp -a "{{ home }}/parity_data" {{ backups_folder }}/parity_data
|
||||||
|
when: (backup_parity_data or "off") == "on"
|
||||||
|
|
||||||
|
- name: Backup node.toml
|
||||||
|
command: cp -a "{{ home }}/node.toml" {{ backups_folder }}/node.toml
|
||||||
|
|
||||||
|
- name: Download new parity binary version
|
||||||
|
get_url: url="{{ PARITY_BIN_LOC }}" dest="{{ home }}/parity" mode=0755 checksum="sha256:{{ PARITY_BIN_SHA256 }}"
|
||||||
|
|
||||||
|
- name: Remove lines from node.toml (bootnode)
|
||||||
|
ini_file:
|
||||||
|
path: "{{ home }}/node.toml"
|
||||||
|
section: "{{ item['section'] }}"
|
||||||
|
option: "{{ item['option'] }}"
|
||||||
|
state: absent
|
||||||
|
with_items: "{{ bootnode_node_toml_lines_to_remove }}"
|
||||||
|
when: poa_role == "bootnode"
|
||||||
|
|
||||||
|
- name: Add lines to node.toml (bootnode)
|
||||||
|
ini_file:
|
||||||
|
path: "{{ home }}/node.toml"
|
||||||
|
value: "{{ item['value'] }}"
|
||||||
|
section: "{{ item['section'] }}"
|
||||||
|
option: "{{ item['option'] }}"
|
||||||
|
state: present
|
||||||
|
with_items: "{{ bootnode_node_toml_lines_to_add }}"
|
||||||
|
when: poa_role == "bootnode"
|
||||||
|
|
||||||
|
- name: Remove old database
|
||||||
|
command: "./parity --config node.toml db kill"
|
||||||
|
args:
|
||||||
|
chdir: "{{ home }}"
|
||||||
|
become: true
|
||||||
|
become_user: "{{ poa_role }}"
|
||||||
|
when: (resync or "off") == "on"
|
||||||
|
|
||||||
|
- name: Launch poa-parity service
|
||||||
|
service: name=poa-parity state=started
|
||||||
|
|
||||||
|
- name: Launch poa-netstats service
|
||||||
|
service: name=poa-netstats state=started
|
||||||
|
when: netstats_service_file.stat.exists
|
|
@ -0,0 +1,10 @@
|
||||||
|
- hosts: upd-parity-version
|
||||||
|
vars:
|
||||||
|
date: "{{ ansible_date_time.iso8601_basic_short }}"
|
||||||
|
home: "/home/{{ poa_role }}"
|
||||||
|
backups_folder: "{{ home }}/backups-version/{{ date }}"
|
||||||
|
user: ubuntu
|
||||||
|
become: true
|
||||||
|
become_user: root
|
||||||
|
roles:
|
||||||
|
- upd-parity-version
|
Loading…
Reference in New Issue