Browse Source

removed python dependency from package, remove jq dependency from ansible

pull/1943/head
Greg Szabo 7 years ago
parent
commit
78ddcc08e1
12 changed files with 53 additions and 42 deletions
  1. +0
    -16
      ansible/config.toml
  2. +8
    -0
      ansible/config.yml
  3. +8
    -0
      ansible/rmdb.yml
  4. +2
    -2
      ansible/roles/config/tasks/main.yml
  5. +4
    -1
      ansible/roles/config/templates/genesis-server.json.j2
  6. +13
    -7
      ansible/roles/install/tasks/centos.yml
  7. +7
    -4
      ansible/roles/install/tasks/debian.yml
  8. +4
    -4
      devops/rpmbuild/Makefile
  9. +2
    -2
      devops/rpmbuild/extrafiles/DEBIAN-basecoin/postinst
  10. +2
    -2
      devops/rpmbuild/extrafiles/DEBIAN-ethermint/postinst
  11. +1
    -1
      devops/rpmbuild/spectemplates/basecoin.spec
  12. +2
    -3
      devops/rpmbuild/spectemplates/ethermint.spec

+ 0
- 16
ansible/config.toml View File

@ -1,16 +0,0 @@
# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml
proxy_app = "tcp://127.0.0.1:46658"
moniker = "146.185.178.252"
fast_sync = true
db_backend = "leveldb"
log_level = "debug"
[rpc]
laddr = "tcp://0.0.0.0:46657"
[p2p]
laddr = "tcp://0.0.0.0:46656"
seeds = "138.197.154.40:46656,138.68.244.161:46656,128.199.192.199:46656,46.101.41.147:46656,162.243.247.32:46656,207.154.231.86:46656"

+ 8
- 0
ansible/config.yml View File

@ -0,0 +1,8 @@
---
#variable "service" is required
- hosts: "{{ lookup('env','TF_VAR_TESTNET_NAME') }}"
roles:
- {role: config, testnet_name: "{{lookup('env','TF_VAR_TESTNET_NAME')}}"}

+ 8
- 0
ansible/rmdb.yml View File

@ -0,0 +1,8 @@
---
#variable "service" is required
- hosts: "{{ lookup('env','TF_VAR_TESTNET_NAME') }}"
roles:
- rmdb

+ 2
- 2
ansible/roles/config/tasks/main.yml View File

@ -2,13 +2,13 @@
- name: gather tendermint public keys - name: gather tendermint public keys
when: validators == true and tendermint_genesis_file is not defined when: validators == true and tendermint_genesis_file is not defined
command: "jq '.pub_key | .data' /etc/{{service}}/tendermint/priv_validator.json"
shell: "tendermint show_validator --home /etc/{{service}}/tendermint --log_level error"
register: pubkeys register: pubkeys
changed_when: false changed_when: false
- name: register tendermint public keys as host facts - name: register tendermint public keys as host facts
when: validators == true and tendermint_genesis_file is not defined when: validators == true and tendermint_genesis_file is not defined
set_fact: "pubkey={{pubkeys.stdout_lines[0]}}"
set_fact: "pubkey='{{pubkeys.stdout}}'"
connection: local connection: local
- name: copy generated tendermint genesis.json - genesis_time will be updated - name: copy generated tendermint genesis.json - genesis_time will be updated


+ 4
- 1
ansible/roles/config/templates/genesis-server.json.j2 View File

@ -8,7 +8,10 @@
{% for host in groups[testnet_name] %} {% for host in groups[testnet_name] %}
{{ comma() }} {{ comma() }}
{ {
"pub_key":{"type":"ed25519","data":{{hostvars[host]["pubkey"]}}},
"pub_key": {
"data": "{{hostvars[host]["pubkey"]["data"]}}",
"type": "ed25519"
},
"amount":10, "amount":10,
"name":"{{hostvars[host]["ansible_hostname"]}}" "name":"{{hostvars[host]["ansible_hostname"]}}"
} }


+ 13
- 7
ansible/roles/install/tasks/centos.yml View File

