Removed trackomatron, updated config to tendermint 0.16 (config dir) and changed services to in-process

This commit is contained in:
Greg Szabo 2018-02-19 19:38:29 -05:00
parent 9bd1f28b8d
commit 1eb7a8a2cc
24 changed files with 216 additions and 268 deletions

View File

@ -3,7 +3,7 @@
- name: gather tendermint public keys
when: (validators == true or validators == 'true') and genesis_file is not defined
tags: reconfig-toml,reconfig-genesis
command: "/usr/bin/tendermint show_validator --home /etc/{{service}} --log_level error"
command: "/usr/bin/tendermint show_validator --home /etc/{{service}}/config --log_level error"
register: pubkeys
changed_when: false
@ -22,21 +22,21 @@
tags: reconfig-genesis
template:
src: genesis.json.j2
dest: "/etc/{{service}}/genesis.json"
dest: "/etc/{{service}}/config/genesis.json"
owner: "{{service}}"
group: "{{service}}"
- name: copy pre-created genesis.json
when: genesis_file is defined
tags: reconfig-genesis
copy: "src={{genesis_file}} dest=/etc/{{service}}/genesis.json owner={{service}} group={{service}}"
copy: "src={{genesis_file}} dest=/etc/{{service}}/config/genesis.json owner={{service}} group={{service}}"
- name: copy tendermint config.toml
tags: reconfig-toml
when: validators == true or validators == 'true'
template:
src: config.toml.j2
dest: "/etc/{{service}}/config.toml"
dest: "/etc/{{service}}/config/config.toml"
owner: "{{service}}"
group: "{{service}}"
@ -45,14 +45,14 @@
tags: reconfig-toml,reconfig-genesis
get_url: "url={{item['src']}} dest={{item['dst']}} force=yes"
with_items:
- { src: "https://raw.githubusercontent.com/tendermint/testnets/master/{{validator_network}}/{{service}}/genesis.json" , dst: "/etc/{{service}}/genesis.json" }
- { src: "https://raw.githubusercontent.com/tendermint/testnets/master/{{validator_network}}/config.toml" , dst: "/etc/{{service}}/config.toml" }
- { src: "https://raw.githubusercontent.com/tendermint/testnets/master/{{validator_network}}/{{service}}/genesis.json" , dst: "/etc/{{service}}/config/genesis.json" }
- { src: "https://raw.githubusercontent.com/tendermint/testnets/master/{{validator_network}}/config.toml" , dst: "/etc/{{service}}/config/config.toml" }
- name: Set validator network files permissions for non-validators
when: validators == false or validators == 'false'
tags: reconfig-toml,reconfig-genesis
file: "path={{item}} owner={{service}} group={{service}}"
with_items:
- "/etc/{{service}}/genesis.json"
- "/etc/{{service}}/config.toml"
- "/etc/{{service}}/config/genesis.json"
- "/etc/{{service}}/config/config.toml"

View File

