Merge PR #1821: Added seed node update scripts

* Added seed node update scripts
* Updated PENDING
* Fixed issue with GENESISFILE and added GENESISURL to seed node scripts
* Fixed unsafe reset bug
* As requested, multiline ansible-playbook command
* Added monitoring gaiacli.service to logz.io template
* Added journald configuration ansible script
This commit is contained in:
Greg Szabo 2018-07-31 21:13:22 -04:00 committed by Christopher Goes
parent 840d915ff6
commit 179b8f9c49
14 changed files with 140 additions and 2 deletions

View File

@ -38,6 +38,7 @@ FEATURES
* [cosmos-sdk-cli] Added support for cosmos-sdk-cli tool under cosmos-sdk/cmd
* This allows SDK users to initialize a new project repository.
* [tests] Remotenet commands for AWS (awsnet)
* [networks] Added ansible scripts to upgrade seed nodes on a network
* [store] Add transient store
* [gov] Add slashing for validators who do not vote on a proposal
* [cli] added `gov query-proposals` command to CLI. Can filter by `depositer`, `voter`, and `status`

View File

@ -17,6 +17,7 @@ REGION_LIMIT?=1
# Path to gaiad for deployment. Must be a Linux binary.
BINARY?=$(CURDIR)/../build/gaiad
GAIACLI_BINARY?=$(CURDIR)/../build/gaiacli
# Path to the genesis.json and config.toml files to deploy on full nodes.
GENESISFILE?=$(CURDIR)/../build/genesis.json
@ -39,7 +40,15 @@ disclaimer:
extract-config: disclaimer
#Make sure you have AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY or your IAM roles set for AWS API access.
@if ! [ -f $(HOME)/.ssh/id_rsa.pub ]; then ssh-keygen ; fi
cd remote/ansible && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i inventory/ec2.py -l "tag_Environment_$(CLUSTER_NAME)" -u centos -b -e TESTNET_NAME="$(TESTNET_NAME)" -e GENESISFILE="$(GENESISFILE)" -e CONFIGFILE="$(CONFIGFILE)" extract-config.yml
cd remote/ansible && \
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook \
-i inventory/ec2.py \
-l "tag_Environment_$(CLUSTER_NAME)" \
-b -u centos \
-e TESTNET_NAME="$(TESTNET_NAME)" \
-e GENESISFILE="$(GENESISFILE)" \
-e CONFIGFILE="$(CONFIGFILE)" \
extract-config.yml
########################################
@ -91,6 +100,15 @@ upgrade-gaiad: disclaimer
@if [ -z "`file $(BINARY) | grep 'ELF 64-bit'`" ]; then echo "Please build a linux binary using 'make build-linux'." ; false ; fi
cd remote/ansible && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i inventory/ec2.py -l "tag_Environment_$(CLUSTER_NAME)" -u centos -b -e BINARY=$(BINARY) upgrade-gaiad.yml
UNSAFE_RESET_ALL?=no
upgrade-seeds: disclaimer
#Make sure you have AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY or your IAM roles set for AWS API access.
@if ! [ -f $(HOME)/.ssh/id_rsa.pub ]; then ssh-keygen ; fi
@if [ -z "`file $(BINARY) | grep 'ELF 64-bit'`" ]; then echo "Please build a linux binary using 'make build-linux'." ; false ; fi
@if [ -z "`file $(GAIACLI_BINARY) | grep 'ELF 64-bit'`" ]; then echo "Please build a linux binary using 'make build-linux'." ; false ; fi
cd remote/ansible && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i inventory/ec2.py -l "tag_Environment_$(CLUSTER_NAME)" -u centos -b -e BINARY=$(BINARY) -e GAIACLI_BINARY=$(GAIACLI_BINARY) -e UNSAFE_RESET_ALL=$(UNSAFE_RESET_ALL) upgrade-gaia.yml
list:
remote/ansible/inventory/ec2.py | python -c 'import json,sys ; print "\n".join(json.loads("".join(sys.stdin.readlines()))["tag_Environment_$(CLUSTER_NAME)"])'

View File

@ -0,0 +1,8 @@
---
- hosts: all
any_errors_fatal: true
gather_facts: no
roles:
- add-lcd

View File

@ -0,0 +1,4 @@
---
GAIAD_ADDRESS: tcp://0.0.0.0:1317

View File

@ -0,0 +1,9 @@
---
- name: systemctl
systemd: name=gaiacli enabled=yes daemon_reload=yes
- name: restart gaiacli
service: name=gaiacli state=restarted

View File

@ -0,0 +1,15 @@
---
- name: Copy binary
copy:
src: "{{GAIACLI_BINARY}}"
dest: /usr/bin
mode: 0755
notify: restart gaiacli
- name: Copy service
template:
src: gaiacli.service.j2
dest: /etc/systemd/system/gaiacli.service
notify: systemctl

View File

@ -0,0 +1,17 @@
[Unit]
Description=gaiacli
Requires=network-online.target
After=network-online.target
[Service]
Restart=on-failure
User=gaiad
Group=gaiad
PermissionsStartOnly=true
ExecStart=/usr/bin/gaiacli advanced rest-server --laddr {{GAIAD_ADDRESS}}
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target

View File

@ -50,7 +50,7 @@ journalbeat:
#move_metadata_to_field: ""
# Specific units to monitor.
units: ["{{service}}.service"]
units: ["{{service}}.service","gaiacli.service"]
# Specify Journal paths to open. You can pass an array of paths to Systemd Journal paths.
# If you want to open Journal from directory just pass an array consisting of one element

View File

@ -0,0 +1,6 @@
---
- name: restart journald
service: name=systemd-journald state=restarted

View File

@ -0,0 +1,20 @@
---
- name: Disable journald rate-limiting
lineinfile: "dest=/etc/systemd/journald.conf regexp={{item.regexp}} line='{{item.line}}'"
with_items:
- { regexp: "^#RateLimitInterval", line: "RateLimitInterval=0s" }
- { regexp: "^#RateLimitBurst", line: "RateLimitBurst=0" }
notify: restart journald
- name: Create journal directory for permanent logs
file: path=/var/log/journal state=directory
notify: restart journald
- name: Set journal folder with systemd-tmpfiles
command: "systemd-tmpfiles --create --prefix /var/log/journal"
notify: restart journald
#- name: Ability to get the core dump on SIGABRT
# shell: "ulimit -c unlimited"

View File

@ -7,3 +7,23 @@
mode: 0755
notify: restart gaiad
- name: Copy new genesis.json file, if available
when: "GENESISFILE is defined and GENESISFILE != ''"
copy:
src: "{{GENESISFILE}}"
dest: /home/gaiad/.gaiad/config/genesis.json
notify: restart gaiad
- name: Download genesis.json URL, if available
when: "GENESISURL is defined and GENESISURL != ''"
get_url:
url: "{{GENESISURL}}"
dest: /home/gaiad/.gaiad/config/genesis.json
force: yes
notify: restart gaiad
- name: Reset network
when: UNSAFE_RESET_ALL | default(false) | bool
command: "sudo -u gaiad gaiad unsafe_reset_all"
notify: restart gaiad

View File

@ -0,0 +1,8 @@
---
- hosts: all
any_errors_fatal: true
gather_facts: no
roles:
- setup-journald

View File

@ -0,0 +1,9 @@
---
- hosts: all
any_errors_fatal: true
gather_facts: no
roles:
- upgrade-gaiad
- add-lcd

View File

@ -1,5 +1,8 @@
---
# Required: BINARY
# Optional: GENESISFILE, UNSAFE_RESET_ALL
- hosts: all
any_errors_fatal: true
gather_facts: no