@ -1,19 +1,25 @@
--- ---
- name: Add tendermint repository and key on CentOS/RedHat
#Three commands to install a service on CentOS/RedHat
#wget -O - http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64/RPM-GPG-KEY-Tendermint | rpm --import -
#wget -O /etc/yum.repos.d/tendermint.repo http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64/tendermint.repo
#yum update && yum install basecoin
- name: Add repository key on CentOS/RedHat
when: ansible_os_family == "RedHat"
rpm_key: key=http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64/RPM-GPG-KEY-Tendermint
- name: Install tendermint repository on CentOS/RedHat
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
yum_repository: yum_repository:
name: tendermint name: tendermint
baseurl: http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64 baseurl: http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64
description: "Tendermint repo" description: "Tendermint repo"
gpgcheck: yes gpgcheck: yes
gpgkey: http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/RPM-GPG-KEY-Tendermint
gpgkey: http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64/RPM-GPG-KEY-Tendermint
repo_gpgcheck: yes repo_gpgcheck: yes
- name: Install package on CentOS/RedHat - name: Install package on CentOS/RedHat
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
yum: pkg={{item}}
with_items:
- epel-release
- jq
- "{{service}}"
yum: "pkg={{service}}"

+ 7
- 4
ansible/roles/install/tasks/debian.yml View File

@ -1,4 +1,10 @@
--- ---
#Three commands to install a service on Debian/Ubuntu
#wget -O - http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64/RPM-GPG-KEY-Tendermint | apt-key add -
#echo "deb http://tendermint-packages.s3-website-us-west-1.amazonaws.com/debian stable main" > /etc/apt/sources.list.d/tendermint.list
#apt-get update && apt-get install basecoin
- name: Add repository key on Debian/Ubuntu - name: Add repository key on Debian/Ubuntu
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
apt_key: apt_key:
@ -12,8 +18,5 @@
- name: Install package on Debian/Ubuntu - name: Install package on Debian/Ubuntu
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
apt: pkg={{item}}
with_items:
- jq
- "{{service}}"
apt: "pkg={{service}}"

+ 4
- 4
devops/rpmbuild/Makefile View File