@ -1,63 +1,213 @@
# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml
##### main base config options #####
# TCP or UNIX socket address of the ABCI application,
# or the name of an ABCI application compiled in with the Tendermint binary
proxy_app = "tcp://127.0.0.1:46658"
# A custom human readable name for this node
moniker = "{{inventory_hostname}}"
# If this node is many blocks behind the tip of the chain, FastSync
# allows them to catchup quickly by downloading blocks in parallel
# and verifying their commits
fast_sync = true
{% if service == 'tendermint' %}
# Database backend: leveldb | memdb
db_backend = "memdb"
# Database directory
db_path = "data"
# Output level for logging, including package level options
log_level = "mempool:error,*:debug"
{% else %}
# Database backend: leveldb | memdb
db_backend = "leveldb"
log_level = "state:info,*:error"
#log_level = "*:debug"
# Database directory
db_path = "data"
# Output level for logging, including package level options
log_level = "main:info,state:info,*:error"
#log_level = "mempool:error,*:debug"
{% endif %}
##### additional base config options #####
# Path to the JSON file containing the initial validator set and other meta data
genesis_file = "config/genesis.json"
# Path to the JSON file containing the private key to use as a validator in the consensus protocol
priv_validator_file = "config/priv_validator.json"
# Path to the JSON file containing the private key to use for node authentication in the p2p protocol
node_key_file = "config/node_key.json"
# Mechanism to connect to the ABCI application: socket | grpc
abci = "socket"
# TCP or UNIX socket address for the profiling server to listen on
prof_laddr = ""
# If true, query the ABCI app on connecting to a new peer
# so the app can decide if we should keep the connection or not
filter_peers = false
##### advanced configuration options #####
##### rpc server configuration options #####
[rpc]
# TCP or UNIX socket address for the RPC server to listen on
laddr = "tcp://0.0.0.0:46657"
{% if service == 'tendermint' %}
# TCP or UNIX socket address for the gRPC server to listen on
# NOTE: This server only supports /broadcast_tx_commit
grpc_laddr = ""
[mempool]
recheck = false
broadcast = true
wal_dir = ""
[consensus]
max_block_size_txs = 10000
create_empty_blocks = false
timeout_propose = 10000
skip_timeout_commit = true
timeout_commit = 1
wal_light = true
block_part_size = 262144
create_empty_blocks_interval = 60
{% else %}
[consensus]
create_empty_blocks_interval = 60
[tx_index]
index_all_tags = true
{% endif %}
# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool
unsafe = false
##### peer to peer configuration options #####
[p2p]
max_num_peers = 300
pex = true
{% if service == 'tendermint' %}
max_msg_packet_payload_size=65536
send_rate=51200000 # 50 MB/s
recv_rate=51200000 # 50 MB/s
{% endif %}
# Address to listen for incoming connections
laddr = "tcp://0.0.0.0:46656"
# Comma separated list of seed nodes to connect to
{% if validators == true or validators == 'true' %}
{% set comma = joiner(",") %}seeds = "{% for host in ((groups[testnet_name]|default([]))+(groups['tag_Environment_'~(testnet_name|regex_replace('-','_'))]|default([])))|difference(inventory_hostname) %}{{ comma() }}{{hostvars[host]["inventory_hostname"]}}:46656{% endfor %}"
{% else %}
seeds = "{{ seeds | default() }}"
{% endif %}
# Comma separated list of nodes to keep persistent connections to
persistent_peers = ""
# Path to address book
addr_book_file = "config/addrbook.json"
# Set true for strict address routability rules
addr_book_strict = true
# Time to wait before flushing messages out on the connection, in ms
flush_throttle_timeout = 100
# Maximum number of peers to connect to
#max_num_peers = 50
max_num_peers = 300
# Maximum size of a message packet payload, in bytes
{% if service == 'tendermint' %}
max_msg_packet_payload_size = 65536
{% else %}
max_msg_packet_payload_size = 1024
{% endif %}
# Rate at which packets can be sent, in bytes/second
{% if service == 'tendermint' %}
send_rate = 51200000 # 50 MB/s
{% else %}
send_rate = 512000
{% endif %}
# Rate at which packets can be received, in bytes/second
{% if service == 'tendermint' %}
recv_rate = 51200000 # 50 MB/s
{% else %}
recv_rate = 512000
{% endif %}
# Set true to enable the peer-exchange reactor
pex = true
# Seed mode, in which node constantly crawls the network and looks for
# peers. If another node asks it for addresses, it responds and disconnects.
#
# Does not work if the peer-exchange reactor is disabled.
seed_mode = false
##### mempool configuration options #####
[mempool]
{% if service == 'tendermint' %}
recheck = false
{% else %}
recheck = true
{% endif %}
recheck_empty = true
broadcast = true
{% if service == 'tendermint' %}
wal_dir = ""
{% else %}
wal_dir = "data/mempool.wal"
{% endif %}
##### consensus configuration options #####
[consensus]
wal_file = "data/cs.wal/wal"
{% if service == 'tendermint' %}
wal_light = true
{% else %}
wal_light = false
{% endif %}
# All timeouts are in milliseconds
{% if service == 'tendermint' %}
timeout_propose = 10000
{% else %}
timeout_propose = 3000
{% endif %}
timeout_propose_delta = 500
timeout_prevote = 1000
timeout_prevote_delta = 500
timeout_precommit = 1000
timeout_precommit_delta = 500
{% if service == 'tendermint' %}
timeout_commit = 1
{% else %}
timeout_commit = 1000
{% endif %}
# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
{% if service == 'tendermint' %}
skip_timeout_commit = true
{% else %}
skip_timeout_commit = false
{% endif %}
# BlockSize
max_block_size_txs = 10000
max_block_size_bytes = 1
# EmptyBlocks mode and possible interval between empty blocks in seconds
{% if service == 'tendermint' %}
create_empty_blocks = false
{% else %}
create_empty_blocks = true
create_empty_blocks_interval = 60
{% endif %}
# Reactor sleep duration parameters are in milliseconds
peer_gossip_sleep_duration = 100
peer_query_maj23_sleep_duration = 2000
##### transactions indexer configuration options #####
[tx_index]
# What indexer to use for transactions
#
# Options:
# 1) "null" (default)
# 2) "kv" - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend).
indexer = "kv"

