Add playbook and docs on Set-min-gas-price
This commit is contained in:
parent
64accab56b
commit
4aff2d15b8
|
@ -1,5 +1,6 @@
|
||||||
## DevOps scripts
|
## DevOps scripts
|
||||||
|
|
||||||
1. [Setup blockchain backup from a node](./docs/Blockchain-backup.md)
|
1. [Setup blockchain backup on a node](./docs/Blockchain-backup.md)
|
||||||
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)
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
## Update scripts on validator nodes
|
||||||
|
|
||||||
|
**ONLY FOR VALIDATOR NODES**
|
||||||
|
|
||||||
|
0. this guide assumes that you're running this playbook from the same machine 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.
|
||||||
|
|
||||||
|
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/edit `hosts` file:
|
||||||
|
```
|
||||||
|
echo "" > hosts
|
||||||
|
```
|
||||||
|
and put your node's ip address (assuming it's 192.0.2.1) there with the following header:
|
||||||
|
```
|
||||||
|
[set-min-gas-price]
|
||||||
|
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 set-min-gas-price.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
5. connect to the node
|
||||||
|
```
|
||||||
|
ssh root@192.0.2.1
|
||||||
|
```
|
||||||
|
switch to the home folder:
|
||||||
|
```
|
||||||
|
cd /home/validator
|
||||||
|
```
|
||||||
|
and check the update time of `node.toml` file (should be about the time you started the playbook)
|
||||||
|
```
|
||||||
|
ls -lh
|
||||||
|
# a long list should appear here, look for node.toml in the rightmost column and check the date and time on the same row
|
||||||
|
```
|
||||||
|
then check that line was actually added to the file:
|
||||||
|
```
|
||||||
|
grep min_gas_price node.toml
|
||||||
|
```
|
||||||
|
should return a **single** line:
|
||||||
|
```
|
||||||
|
min_gas_price = 1000000000
|
||||||
|
```
|
||||||
|
also check that backup was created:
|
||||||
|
```
|
||||||
|
ls -lh backups-node.toml/
|
||||||
|
# look for a file named similar to node.toml-20180202-184912 Numbers represent date and time in UTC when the playbook was started
|
||||||
|
```
|
|
@ -0,0 +1,19 @@
|
||||||
|
---
|
||||||
|
- name: Create directory for backups
|
||||||
|
file: path={{ home }}/backups-node.toml state=directory
|
||||||
|
|
||||||
|
- name: Backup existing version
|
||||||
|
command: cp -a {{ home }}/node.toml {{ home }}/backups-node.toml/node.toml-{{ date }}
|
||||||
|
|
||||||
|
- name: Add min_gas_price to node.toml
|
||||||
|
lineinfile:
|
||||||
|
path: "{{ home }}/node.toml"
|
||||||
|
insertafter: '^\[mining\]'
|
||||||
|
line: "min_gas_price = 1000000000"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Restart poa-parity service
|
||||||
|
service: name=poa-parity state=restarted enabled=yes
|
||||||
|
|
||||||
|
- name: Restart poa-netstats service
|
||||||
|
service: name=poa-netstats state=restarted enabled=yes
|
|
@ -0,0 +1,9 @@
|
||||||
|
- hosts: set-min-gas-price
|
||||||
|
vars:
|
||||||
|
poa_role: validator
|
||||||
|
username: validator
|
||||||
|
date: "{{ lookup('pipe', 'date -u +%Y%m%d-%H%M%S') }}"
|
||||||
|
home: "/home/{{ poa_role }}"
|
||||||
|
user: root
|
||||||
|
roles:
|
||||||
|
- set-min-gas-price
|
Loading…
Reference in New Issue