@ -132,7 +132,7 @@ package-deb-%: version-%
install-rpm-%: version-% install-rpm-%: version-%
#Make sure your host has the IAM role to read/write the S3 bucket OR that you set up ~/.boto #Make sure your host has the IAM role to read/write the S3 bucket OR that you set up ~/.boto
@echo "*** Uploading $*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm to AWS CentOS repository" @echo "*** Uploading $*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm to AWS CentOS repository"
aws s3 sync s3://tendermint-packages/centos/ tmp/s3/
aws s3 sync s3://tendermint-packages/centos/ tmp/s3/ --delete
mkdir -p tmp/s3/7/os/x86_64/Packages mkdir -p tmp/s3/7/os/x86_64/Packages
cp RPMS/x86_64/$*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm tmp/s3/7/os/x86_64/Packages cp RPMS/x86_64/$*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm tmp/s3/7/os/x86_64/Packages
cp repofiles/RPM-GPG-KEY-Tendermint tmp/s3/7/os/x86_64/ cp repofiles/RPM-GPG-KEY-Tendermint tmp/s3/7/os/x86_64/
@ -140,14 +140,14 @@ install-rpm-%: version-%
rm -f tmp/s3/7/os/x86_64/repodata/*.bz2 tmp/s3/7/os/x86_64/repodata/*.gz tmp/s3/7/os/x86_64/repodata/repomd.xml.asc rm -f tmp/s3/7/os/x86_64/repodata/*.bz2 tmp/s3/7/os/x86_64/repodata/*.gz tmp/s3/7/os/x86_64/repodata/repomd.xml.asc
createrepo tmp/s3/7/os/x86_64/Packages -u http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64/Packages -o tmp/s3/7/os/x86_64 --update -S --repo Tendermint --content tendermint --content basecoin --content ethermint createrepo tmp/s3/7/os/x86_64/Packages -u http://tendermint-packages.s3-website-us-west-1.amazonaws.com/centos/7/os/x86_64/Packages -o tmp/s3/7/os/x86_64 --update -S --repo Tendermint --content tendermint --content basecoin --content ethermint
gpg --batch --passphrase "$(GPG_PASSPHRASE)" --sign -a tmp/s3/7/os/x86_64/repodata/repomd.xml gpg --batch --passphrase "$(GPG_PASSPHRASE)" --sign -a tmp/s3/7/os/x86_64/repodata/repomd.xml
aws s3 sync tmp/s3/ s3://tendermint-packages/centos/ --acl public-read
aws s3 sync tmp/s3/ s3://tendermint-packages/centos/ --delete --acl public-read
@echo "*** Uploaded $* to AWS CentOS repository" @echo "*** Uploaded $* to AWS CentOS repository"
install-deb-%: version-% install-deb-%: version-%
@echo "*** Uploading $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb to AWS Debian repository" @echo "*** Uploading $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb to AWS Debian repository"
@echo "Testing if $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb is already uploaded" @echo "Testing if $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb is already uploaded"
test ! -f tmp/debian-s3/pool/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb test ! -f tmp/debian-s3/pool/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb
aws s3 sync s3://tendermint-packages/debian/ tmp/debian-s3/
aws s3 sync s3://tendermint-packages/debian/ tmp/debian-s3/ --delete
@echo "Testing if $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb is already uploaded" @echo "Testing if $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb is already uploaded"
test ! -f tmp/debian-s3/pool/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb test ! -f tmp/debian-s3/pool/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb
mkdir -p tmp/debian-s3/pool tmp/debian-s3/dists/stable/main/binary-amd64 mkdir -p tmp/debian-s3/pool tmp/debian-s3/dists/stable/main/binary-amd64
@ -205,7 +205,7 @@ install-deb-%: version-%
gpg --batch --passphrase "$(GPG_PASSPHRASE)" --digest-algo SHA512 --clearsign tmp/debian-s3/dists/stable/Release gpg --batch --passphrase "$(GPG_PASSPHRASE)" --digest-algo SHA512 --clearsign tmp/debian-s3/dists/stable/Release
mv tmp/debian-s3/dists/stable/Release.asc tmp/debian-s3/dists/stable/InRelease mv tmp/debian-s3/dists/stable/Release.asc tmp/debian-s3/dists/stable/InRelease
aws s3 sync tmp/debian-s3/ s3://tendermint-packages/debian/ --acl public-read
aws s3 sync tmp/debian-s3/ s3://tendermint-packages/debian/ --delete --acl public-read
@echo "*** Uploaded $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb to AWS Debian repository" @echo "*** Uploaded $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb to AWS Debian repository"
mostlyclean: mostlyclean:


+ 2
- 2
devops/rpmbuild/extrafiles/DEBIAN-basecoin/postinst View File

@ -25,7 +25,7 @@ case "$1" in
chown basecoin.basecoin /etc/basecoin/tendermint/config.toml chown basecoin.basecoin /etc/basecoin/tendermint/config.toml
test ! -f /etc/basecoin/priv_validator.json && tendermint gen_validator > /etc/basecoin/priv_validator.json && chmod 0400 /etc/basecoin/priv_validator.json && chown basecoin.basecoin /etc/basecoin/priv_validator.json test ! -f /etc/basecoin/priv_validator.json && tendermint gen_validator > /etc/basecoin/priv_validator.json && chmod 0400 /etc/basecoin/priv_validator.json && chown basecoin.basecoin /etc/basecoin/priv_validator.json
test ! -f /etc/basecoin/tendermint/priv_validator.json && tendermint gen_validator > /etc/basecoin/tendermint/priv_validator.json && chmod 0400 /etc/basecoin/tendermint/priv_validator.json && chown basecoin.basecoin /etc/basecoin/tendermint/priv_validator.json test ! -f /etc/basecoin/tendermint/priv_validator.json && tendermint gen_validator > /etc/basecoin/tendermint/priv_validator.json && chmod 0400 /etc/basecoin/tendermint/priv_validator.json && chown basecoin.basecoin /etc/basecoin/tendermint/priv_validator.json
tendermint_pubkey=`python -uc "import json ; print json.loads(open('/etc/basecoin/tendermint/priv_validator.json').read())['pub_key']['data']"`
tendermint_pubkey="`tendermint show_validator --home /etc/basecoin/tendermint --log_level error`"
test ! -f /etc/basecoin/tendermint/genesis.json && cat << EOF > /etc/basecoin/tendermint/genesis.json test ! -f /etc/basecoin/tendermint/genesis.json && cat << EOF > /etc/basecoin/tendermint/genesis.json
{ {
"genesis_time": "2017-06-10T03:37:03Z", "genesis_time": "2017-06-10T03:37:03Z",
@ -33,7 +33,7 @@ case "$1" in
"validators": "validators":
[ [
{ {
"pub_key":{"type":"ed25519","data":"$tendermint_pubkey"},
"pub_key": $tendermint_pubkey,
"amount":10, "amount":10,
"name":"my_testchain_node" "name":"my_testchain_node"
} }


+ 2
- 2
devops/rpmbuild/extrafiles/DEBIAN-ethermint/postinst View File

@ -29,7 +29,7 @@ case "$1" in
/usr/bin/ethermint --datadir /etc/ethermint init /etc/ethermint/genesis.json /usr/bin/ethermint --datadir /etc/ethermint init /etc/ethermint/genesis.json
chown -R ethermint.ethermint /etc/ethermint/ethermint chown -R ethermint.ethermint /etc/ethermint/ethermint
test ! -f /etc/ethermint/tendermint/priv_validator.json && tendermint gen_validator > /etc/ethermint/tendermint/priv_validator.json && chmod 0400 /etc/ethermint/tendermint/priv_validator.json && chown ethermint.ethermint /etc/ethermint/tendermint/priv_validator.json test ! -f /etc/ethermint/tendermint/priv_validator.json && tendermint gen_validator > /etc/ethermint/tendermint/priv_validator.json && chmod 0400 /etc/ethermint/tendermint/priv_validator.json && chown ethermint.ethermint /etc/ethermint/tendermint/priv_validator.json
tendermint_pubkey=`python -uc "import json ; print json.loads(open('/etc/ethermint/tendermint/priv_validator.json').read())['pub_key']['data']"`
tendermint_pubkey="`tendermint show_validator --home /etc/ethermint/tendermint --log_level error`"
test ! -f /etc/ethermint/tendermint/genesis.json && cat << EOF > /etc/ethermint/tendermint/genesis.json test ! -f /etc/ethermint/tendermint/genesis.json && cat << EOF > /etc/ethermint/tendermint/genesis.json
{ {
"genesis_time": "2017-06-10T03:37:03Z", "genesis_time": "2017-06-10T03:37:03Z",
@ -37,7 +37,7 @@ case "$1" in
"validators": "validators":
[ [
{ {
"pub_key":{"type":"ed25519","data":"$tendermint_pubkey"},
"pub_key": $tendermint_pubkey,
"amount":10, "amount":10,
"name":"my_testchain_node" "name":"my_testchain_node"
} }


+ 1
- 1
devops/rpmbuild/spectemplates/basecoin.spec View File

@ -51,7 +51,7 @@ cd %{name}-%{version}
%post %post
test ! -f %{_sysconfdir}/%{name}/priv_validator.json && tendermint gen_validator > %{_sysconfdir}/%{name}/priv_validator.json && %{__chmod} 0400 %{_sysconfdir}/%{name}/priv_validator.json && %{__chown} %{name}.%{name} %{_sysconfdir}/%{name}/priv_validator.json test ! -f %{_sysconfdir}/%{name}/priv_validator.json && tendermint gen_validator > %{_sysconfdir}/%{name}/priv_validator.json && %{__chmod} 0400 %{_sysconfdir}/%{name}/priv_validator.json && %{__chown} %{name}.%{name} %{_sysconfdir}/%{name}/priv_validator.json
test ! -f %{_sysconfdir}/%{name}/tendermint/priv_validator.json && tendermint gen_validator > %{_sysconfdir}/%{name}/tendermint/priv_validator.json && %{__chmod} 0400 %{_sysconfdir}/%{name}/tendermint/priv_validator.json && %{__chown} %{name}.%{name} %{_sysconfdir}/%{name}/tendermint/priv_validator.json test ! -f %{_sysconfdir}/%{name}/tendermint/priv_validator.json && tendermint gen_validator > %{_sysconfdir}/%{name}/tendermint/priv_validator.json && %{__chmod} 0400 %{_sysconfdir}/%{name}/tendermint/priv_validator.json && %{__chown} %{name}.%{name} %{_sysconfdir}/%{name}/tendermint/priv_validator.json
tendermint_pubkey="`tendermint show_validator --home /etc/%{name}/tendermint --log_level error`"
tendermint_pubkey="`tendermint show_validator --home %{_sysconfdir}/%{name}/tendermint --log_level error`"
test ! -f %{_sysconfdir}/%{name}/tendermint/genesis.json && %{__cat} << EOF > %{_sysconfdir}/%{name}/tendermint/genesis.json test ! -f %{_sysconfdir}/%{name}/tendermint/genesis.json && %{__cat} << EOF > %{_sysconfdir}/%{name}/tendermint/genesis.json
{ {
"genesis_time": "2017-06-10T03:37:03Z", "genesis_time": "2017-06-10T03:37:03Z",


+ 2
- 3
devops/rpmbuild/spectemplates/ethermint.spec View File

@ -10,7 +10,6 @@ URL: https://tendermint.com/
Packager: Greg Szabo Packager: Greg Szabo
Requires: tendermint >= 0.10.0 Requires: tendermint >= 0.10.0
Requires(pre): /sbin/useradd Requires(pre): /sbin/useradd
Requires(post): %{__python}
%description %description
Ethermint enables ethereum to run as an ABCI application on tendermint and the COSMOS hub. This application allows you to get all the benefits of ethereum without having to run your own miners. Ethermint enables ethereum to run as an ABCI application on tendermint and the COSMOS hub. This application allows you to get all the benefits of ethereum without having to run your own miners.
@ -49,7 +48,7 @@ cd %{name}-%{version}
%post %post
%{_bindir}/%{name} --datadir %{_sysconfdir}/%{name} init %{_sysconfdir}/%{name}/genesis.json %{_bindir}/%{name} --datadir %{_sysconfdir}/%{name} init %{_sysconfdir}/%{name}/genesis.json
test ! -f %{_sysconfdir}/%{name}/tendermint/priv_validator.json && tendermint gen_validator > %{_sysconfdir}/%{name}/tendermint/priv_validator.json && %{__chmod} 0400 %{_sysconfdir}/%{name}/tendermint/priv_validator.json && %{__chown} %{name}.%{name} %{_sysconfdir}/%{name}/tendermint/priv_validator.json test ! -f %{_sysconfdir}/%{name}/tendermint/priv_validator.json && tendermint gen_validator > %{_sysconfdir}/%{name}/tendermint/priv_validator.json && %{__chmod} 0400 %{_sysconfdir}/%{name}/tendermint/priv_validator.json && %{__chown} %{name}.%{name} %{_sysconfdir}/%{name}/tendermint/priv_validator.json
tendermint_pubkey=`%{__python} -uc "import json ; print json.loads(open('%{_sysconfdir}/%{name}/tendermint/priv_validator.json').read())['pub_key']['data']"`
tendermint_pubkey="`tendermint show_validator --home %{_sysconfdir}/%{name}/tendermint --log_level error`"
test ! -f %{_sysconfdir}/%{name}/tendermint/genesis.json && %{__cat} << EOF > %{_sysconfdir}/%{name}/tendermint/genesis.json test ! -f %{_sysconfdir}/%{name}/tendermint/genesis.json && %{__cat} << EOF > %{_sysconfdir}/%{name}/tendermint/genesis.json
{ {
"genesis_time": "2017-06-10T03:37:03Z", "genesis_time": "2017-06-10T03:37:03Z",
@ -57,7 +56,7 @@ test ! -f %{_sysconfdir}/%{name}/tendermint/genesis.json && %{__cat} << EOF > %{
"validators": "validators":
[ [
{ {
"pub_key":{"type":"ed25519","data":"$tendermint_pubkey"},
"pub_key": $tendermint_pubkey,
"amount":10, "amount":10,
"name":"my_testchain_node" "name":"my_testchain_node"
} }


Loading…
Cancel
Save