View File

@ -1,6 +1,6 @@
---
- name: Get config.toml from node
fetch: "dest={{ destination | default('.') }}/config.toml flat=yes src=/etc/{{service}}/config.toml"
fetch: "dest={{ destination | default('.') }}/config.toml flat=yes src=/etc/{{service}}/config/config.toml"
run_once: yes

View File

@ -8,13 +8,13 @@
- name: Result
debug: var=status.stdout_lines
- name: tendermint service status
when: service != 'tendermint'
command: "service {{service}}-server status"
changed_when: false
register: tendermintstatus
#- name: tendermint service status
# when: service != 'tendermint'
# command: "service {{service}}-server status"
# changed_when: false
# register: tendermintstatus
- name: Result
when: service != 'tendermint'
debug: var=tendermintstatus.stdout_lines
#- name: Result
# when: service != 'tendermint'
# debug: var=tendermintstatus.stdout_lines

View File

@ -35,12 +35,12 @@ endif
# Here comes the real deal
###
binaries = tendermint basecoin ethermint trackomatron gaia
build-binaries = build-tendermint build-basecoin build-ethermint build-trackomatron build-gaia
package-rpm = package-rpm-tendermint package-rpm-basecoin package-rpm-ethermint package-rpm-trackomatron package-rpm-gaia
install-rpm = install-rpm-tendermint install-rpm-basecoin install-rpm-ethermint install-rpm-trackomatron install-rpm-gaia
package-deb = package-deb-tendermint package-deb-basecoin package-deb-ethermint package-deb-trackomatron package-deb-gaia
install-deb = install-deb-tendermint install-deb-basecoin install-deb-ethermint install-deb-trackomatron install-deb-gaia
binaries = tendermint basecoin ethermint gaia
build-binaries = build-tendermint build-basecoin build-ethermint build-gaia
package-rpm = package-rpm-tendermint package-rpm-basecoin package-rpm-ethermint package-rpm-gaia
install-rpm = install-rpm-tendermint install-rpm-basecoin install-rpm-ethermint install-rpm-gaia
package-deb = package-deb-tendermint package-deb-basecoin package-deb-ethermint package-deb-gaia
install-deb = install-deb-tendermint install-deb-basecoin install-deb-ethermint install-deb-gaia
all: $(binaries)
build: $(build-binaries)
@ -76,14 +76,6 @@ build-ethermint: git-branch gopath-setup
cp $(GOPATH)/src/github.com/tendermint/ethermint/build/ethermint $(GOPATH)/bin
@echo "*** Built ethermint"
build-trackomatron: git-branch gopath-setup
@echo "*** Building trackomatron"
go get -d -u github.com/tendermint/trackomatron/cmd/tracko
cd $(GOPATH)/src/github.com/tendermint/trackomatron && git checkout "$(GIT_BRANCH)" && git pull
export PATH=$(GOPATH)/bin:$(PATH) && $(MAKE) -C $(GOPATH)/src/github.com/tendermint/trackomatron get_vendor_deps install
@echo "Workaround: trackomatron package has tracko as the binary - trackomatron needed for proper packaging" && rm -rf $(GOPATH)/bin/trackomatron && ln -s $(GOPATH)/bin/tracko $(GOPATH)/bin/trackomatron
@echo "*** Built trackomatron"
build-gaia: git-branch gopath-setup
@echo "*** Building gaia"
go get -d -u go github.com/cosmos/gaia || echo "Workaround for go downloads."
@ -126,7 +118,6 @@ prepare-tendermint =
prepare-ethermint = mkdir -p $(build_folder)/etc/ethermint && \
cp $(GOPATH)/src/github.com/tendermint/ethermint/setup/genesis.json $(build_folder)/etc/ethermint/genesis.json && \
cp -r $(GOPATH)/src/github.com/tendermint/ethermint/setup/keystore $(build_folder)/etc/ethermint
prepare-trackomatron = rm -f $(build_folder)/usr/bin/trackomatron && cp $(GOPATH)/bin/tracko $(GOPATH)/bin/trackocli $(build_folder)/usr/bin
prepare-gaia =
prepare-basecoin = cp $(GOPATH)/bin/basecoin $(build_folder)/usr/bin
@ -289,13 +280,10 @@ distclean: clean
rm -rf $(GOPATH)/src/github.com/tendermint/tendermint
rm -rf $(GOPATH)/src/github.com/cosmos/cosmos-sdk
rm -rf $(GOPATH)/src/github.com/tendermint/ethermint
rm -rf $(GOPATH)/src/github.com/tendermint/trackomatron
rm -rf $(GOPATH)/bin/tendermint
rm -rf $(GOPATH)/bin/basecoin
rm -rf $(GOPATH)/bin/ethermint
rm -rf $(GOPATH)/bin/gaia
rm -rf $(GOPATH)/bin/tracko
rm -rf $(GOPATH)/bin/trackocli
.PHONY : clean

View File

@ -21,7 +21,6 @@ case "$1" in
configure)
chown basecoin.basecoin /etc/basecoin
sudo -Hu basecoin basecoin node init --home /etc/basecoin 2B24DEE2364762300168DF19B6C18BCE2D399EA2
sudo -Hu basecoin tendermint init --home /etc/basecoin
systemctl daemon-reload
;;

View File

@ -19,7 +19,6 @@ set -e
case "$1" in
remove|upgrade|deconfigure)
systemctl stop basecoin 2> /dev/null || :
systemctl stop basecoin-service 2> /dev/null || :
;;
failed-upgrade)

View File

@ -1,3 +1,2 @@
disable basecoin.service
disable basecoin-server.service

View File

@ -1,24 +0,0 @@
[Unit]
Description=Basecoin server
Requires=network-online.target
BindTo=basecoin.service
PartOf=basecoin.service
Before=basecoin.service
After=network-online.target
PropagatesReloadTo=basecoin.service
ReloadPropagatedFrom=basecoin.service
[Service]
Environment="TMHOME=/etc/basecoin"
Restart=on-failure
User=basecoin
Group=basecoin
PermissionsStartOnly=true
ExecStart=/usr/bin/tendermint node
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target
Also=basecoin.service

View File

@ -1,16 +1,7 @@
[Unit]
Description=Basecoin
#propagates activation, deactivation and activation fails.
Requires=network-online.target
#propagates activation, deactivation, activation fails and stops
BindTo=basecoin-server.service
#propagates stop and restart (one-way)
PartOf=basecoin-server.service
#order
After=network-online.target basecoin-server.service
#propagates reload
PropagatesReloadTo=basecoin-server.service
ReloadPropagatedFrom=basecoin-server.service
After=network-online.target
[Service]
Environment="BCHOME=/etc/basecoin"
@ -18,11 +9,10 @@ Restart=on-failure
User=basecoin
Group=basecoin
PermissionsStartOnly=true
ExecStart=/usr/bin/basecoin start --without-tendermint
ExecStart=/usr/bin/basecoind start
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target basecoin-server.service
Also=basecoin-server.service
WantedBy=multi-user.target

View File

@ -1,5 +1,5 @@
#!/bin/sh
# postinst script for basecoin
# postinst script for ethermint
#
set -e

View File

@ -19,7 +19,6 @@ set -e
case "$1" in
remove|upgrade|deconfigure)
systemctl stop ethermint 2> /dev/null || :
systemctl stop ethermint-service 2> /dev/null || :
;;
failed-upgrade)

View File

@ -1,3 +1,2 @@
disable ethermint.service
disable ethermint-server.service

View File

@ -1,24 +0,0 @@
[Unit]
Description=Ethermint server
Requires=network-online.target
BindTo=ethermint.service
PartOf=ethermint.service
Before=ethermint.service
After=network-online.target
PropagatesReloadTo=ethermint.service
ReloadPropagatedFrom=ethermint.service
[Service]
Environment="TMHOME=/etc/ethermint"
Restart=on-failure
User=ethermint
Group=ethermint
PermissionsStartOnly=true
ExecStart=/usr/bin/tendermint node
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target ethermint.service
Also=ethermint.service

View File

@ -1,16 +1,7 @@
[Unit]
Description=Ethermint
#propagates activation, deactivation and activation fails.
Requires=network-online.target
#propagates activation, deactivation, activation fails and stops
BindTo=ethermint-server.service
#propagates stop and restart (one-way)
PartOf=ethermint-server.service
#order
After=network-online.target ethermint-server.service
#propagates reload
PropagatesReloadTo=ethermint-server.service
ReloadPropagatedFrom=ethermint-server.service
After=network-online.target
[Service]
Restart=on-failure
@ -22,6 +13,5 @@ ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target ethermint-server.service
Also=ethermint-server.service
WantedBy=multi-user.target

View File

@ -21,7 +21,6 @@ case "$1" in
configure)
chown gaia.gaia /etc/gaia
sudo -Hu gaia gaia node init --home /etc/gaia 2B24DEE2364762300168DF19B6C18BCE2D399EA2
sudo -Hu gaia tendermint init --home /etc/gaia
systemctl daemon-reload
;;

View File

@ -19,7 +19,6 @@ set -e
case "$1" in
remove|upgrade|deconfigure)
systemctl stop gaia 2> /dev/null || :
systemctl stop gaia-service 2> /dev/null || :
;;
failed-upgrade)

View File

@ -1,3 +1,2 @@
disable gaia.service
disable gaia-server.service

View File

@ -1,24 +0,0 @@
[Unit]
Description=Gaia server
Requires=network-online.target
BindTo=gaia.service
PartOf=gaia.service
Before=gaia.service
After=network-online.target
PropagatesReloadTo=gaia.service
ReloadPropagatedFrom=gaia.service
[Service]
Environment="TMHOME=/etc/gaia"
Restart=on-failure
User=gaia
Group=gaia
PermissionsStartOnly=true
ExecStart=/usr/bin/tendermint node
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target
Also=gaia.service

View File

@ -1,27 +1,17 @@
[Unit]
Description=Gaia
#propagates activation, deactivation and activation fails.
Requires=network-online.target
#propagates activation, deactivation, activation fails and stops
BindTo=gaia-server.service
#propagates stop and restart (one-way)
PartOf=gaia-server.service
#order
After=network-online.target gaia-server.service
#propagates reload
PropagatesReloadTo=gaia-server.service
ReloadPropagatedFrom=gaia-server.service
After=network-online.target
[Service]
Restart=on-failure
User=gaia
Group=gaia
PermissionsStartOnly=true
ExecStart=/usr/bin/gaia node start --without-tendermint --home=/etc/gaia
ExecStart=/usr/bin/gaia node start --home=/etc/gaia
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target gaia-server.service
Also=gaia-server.service
WantedBy=multi-user.target

View File

@ -35,18 +35,11 @@ cd %{name}-%{version}-%{release}
%{__cp} -a * %{buildroot}
%post
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}
sudo -Hu %{name} %{name} node init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
#Temporary until https://github.com/tendermint/basecoin/issues/123
rm -f %{_sysconfdir}/%{name}/key.json
rm -f %{_sysconfdir}/%{name}/key2.json
systemctl daemon-reload
%preun
systemctl stop %{name} 2> /dev/null || :
systemctl stop %{name}-service 2> /dev/null || :
%postun
systemctl daemon-reload

View File

@ -1,5 +0,0 @@
PACKAGE_SUMMARY="cosmos-sdk is a Proof-of-Stake framework"
PACKAGE_URL="https://cosmos.network/"
PACKAGE_ADDITIONAL_HEADER="Provides: basecoin"
PACKAGE_DESCRIPTION="Cosmos-SDK is a general purpose framework for the Tendermint consensus engine to form a Proof-of-Stake cryptocurrency."

View File

@ -1,5 +0,0 @@
PACKAGE_SUMMARY="Trackomatron - Track invoices on the blockchain"
PACKAGE_URL="https://tendermint.com/"
PACKAGE_ADDITIONAL_HEADER=""
PACKAGE_DESCRIPTION="This software is intended to create a space to easily send invoices between and within institutions. Firstly, the commands of trackmatron are separated into two broad categories: submitting information to the blockchain (transactions), and retrieving information from the blockchain (query)."

View File

@ -1,63 +0,0 @@
Version: @VERSION@
Release: @BUILD_NUMBER@
%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{nil}
Name: @PACKAGE_NAME@
Summary: @PACKAGE_SUMMARY@
License: Apache 2.0
URL: @PACKAGE_URL@
Packager: Greg Szabo
Requires: tendermint >= 0.11.0
@PACKAGE_ADDITIONAL_HEADER@
%description
@PACKAGE_DESCRIPTION@
%pre
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
useradd -r -b %{_sysconfdir} %{name}
mkdir -p %{_sysconfdir}/%{name}
chmod 755 %{_sysconfdir}/%{name}
chown %{name}.%{name} %{_sysconfdir}/%{name}
fi
%prep
# Nothing to do here. - It is done in the Makefile.
%build
# Nothing to do here.
%install
cd %{name}-%{version}-%{release}
%{__cp} -a * %{buildroot}
%post
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}
sudo -Hu %{name} tracko init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
#Temporary until https://github.com/tendermint/basecoin/issues/123
rm -f %{_sysconfdir}/%{name}/key.json
rm -f %{_sysconfdir}/%{name}/key2.json
systemctl daemon-reload
%preun
systemctl stop %{name} 2> /dev/null || :
systemctl stop %{name}-service 2> /dev/null || :
%postun
systemctl daemon-reload
%files
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
%{_bindir}/*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/systemd/system-preset/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%dir %{_defaultlicensedir}/%{name}
%doc %{_defaultlicensedir}/%{name}/LICENSE