Browse Source

Merge pull request #60 from tendermint/feature/jenkins

Feature/jenkins
pull/1943/head
Anton Kaliaev 7 years ago
committed by GitHub
parent
commit
a754009f6b
64 changed files with 1519 additions and 238 deletions
  1. +4
    -1
      ansible/app_options_files/dev_money
  2. +100
    -42
      ansible/app_options_files/public_testnet
  3. +4
    -0
      ansible/app_options_files/relay
  4. +8
    -0
      ansible/getconfigtoml.yml
  5. +8
    -0
      ansible/getfile.yml
  6. +1
    -1
      ansible/install.yml
  7. +8
    -0
      ansible/jsonconfig.yml
  8. +2
    -3
      ansible/roles/config/defaults/main.yml
  9. +18
    -26
      ansible/roles/config/tasks/main.yml
  10. +21
    -1
      ansible/roles/config/templates/config.toml.j2
  11. +1
    -1
      ansible/roles/config/templates/genesis-server.json.j2
  12. +46
    -0
      ansible/roles/config/templates/genesis.json.j2
  13. +1
    -4
      ansible/roles/generic-service/tasks/main.yml
  14. +6
    -0
      ansible/roles/getconfigtoml/tasks/main.yml
  15. +6
    -0
      ansible/roles/getfile/tasks/main.yml
  16. +1
    -0
      ansible/roles/install/defaults/main.yml
  17. +22
    -3
      ansible/roles/install/tasks/centos.yml
  18. +11
    -2
      ansible/roles/install/tasks/debian.yml
  19. +3
    -0
      ansible/roles/install/tasks/main.yml
  20. +360
    -0
      ansible/roles/jsonconfig/library/jsonconfig.py
  21. +5
    -0
      ansible/roles/jsonconfig/tasks/main.yml
  22. +27
    -0
      ansible/roles/setfile/tasks/main.yml
  23. +3
    -0
      ansible/roles/tomlconfig/defaults/main.yml
  24. +386
    -0
      ansible/roles/tomlconfig/library/tomlconfig.py
  25. +10
    -0
      ansible/roles/tomlconfig/tasks/main.yml
  26. +3
    -1
      ansible/roles/unsafe_reset/tasks/main.yml
  27. +10
    -0
      ansible/setfile.yml
  28. +8
    -0
      ansible/tomlconfig.yml
  29. +30
    -20
      build/Makefile
  30. +1
    -1
      build/basecoin/DEBIAN/control
  31. +4
    -3
      build/basecoin/etc/systemd/system/basecoin-server.service
  32. +2
    -3
      build/basecoin/etc/systemd/system/basecoin.service
  33. +6
    -0
      build/cosmos-sdk/DEBIAN/changelog
  34. +1
    -0
      build/cosmos-sdk/DEBIAN/compat
  35. +15
    -0
      build/cosmos-sdk/DEBIAN/control
  36. +21
    -0
      build/cosmos-sdk/DEBIAN/copyright
  37. +46
    -0
      build/cosmos-sdk/DEBIAN/postinst
  38. +41
    -0
      build/cosmos-sdk/DEBIAN/postrm
  39. +38
    -0
      build/cosmos-sdk/DEBIAN/preinst
  40. +39
    -0
      build/cosmos-sdk/DEBIAN/prerm
  41. +3
    -0
      build/cosmos-sdk/etc/systemd/system-preset/50-cosmos-sdk.preset
  42. +23
    -0
      build/cosmos-sdk/etc/systemd/system/cosmos-sdk-server.service
  43. +29
    -0
      build/cosmos-sdk/etc/systemd/system/cosmos-sdk.service
  44. +12
    -0
      build/cosmos-sdk/usr/share/cosmos-sdk/key.json
  45. +12
    -0
      build/cosmos-sdk/usr/share/cosmos-sdk/key2.json
  46. +1
    -1
      build/ethermint/DEBIAN/control
  47. +3
    -2
      build/ethermint/etc/systemd/system/ethermint-server.service
  48. +2
    -3
      build/ethermint/etc/systemd/system/ethermint.service
  49. +1
    -1
      build/gaia/DEBIAN/control
  50. +4
    -3
      build/gaia/etc/systemd/system/gaia-server.service
  51. +2
    -3
      build/gaia/etc/systemd/system/gaia.service
  52. +36
    -0
      build/generate-spec
  53. +11
    -14
      build/spectemplates/app-template.spec
  54. +5
    -0
      build/spectemplates/basecoin.data
  55. +0
    -67
      build/spectemplates/basecoin.spec
  56. +5
    -0
      build/spectemplates/cosmos-sdk.data
  57. +5
    -0
      build/spectemplates/ethermint.data
  58. +11
    -12
      build/spectemplates/ethermint.spec
  59. +5
    -0
      build/spectemplates/gaia.data
  60. +5
    -0
      build/spectemplates/trackomatron.data
  61. +10
    -13
      build/spectemplates/trackomatron.spec
  62. +1
    -1
      build/trackomatron/DEBIAN/control
  63. +4
    -3
      build/trackomatron/etc/systemd/system/trackomatron-server.service
  64. +2
    -3
      build/trackomatron/etc/systemd/system/trackomatron.service

+ 4
- 1
ansible/app_options_files/dev_money View File

@ -9,5 +9,8 @@
"amount": 9007199254740992
}
]
}]
}],
"plugin_options": [
"coin/issuer", {"app": "sigs", "addr": "1B1BE55F969F54064628A63B9559E7C21C925165"}
]

+ 100
- 42
ansible/app_options_files/public_testnet View File

@ -13,6 +13,24 @@
}
]
},
{
"name": "greg",
"address": "B01C264BFE9CBD45458256E613A6F07061A3A6B6",
"pub_key": {
"type": "ed25519",
"data": "E1FFBD187FA2A922CE1B367532CEAC1AD8E606D576AB0D2E2CAA7EC6B7DAC10F"
},
"coins": [
{
"denom": "buckyball",
"amount": 9007199254740991
},
{
"denom": "gregcoin",
"amount": 1000
}
]
},
{
"name": "anton",
"address": "40CC622438D3E42148A1FFD3A27C07C100F8FA3D",
@ -22,30 +40,26 @@
},
"coins": [
{
"denom": "anton",
"denom": "buckyball",
"amount": 9007199254740992
},
{
"denom": "tank",
"amount": 99
"denom": "antoncoin",
"amount": 1000
}
]
},
{
"name": "adrian",
"address": "98F28277FA8C512968BBDE443F5DB27AC743F814",
"pub_key": {
"type": "ed25519",
"data": "2E7EAB9E4C93D3657A63E063D6ABB851596BA97ED9F4EB9A2FC714043DC9685D"
},
"address": "0FA1DB09E8B174E81E94280C047C158D4271457B",
"coins": [
{
"denom": "axi",
"denom": "buckyball",
"amount": 1928936473812
},
{
"denom": "bear",
"amount": 42
"denom": "adriancoin",
"amount": 1000
}
]
},
@ -62,16 +76,8 @@
"amount": 20000000000
},
{
"denom": "bumblebee",
"amount": 100
},
{
"denom": "french",
"amount": 10
},
{
"denom": "frey",
"amount": 4838271727204
"denom": "buckycoin",
"amount": 1000
}
]
},
@ -84,53 +90,105 @@
},
"coins": [
{
"denom": "radio",
"amount": 50
"denom": "rigelcoin",
"amount": 1000
},
{
"denom": "tv",
"denom": "buckyball",
"amount": 3478765434568
}
]
},
{
"name": "gregkey",
"address": "B01C264BFE9CBD45458256E613A6F07061A3A6B6",
"pubkey": {
"name": "shadow",
"address": "B140EFAAE6D5CA1C8E98814C557AF7112E3B9EAE",
"pub_key": {
"type": "ed25519",
"data": "E1FFBD187FA2A922CE1B367532CEAC1AD8E606D576AB0D2E2CAA7EC6B7DAC10F"
"data": "F492282705DF29ACC3BB803D543B7BF98C8080FA28AE85B62B45827EA9DA8167"
},
"coins": [
{
"denom": "mycoin",
"amount": 3478765434568
"denom": "buckyball",
"amount": 53712836452781
},
{
"denom": "shadowcoin",
"amount": 1000
}
]
},
{
"name": "peng",
"address": "7B8422A210D0F0B8734908C093ECF0E9A768BDB8",
"coins": [
{
"denom": "buckyball",
"amount": 53712836452781
},
{
"denom": "pengcoin",
"amount": 1000
}
]
},
{
"name": "matt",
"address": "C2104A8191E282AA45D210BA93282B36768EDDA1",
"coins": [
{
"denom": "buckyball",
"amount": 8367251830291
"amount": 53712836452781
},
{
"denom": "playmoney",
"amount": 9999999999999
"denom": "mattcoin",
"amount": 1000
}
]
},
{
"name": "shadow",
"address": "B140EFAAE6D5CA1C8E98814C557AF7112E3B9EAE",
"pub_key": {
"type": "ed25519",
"data": "F492282705DF29ACC3BB803D543B7BF98C8080FA28AE85B62B45827EA9DA8167"
},
"name": "frey",
"address": "0F8FB94B5A4D04220F15058B7AA16AF1328B57A9",
"coins": [
{
"denom": "shadow",
"denom": "buckyball",
"amount": 53712836452781
},
{
"denom": "freycoin",
"amount": 1000
}
]
},
{
"name": "wancloud",
"address": "117FE408E1F74C453901BCB638F996964FD29CBB",
"coins": [
{
"denom": "buckyball",
"amount": 53712836452781
},
{
"denom": "wancloudcoin",
"amount": 1000
}
]
},
{
"name": "bianjie",
"address": "F63F2D34C03430A54B7F6A43C886B4A83F366B84",
"coins": [
{
"denom": "buckyball",
"amount": 53712836452781
},
{
"denom": "unit",
"amount": 1
"denom": "bianjiecoin",
"amount": 1000
}
]
}
],
"plugin_options": [
"coin/issuer", {"app": "sigs", "addr": "B01C264BFE9CBD45458256E613A6F07061A3A6B6"}
]

+ 4
- 0
ansible/app_options_files/relay View File

@ -13,4 +13,8 @@
}
]
}
],
"plugin_options": [
"coin/issuer", {"app": "sigs", "addr": "1B1BE55F969F54064628A63B9559E7C21C925165"}
]

+ 8
- 0
ansible/getconfigtoml.yml View File

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

+ 8
- 0
ansible/getfile.yml View File

@ -0,0 +1,8 @@
---
#variable "source" is required
- hosts: "{{ lookup('env','TF_VAR_TESTNET_NAME') }}:tag_Environment_{{ lookup('env','TF_VAR_TESTNET_NAME') | regex_replace('-','_') }}"
roles:
- getfile

+ 1
- 1
ansible/install.yml View File

@ -7,6 +7,6 @@
roles:
- install
- {role: generic-service, when: service == 'tendermint'}
- {role: config, testnet_name: "{{lookup('env','TF_VAR_TESTNET_NAME')}}"}
- {role: config, testnet_name: "{{lookup('env','TF_VAR_TESTNET_NAME')}}", tags: reconfig }
- start

+ 8
- 0
ansible/jsonconfig.yml View File

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

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

@ -1,7 +1,6 @@
---
#tendermint_genesis_file: "<undefined>"
#service_genesis_file: "<undefined>"
app_options_file: "app_options_files/dev_money"
#genesis_file: "<undefined>"
app_options_file: "app_options_files/public_testnet"
seeds: ""
testnet_name: testnet1
validators: true


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

@ -2,64 +2,56 @@
- name: gather tendermint public keys
when: (validators == true or validators == 'true') and tendermint_genesis_file is not defined
command: "/usr/bin/tendermint show_validator --home /etc/{{service}}/tendermint --log_level error"
tags: reconfig-toml,reconfig-genesis
command: "/usr/bin/tendermint show_validator --home /etc/{{service}} --log_level error"
register: pubkeys
changed_when: false
- name: resetting permissions from root after gathering public keys
file: "path=/etc/{{service}}/tendermint owner={{service}} group={{service}} recurse=yes"
tags: reconfig-toml,reconfig-genesis
file: "path=/etc/{{service}} owner={{service}} group={{service}} recurse=yes"
- name: register tendermint public keys as host facts
when: (validators == true or validators == 'true') and tendermint_genesis_file is not defined
tags: reconfig-toml,reconfig-genesis
set_fact: "pubkey='{{pubkeys.stdout}}'"
connection: local
- name: copy generated tendermint genesis.json - genesis_time will be updated
when: (validators == true or validators == 'true') and tendermint_genesis_file is not defined
template:
src: genesis-server.json.j2
dest: "/etc/{{service}}/tendermint/genesis.json"
owner: "{{service}}"
group: "{{service}}"
- name: copy generated service genesis.json - genesis_time will be updated
when: (validators == true or validators == 'true') and (service_genesis_file is not defined) and (service != 'ethermint')
- name: copy generated genesis.json - genesis_time will be updated
when: (validators == true or validators == 'true') and (genesis_file is not defined)
tags: reconfig-genesis
template:
src: genesis-service.json.j2
src: genesis.json.j2
dest: "/etc/{{service}}/genesis.json"
owner: "{{service}}"
group: "{{service}}"
- name: copy pre-created tendermint genesis.json
when: tendermint_genesis_file is defined
copy: "src={{tendermint_genesis_file}} dest=/etc/{{service}}/tendermint/genesis.json owner={{service}} group={{service}}"
- name: copy pre-created service genesis.json
when: service_genesis_file is defined
copy: "src={{service_genesis_file}} dest=/etc/{{service}}/genesis.json owner={{service}} group={{service}}"
- name: copy pre-created genesis.json
when: genesis_file is defined
copy: "src={{genesis_file}} dest=/etc/{{service}}/genesis.json owner={{service}} group={{service}}"
- name: copy tendermint config.toml
tags: reconfig
tags: reconfig-toml
when: validators == true or validators == 'true'
template:
src: config.toml.j2
dest: "/etc/{{service}}/tendermint/config.toml"
dest: "/etc/{{service}}/config.toml"
owner: "{{service}}"
group: "{{service}}"
- name: Copy validator network files for non-validators
when: validators == false or validators == 'false'
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}}/tendermint/genesis.json" , dst: "/etc/{{service}}/tendermint/genesis.json" }
- { src: "https://raw.githubusercontent.com/tendermint/testnets/master/{{validator_network}}/tendermint/config.toml" , dst: "/etc/{{service}}/tendermint/config.toml" }
- { src: "https://raw.githubusercontent.com/tendermint/testnets/master/{{validator_network}}/config.toml" , dst: "/etc/{{service}}/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}}/tendermint/genesis.json"
- "/etc/{{service}}/tendermint/config.toml"
- "/etc/{{service}}/config.toml"

+ 21
- 1
ansible/roles/config/templates/config.toml.j2 View File

@ -4,13 +4,23 @@
proxy_app = "tcp://127.0.0.1:46658"
moniker = "{{inventory_hostname}}"
fast_sync = true
{% if service == 'tendermint' %}
db_backend = "memdb"
#log_level = "mempool:error,*:debug"
log_level = "mempool:error,*:debug"
{% else %}
db_backend = "leveldb"
log_level = "state:info,*:error"
{% endif %}
[rpc]
laddr = "tcp://0.0.0.0:46657"
{% if service == 'tendermint' %}
[mempool]
recheck = false
broadcast = false
@ -24,11 +34,21 @@ skip_timeout_commit = true
timeout_commit = 1
wal_light = true
block_part_size = 262144
create_empty_blocks_interval = 1
{% else %}
[consensus]
create_empty_blocks_interval = 1
{% endif %}
[p2p]
{% if service == 'tendermint' %}
max_msg_packet_payload_size=65536
send_rate=51200000 # 50 MB/s
recv_rate=51200000 # 50 MB/s
{% endif %}
laddr = "tcp://0.0.0.0:46656"
{% 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 %}"


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

@ -12,7 +12,7 @@
"data": "{{hostvars[host]["pubkey"]["data"]}}",
"type": "{{hostvars[host]["pubkey"]["type"]}}"
},
"amount":10,
"power":10,
"name":"{{hostvars[host]["inventory_hostname"]}}"
}
{% endfor %}


+ 46
- 0
ansible/roles/config/templates/genesis.json.j2 View File

@ -0,0 +1,46 @@
{
"genesis_time":"{{ansible_date_time.iso8601}}",
"chain_id":"{{testnet_name}}",
"validators":
[
{% if (validators == true) or (validators == 'true') %}
{% set comma = joiner(",") %}
{% for host in (groups[testnet_name]|default([]))+(groups['tag_Environment_'~(testnet_name|regex_replace('-','_'))]|default([])) %}
{{ comma() }}
{
"pub_key": {
"data": "{{hostvars[host]["pubkey"]["data"]}}",
"type": "{{hostvars[host]["pubkey"]["type"]}}"
},
"power":10,
"name":"{{hostvars[host]["inventory_hostname"]}}"
}
{% endfor %}
{% endif %}
],
"app_hash":"",
"app_options": {
{% if app_options_file is defined %}
{% include app_options_file %}
{% endif %}
}
{% if service == 'ethermint' %}
,
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0xdeadbeefdeadbeef",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x40",
"gasLimit": "0x8000000",
"alloc": {
"0x7eff122b94897ea5b0e2a9abf47b86337fafebdc": { "balance": "10000000000000000000000000000000000" },
"0xc6713982649D9284ff56c32655a9ECcCDA78422A": { "balance": "10000000000000000000000000000000000" }
}
{% endif %}
}

+ 1
- 4
ansible/roles/generic-service/tasks/main.yml View File

@ -15,11 +15,8 @@
- name: Reload systemd services
systemd: "name={{service}} daemon_reload=yes enabled=no"
- name: Create tendermint directory
file: "path=/etc/{{service}}/tendermint state=directory mode=0755 owner={{service}} group={{service}}"
- name: Initialize tendermint
command: "/usr/bin/tendermint init --home /etc/{{service}}/tendermint"
command: "/usr/bin/tendermint init --home /etc/{{service}}"
become: yes
become_user: "{{service}}"

+ 6
- 0
ansible/roles/getconfigtoml/tasks/main.yml View File

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

+ 6
- 0
ansible/roles/getfile/tasks/main.yml View File

@ -0,0 +1,6 @@
---
- name: Get file from node
fetch: "dest={{ destination | default('.') }}/{{ source | basename }} flat=yes src='{{source}}'"
run_once: yes

+ 1
- 0
ansible/roles/install/defaults/main.yml View File

@ -1,4 +1,5 @@
---
release_install: true
binary: "{{ lookup('env','GOPATH') | default('') }}/bin/{{service}}"
devops_path: false

+ 22
- 3
ansible/roles/install/tasks/centos.yml View File

@ -13,7 +13,7 @@
#Workaround
- name: Download repository key for CentOS/RedHat
when: ansible_os_family == "RedHat"
get_url: "url=https://tendermint-packages.interblock.io/centos/7/os/x86_64/RPM-GPG-KEY-Tendermint dest=/root/RPM-GPG-KEY-Tendermint force=yes checksum=sha256:a8c61d4061697d2595562c703dbafbdfdcfa7f0c75a523ac84d5609d1b444abe"
get_url: "url=https://tendermint-packages.interblock.io/{{ (devops_path | default(false) | bool) | ternary('devops/','') }}centos/7/os/x86_64/RPM-GPG-KEY-Tendermint dest=/root/RPM-GPG-KEY-Tendermint force=yes checksum=sha256:a8c61d4061697d2595562c703dbafbdfdcfa7f0c75a523ac84d5609d1b444abe"
- name: Import repository key for CentOS/RedHat
when: ansible_os_family == "RedHat"
command: "rpm --import /root/RPM-GPG-KEY-Tendermint"
@ -22,13 +22,32 @@
when: ansible_os_family == "RedHat"
yum_repository:
name: tendermint
baseurl: https://tendermint-packages.interblock.io/centos/7/os/x86_64
baseurl: https://tendermint-packages.interblock.io/{{ (devops_path | default(false) | bool) | ternary('devops/','') }}centos/7/os/x86_64
description: "Tendermint repo"
gpgcheck: yes
gpgkey: https://tendermint-packages.interblock.io/centos/7/os/x86_64/RPM-GPG-KEY-Tendermint
gpgkey: https://tendermint-packages.interblock.io/{{ (devops_path | default(false) | bool) | ternary('devops/','') }}centos/7/os/x86_64/RPM-GPG-KEY-Tendermint
# repo_gpgcheck: yes
- name: Install package on CentOS/RedHat
when: ansible_os_family == "RedHat"
yum: "pkg={{service}} update_cache=yes state=latest"
# The below commands are required so that the tomlconfig playbook can run.
- name: Install epel-release on CentOS/RedHat
when: ansible_os_family == "RedHat"
yum: "pkg=epel-release update_cache=yes state=latest"
- name: Install pip on CentOS/RedHat
when: ansible_os_family == "RedHat"
yum: "pkg={{item}} state=latest"
with_items:
- python2-pip
- python-virtualenv
- unzip
- tar
- name: Install toml
when: ansible_os_family == "RedHat"
pip: name=toml

+ 11
- 2
ansible/roles/install/tasks/debian.yml View File

@ -8,15 +8,24 @@
- name: Add repository key on Debian/Ubuntu
when: ansible_os_family == "Debian"
apt_key:
url: https://tendermint-packages.interblock.io/centos/7/os/x86_64/RPM-GPG-KEY-Tendermint
url: https://tendermint-packages.interblock.io/{{ (devops_path | default(false) | bool) | ternary('devops/','') }}centos/7/os/x86_64/RPM-GPG-KEY-Tendermint
id: 2122CBE9
- name: Install tendermint repository on Debian/Ubuntu
when: ansible_os_family == "Debian"
apt_repository:
repo: deb https://tendermint-packages.interblock.io/debian stable main
repo: deb https://tendermint-packages.interblock.io/{{ (devops_path | default(false) | bool) | ternary('devops/','') }}debian stable main
- name: Install package on Debian/Ubuntu
when: ansible_os_family == "Debian"
apt: "pkg={{service}} update_cache=yes state=latest"
# The below command is required to use the tomlconfig playbook.
- name: Install package on Debian/Ubuntu
when: ansible_os_family == "Debian"
apt: "pkg={{item}} state=latest"
with_items:
- python-toml
- unzip
- tar

+ 3
- 0
ansible/roles/install/tasks/main.yml View File

@ -13,6 +13,9 @@
- name: Restart journald
service: name=systemd-journald state=restarted
#TODO include is deprecated in Ansible 2.4.0 and will be removed in 2.8.0
#Replace it with include_tasks
- include: debian.yml
when: ansible_os_family == "Debian"


+ 360
- 0
ansible/roles/jsonconfig/library/jsonconfig.py View File

@ -0,0 +1,360 @@
#!/usr/bin/python
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: jsonconfig
short_description: Ensure a particular configuration is added to a json-formatted configuration file
version_added: "2.4"
description:
- This module will add configuration to a json-formatted configuration file.
options:
dest:
description:
- The file to modify.
required: true
aliases: [ name, destfile ]
json:
description:
- The configuration in json format to apply.
required: false
default: '{}'
merge:
description:
- Used with C(state=present). If specified, it will merge the configuration. Othwerwise
the configuration will be overwritten.
required: false
choices: [ "yes", "no" ]
default: "yes"
state:
description:
- Whether the configuration should be there or not.
required: false
choices: [ present, absent ]
default: "present"
create:
description:
- Used with C(state=present). If specified, the file will be created
if it does not already exist. By default it will fail if the file
is missing.
required: false
choices: [ "yes", "no" ]
default: "no"
backup:
description:
- Create a backup file including the timestamp information so you can
get the original file back if you somehow clobbered it incorrectly.
required: false
choices: [ "yes", "no" ]
default: "no"
others:
description:
- All arguments accepted by the M(file) module also work here.
required: false
extends_documentation_fragment:
- files
- validate
author:
- "Greg Szabo (@greg-szabo)"
'''
EXAMPLES = '''
# Add a new section to a json file
- name: Add comment section
jsonconfig:
dest: /etc/something.json
json: '{ "comment": { "comment1": "mycomment" } }'
# Rewrite a json file with the configuration
- name: Create or overwrite config.json
jsonconfig:
dest: /etc/config.json
json: '{ "regedit": { "freshfile": true } }'
merge: no
create: yes
'''
RETURN = '''
changed:
description: True if the configuration changed.
type: bool
msg:
description: Description of the change
type: str
'''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import b
from ansible.module_utils._text import to_bytes, to_native
import tempfile
import json
import copy
import os
def write_changes(module, b_lines, dest):
tmpfd, tmpfile = tempfile.mkstemp()
f = os.fdopen(tmpfd, 'wb')
f.writelines(b_lines)
f.close()
validate = module.params.get('validate', None)
valid = not validate
if validate:
if "%s" not in validate:
module.fail_json(msg="validate must contain %%s: %s" % (validate))
(rc, out, err) = module.run_command(to_bytes(validate % tmpfile, errors='surrogate_or_strict'))
valid = rc == 0
if rc != 0:
module.fail_json(msg='failed to validate: '
'rc:%s error:%s' % (rc, err))
if valid:
module.atomic_move(tmpfile,
to_native(os.path.realpath(to_bytes(dest, errors='surrogate_or_strict')), errors='surrogate_or_strict'),
unsafe_writes=module.params['unsafe_writes'])
def check_file_attrs(module, changed, message, diff):
file_args = module.load_file_common_arguments(module.params)
if module.set_fs_attributes_if_different(file_args, False, diff=diff):
if changed:
message += " and "
changed = True
message += "ownership, perms or SE linux context changed"
return message, changed
#Merge dict d2 into dict d1 and return a new object
def deepmerge(d1, d2):
if d1 is None:
return copy.deepcopy(d2)
if d2 is None:
return copy.deepcopy(d1)
if d1 == d2:
return copy.deepcopy(d1)
if isinstance(d1, dict) and isinstance(d2, dict):
result={}
for key in set(d1.keys()+d2.keys()):
da = db = None
if key in d1:
da = d1[key]
if key in d2:
db = d2[key]
result[key] = deepmerge(da, db)
return result
else:
return copy.deepcopy(d2)
#Remove dict d2 from dict d1 and return a new object
def deepdiff(d1, d2):
if d1 is None or d2 is None:
return None
if d1 == d2:
return None
if isinstance(d1, dict) and isinstance(d2, dict):
result = {}
for key in d1.keys():
if key in d2:
dd = deepdiff(d1[key],d2[key])
if dd is not None:
result[key] = dd
else:
result[key] = d1[key]
return result
else:
return None
def present(module, dest, conf, merge, create, backup):
diff = {'before': '',
'after': '',
'before_header': '%s (content)' % dest,
'after_header': '%s (content)' % dest}
b_dest = to_bytes(dest, errors='surrogate_or_strict')
if not os.path.exists(b_dest):
if not create:
module.fail_json(rc=257, msg='Destination %s does not exist !' % dest)
b_destpath = os.path.dirname(b_dest)
if not os.path.exists(b_destpath) and not module.check_mode:
os.makedirs(b_destpath)
b_lines = []
else:
f = open(b_dest, 'rb')
b_lines = f.readlines()
f.close()
lines = to_native(b('').join(b_lines))
if module._diff:
diff['before'] = lines
b_conf = to_bytes(conf, errors='surrogate_or_strict')
jsonconfig = json.loads(lines)
config = eval(b_conf)
if not isinstance(config, dict):
module.fail_json(msg="Invalid value in json parameter: {0}".format(config))
b_lines_new = b_lines
msg = ''
changed = False
if not merge:
if jsonconfig != config:
b_lines_new = to_bytes(json.dumps(config, sort_keys=True, indent=4, separators=(',', ': ')))
msg = 'config overwritten'
changed = True
else:
mergedconfig = deepmerge(jsonconfig,config)
if jsonconfig != mergedconfig:
b_lines_new = to_bytes(json.dumps(mergedconfig, sort_keys=True, indent=4, separators=(',', ': ')))
msg = 'config merged'
changed = True
if module._diff:
diff['after'] = to_native(b('').join(b_lines_new))
backupdest = ""
if changed and not module.check_mode:
if backup and os.path.exists(b_dest):
backupdest = module.backup_local(dest)
write_changes(module, b_lines_new, dest)
if module.check_mode and not os.path.exists(b_dest):
module.exit_json(changed=changed, msg=msg, backup=backupdest, diff=diff)
attr_diff = {}
msg, changed = check_file_attrs(module, changed, msg, attr_diff)
attr_diff['before_header'] = '%s (file attributes)' % dest
attr_diff['after_header'] = '%s (file attributes)' % dest
difflist = [diff, attr_diff]
module.exit_json(changed=changed, msg=msg, backup=backupdest, diff=difflist)
def absent(module, dest, conf, backup):
b_dest = to_bytes(dest, errors='surrogate_or_strict')
if not os.path.exists(b_dest):
module.exit_json(changed=False, msg="file not present")
msg = ''
diff = {'before': '',
'after': '',
'before_header': '%s (content)' % dest,
'after_header': '%s (content)' % dest}
f = open(b_dest, 'rb')
b_lines = f.readlines()
f.close()
lines = to_native(b('').join(b_lines))
b_conf = to_bytes(conf, errors='surrogate_or_strict')
lines = to_native(b('').join(b_lines))
jsonconfig = json.loads(lines)
config = eval(b_conf)
if not isinstance(config, dict):
module.fail_json(msg="Invalid value in json parameter: {0}".format(config))
if module._diff:
diff['before'] = to_native(b('').join(b_lines))
b_lines_new = b_lines
msg = ''
changed = False
diffconfig = deepdiff(jsonconfig,config)
if diffconfig is None:
diffconfig = {}
if jsonconfig != diffconfig:
b_lines_new = to_bytes(json.dumps(diffconfig, sort_keys=True, indent=4, separators=(',', ': ')))
msg = 'config removed'
changed = True
if module._diff:
diff['after'] = to_native(b('').join(b_lines_new))
backupdest = ""
if changed and not module.check_mode:
if backup:
backupdest = module.backup_local(dest)
write_changes(module, b_lines_new, dest)
attr_diff = {}
msg, changed = check_file_attrs(module, changed, msg, attr_diff)
attr_diff['before_header'] = '%s (file attributes)' % dest
attr_diff['after_header'] = '%s (file attributes)' % dest
difflist = [diff, attr_diff]
module.exit_json(changed=changed, msg=msg, backup=backupdest, diff=difflist)
def main():
# define the available arguments/parameters that a user can pass to
# the module
module_args = dict(
dest=dict(type='str', required=True),
json=dict(default=None, required=True),
merge=dict(type='bool', default=True),
state=dict(default='present', choices=['absent', 'present']),
create=dict(type='bool', default=False),
backup=dict(type='bool', default=False),
validate=dict(default=None, type='str')
)
# the AnsibleModule object will be our abstraction working with Ansible
# this includes instantiation, a couple of common attr would be the
# args/params passed to the execution, as well as if the module
# supports check mode
module = AnsibleModule(
argument_spec=module_args,
add_file_common_args=True,
supports_check_mode=True
)
params = module.params
create = params['create']
merge = params['merge']
backup = params['backup']
dest = params['dest']
b_dest = to_bytes(dest, errors='surrogate_or_strict')
if os.path.isdir(b_dest):
module.fail_json(rc=256, msg='Destination %s is a directory !' % dest)
conf = params['json']
if params['state'] == 'present':
present(module, dest, conf, merge, create, backup)
else:
absent(module, dest, conf, backup)
if __name__ == '__main__':
main()

+ 5
- 0
ansible/roles/jsonconfig/tasks/main.yml View File

@ -0,0 +1,5 @@
---
- name: Update
jsonconfig: "dest='{{destination}}' json='{{jsonconfig}}' state={{(remove | default(false) | bool) | ternary('absent','present')}}"

+ 27
- 0
ansible/roles/setfile/tasks/main.yml View File

@ -0,0 +1,27 @@
---
- name: Download file if necessary
when: source | regex_search('^https?://')
get_url: "url={{source}} dest={{localdir}}/{{source | basename | regex_replace('\\?.*$','')}}"
register: downloaded
connection: local
run_once: yes
become: no
- name: Figure out file source
set_fact:
compiledsource: "{{ (downloaded.skipped is defined) | ternary(source, downloaded.dest) }}"
connection: local
become: no
- name: Extract file to destination
when: compiledsource | regex_search('\\.(zip|tar|tar\\.gz|tgz|tb2|tbz|tbz2|tar\\.bz2|txz|tar\\.xz)$')
register: extractcopy
unarchive:
src: "{{compiledsource}}"
dest: "{{destination}}"
- name: Copy non-zipped file to destination
when: extractcopy.skipped is defined
copy: "src='{{compiledsource}}' dest='{{destination}}'"

+ 3
- 0
ansible/roles/tomlconfig/defaults/main.yml View File

@ -0,0 +1,3 @@
---
destination: /etc/{{service}}/config.toml

+ 386
- 0
ansible/roles/tomlconfig/library/tomlconfig.py View File

@ -0,0 +1,386 @@
#!/usr/bin/python
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: tomlconfig
short_description: Ensure a particular configuration is added to a toml-formatted configuration file
version_added: "2.4"
description:
- This module will add configuration to a toml-formatted configuration file.
options:
dest:
description:
- The file to modify.
required: true
aliases: [ name, destfile ]
json:
description:
- The configuration in json format to apply. Either C(json) or C(toml) has to be present.
required: false
default: '{}'
toml:
description:
- The configuration in toml format to apply. Either C(json) or C(toml) has to be present.
default: ''
merge:
description:
- Used with C(state=present). If specified, it will merge the configuration. Othwerwise
the configuration will be overwritten.
required: false
choices: [ "yes", "no" ]
default: "yes"
state:
description:
- Whether the configuration should be there or not.
required: false
choices: [ present, absent ]
default: "present"
create:
description:
- Used with C(state=present). If specified, the file will be created
if it does not already exist. By default it will fail if the file
is missing.
required: false
choices: [ "yes", "no" ]
default: "no"
backup:
description:
- Create a backup file including the timestamp information so you can
get the original file back if you somehow clobbered it incorrectly.
required: false
choices: [ "yes", "no" ]
default: "no"
others:
description:
- All arguments accepted by the M(file) module also work here.
required: false
extends_documentation_fragment:
- files
- validate
author:
- "Greg Szabo (@greg-szabo)"
'''
EXAMPLES = '''
# Add a new section to a toml file
- name: Add comment section
tomlconfig:
dest: /etc/config.toml
json: '{ "comment": { "comment1": "mycomment" } }'
# Rewrite a toml file with the configuration
- name: Create or overwrite config.toml
tomlconfig:
dest: /etc/config.toml
json: '{ "regedit": { "freshfile": true } }'
merge: no
create: yes
'''
RETURN = '''
changed:
description: True if the configuration changed.
type: bool
msg:
description: Description of the change
type: str
'''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import b
from ansible.module_utils._text import to_bytes, to_native
import tempfile
import toml as pytoml
import json
import copy
import os
def write_changes(module, b_lines, dest):
tmpfd, tmpfile = tempfile.mkstemp()
f = os.fdopen(tmpfd, 'wb')
f.writelines(b_lines)
f.close()
validate = module.params.get('validate', None)
valid = not validate
if validate:
if "%s" not in validate:
module.fail_json(msg="validate must contain %%s: %s" % (validate))
(rc, out, err) = module.run_command(to_bytes(validate % tmpfile, errors='surrogate_or_strict'))
valid = rc == 0
if rc != 0:
module.fail_json(msg='failed to validate: '
'rc:%s error:%s' % (rc, err))
if valid:
module.atomic_move(tmpfile,
to_native(os.path.realpath(to_bytes(dest, errors='surrogate_or_strict')), errors='surrogate_or_strict'),
unsafe_writes=module.params['unsafe_writes'])
def check_file_attrs(module, changed, message, diff):
file_args = module.load_file_common_arguments(module.params)
if module.set_fs_attributes_if_different(file_args, False, diff=diff):
if changed:
message += " and "
changed = True
message += "ownership, perms or SE linux context changed"
return message, changed
#Merge dict d2 into dict d1 and return a new object
def deepmerge(d1, d2):
if d1 is None:
return copy.deepcopy(d2)
if d2 is None:
return copy.deepcopy(d1)
if d1 == d2:
return copy.deepcopy(d1)
if isinstance(d1, dict) and isinstance(d2, dict):
result={}
for key in set(d1.keys()+d2.keys()):
da = db = None
if key in d1:
da = d1[key]
if key in d2:
db = d2[key]
result[key] = deepmerge(da, db)
return result
else:
return copy.deepcopy(d2)
#Remove dict d2 from dict d1 and return a new object
def deepdiff(d1, d2):
if d1 is None or d2 is None:
return None
if d1 == d2:
return None
if isinstance(d1, dict) and isinstance(d2, dict):
result = {}
for key in d1.keys():
if key in d2:
dd = deepdiff(d1[key],d2[key])
if dd is not None:
result[key] = dd
else:
result[key] = d1[key]
return result
else:
return None
def present(module, dest, conf, jsonbool, merge, create, backup):
diff = {'before': '',
'after': '',
'before_header': '%s (content)' % dest,
'after_header': '%s (content)' % dest}
b_dest = to_bytes(dest, errors='surrogate_or_strict')
if not os.path.exists(b_dest):
if not create:
module.fail_json(rc=257, msg='Destination %s does not exist !' % dest)
b_destpath = os.path.dirname(b_dest)
if not os.path.exists(b_destpath) and not module.check_mode:
os.makedirs(b_destpath)
b_lines = []
else:
f = open(b_dest, 'rb')
b_lines = f.readlines()
f.close()
lines = to_native(b('').join(b_lines))
if module._diff:
diff['before'] = lines
b_conf = to_bytes(conf, errors='surrogate_or_strict')
tomlconfig = pytoml.loads(lines)
config = {}
if jsonbool:
config = eval(b_conf)
else:
config = pytoml.loads(b_conf)
if not isinstance(config, dict):
if jsonbool:
module.fail_json(msg="Invalid value in json parameter: {0}".format(config))
else:
module.fail_json(msg="Invalid value in toml parameter: {0}".format(config))
b_lines_new = b_lines
msg = ''
changed = False
if not merge:
if tomlconfig != config:
b_lines_new = to_bytes(pytoml.dumps(config))
msg = 'config overwritten'
changed = True
else:
mergedconfig = deepmerge(tomlconfig,config)
if tomlconfig != mergedconfig:
b_lines_new = to_bytes(pytoml.dumps(mergedconfig))
msg = 'config merged'
changed = True
if module._diff:
diff['after'] = to_native(b('').join(b_lines_new))
backupdest = ""
if changed and not module.check_mode:
if backup and os.path.exists(b_dest):
backupdest = module.backup_local(dest)
write_changes(module, b_lines_new, dest)
if module.check_mode and not os.path.exists(b_dest):
module.exit_json(changed=changed, msg=msg, backup=backupdest, diff=diff)
attr_diff = {}
msg, changed = check_file_attrs(module, changed, msg, attr_diff)
attr_diff['before_header'] = '%s (file attributes)' % dest
attr_diff['after_header'] = '%s (file attributes)' % dest
difflist = [diff, attr_diff]
module.exit_json(changed=changed, msg=msg, backup=backupdest, diff=difflist)
def absent(module, dest, conf, jsonbool, backup):
b_dest = to_bytes(dest, errors='surrogate_or_strict')
if not os.path.exists(b_dest):
module.exit_json(changed=False, msg="file not present")
msg = ''
diff = {'before': '',
'after': '',
'before_header': '%s (content)' % dest,
'after_header': '%s (content)' % dest}
f = open(b_dest, 'rb')
b_lines = f.readlines()
f.close()
lines = to_native(b('').join(b_lines))
b_conf = to_bytes(conf, errors='surrogate_or_strict')
lines = to_native(b('').join(b_lines))
tomlconfig = pytoml.loads(lines)
config = {}
if jsonbool:
config = eval(b_conf)
else:
config = pytoml.loads(b_conf)
if not isinstance(config, dict):
if jsonbool:
module.fail_json(msg="Invalid value in json parameter: {0}".format(config))
else:
module.fail_json(msg="Invalid value in toml parameter: {0}".format(config))
if module._diff:
diff['before'] = to_native(b('').join(b_lines))
b_lines_new = b_lines
msg = ''
changed = False
diffconfig = deepdiff(tomlconfig,config)
if diffconfig is None:
diffconfig = {}
if tomlconfig != diffconfig:
b_lines_new = to_bytes(pytoml.dumps(diffconfig))
msg = 'config removed'
changed = True
if module._diff:
diff['after'] = to_native(b('').join(b_lines_new))
backupdest = ""
if changed and not module.check_mode:
if backup:
backupdest = module.backup_local(dest)
write_changes(module, b_lines_new, dest)
attr_diff = {}
msg, changed = check_file_attrs(module, changed, msg, attr_diff)
attr_diff['before_header'] = '%s (file attributes)' % dest
attr_diff['after_header'] = '%s (file attributes)' % dest
difflist = [diff, attr_diff]
module.exit_json(changed=changed, msg=msg, backup=backupdest, diff=difflist)
def main():
# define the available arguments/parameters that a user can pass to
# the module
module_args = dict(
dest=dict(type='str', required=True),
json=dict(default=None),
toml=dict(default=None),
merge=dict(type='bool', default=True),
state=dict(default='present', choices=['absent', 'present']),
create=dict(type='bool', default=False),
backup=dict(type='bool', default=False),
validate=dict(default=None, type='str')
)
# the AnsibleModule object will be our abstraction working with Ansible
# this includes instantiation, a couple of common attr would be the
# args/params passed to the execution, as well as if the module
# supports check mode
module = AnsibleModule(
argument_spec=module_args,
mutually_exclusive=[['json', 'toml']],
add_file_common_args=True,
supports_check_mode=True
)
params = module.params
create = params['create']
merge = params['merge']
backup = params['backup']
dest = params['dest']
b_dest = to_bytes(dest, errors='surrogate_or_strict')
if os.path.isdir(b_dest):
module.fail_json(rc=256, msg='Destination %s is a directory !' % dest)
par_json, par_toml, jsonbool = params['json'], params['toml'], False
if par_json is None:
conf = par_toml
else:
conf = par_json
jsonbool = True
if params['state'] == 'present':
present(module, dest, conf, jsonbool, merge, create, backup)
else:
absent(module, dest, conf, jsonbool, backup)
if __name__ == '__main__':
main()

+ 10
- 0
ansible/roles/tomlconfig/tasks/main.yml View File

@ -0,0 +1,10 @@
---
- name: Update config.toml with json
when: jsonconfig is defined
tomlconfig: "dest='{{destination}}' json='{{jsonconfig}}' state={{(remove | default(false) | bool) | ternary('absent','present')}}"
- name: Update config.toml with toml
when: tomlconfig is defined
tomlconfig: "dest='{{destination}}' toml='{{tomlconfig}}' state={{(remove | default(false) | bool) | ternary('absent','present')}}"

+ 3
- 1
ansible/roles/unsafe_reset/tasks/main.yml View File

@ -6,6 +6,8 @@
when: "service == 'basecoin'"
become_user: basecoin
- shell: "export TMHOME=/etc/{{service}}/tendermint ; tendermint unsafe_reset_all"
- shell: "export TMHOME=/etc/{{service}} ; tendermint unsafe_reset_all"
become_user: "{{service}}"
- file: "path=/etc/{{service}}/data state=absent"

+ 10
- 0
ansible/setfile.yml View File

@ -0,0 +1,10 @@
---
#variable "source" is required
#variable "destination" is required
- hosts: "{{ lookup('env','TF_VAR_TESTNET_NAME') }}:tag_Environment_{{ lookup('env','TF_VAR_TESTNET_NAME') | regex_replace('-','_') }}"
gather_facts: no
roles:
- setfile

+ 8
- 0
ansible/tomlconfig.yml View File

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

+ 30
- 20
build/Makefile View File

@ -60,12 +60,12 @@ build-tendermint: git-branch
cp $(GOPATH)/src/github.com/tendermint/tendermint/build/tendermint $(GOPATH)/bin
@echo "*** Built tendermint"
build-basecoin: git-branch
@echo "*** Building basecoin"
go get -d -u github.com/tendermint/basecoin/cmd/basecoin
cd $(GOPATH)/src/github.com/tendermint/basecoin && git checkout "$(GIT_BRANCH)" && git pull
$(MAKE) -C $(GOPATH)/src/github.com/tendermint/basecoin get_vendor_deps install
@echo "*** Built basecoin"
#build-basecoin: git-branch
# @echo "*** Building basecoin-old"
# go get -d -u github.com/tendermint/basecoin/cmd/basecoin
# cd $(GOPATH)/src/github.com/tendermint/basecoin && git checkout "$(GIT_BRANCH)" && git pull
# $(MAKE) -C $(GOPATH)/src/github.com/tendermint/basecoin get_vendor_deps install
# @echo "*** Built basecoin"
build-ethermint: git-branch
@echo "*** Building ethermint"
@ -77,7 +77,7 @@ build-ethermint: git-branch
build-trackomatron: git-branch
@echo "*** Building trackomatron"
go get -d -u go github.com/tendermint/trackomatron/cmd/tracko
go get -d -u github.com/tendermint/trackomatron/cmd/tracko
cd $(GOPATH)/src/github.com/tendermint/trackomatron && git checkout "$(GIT_BRANCH)" && git pull
$(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
@ -90,6 +90,13 @@ build-gaia: git-branch
$(MAKE) -C $(GOPATH)/src/github.com/cosmos/gaia get_vendor_deps install
@echo "*** Built gaia"
build-basecoin: git-branch
@echo "*** Building basecoin from cosmos-sdk"
go get -d -u go github.com/cosmos/cosmos-sdk || echo "Workaround for go downloads."
cd $(GOPATH)/src/github.com/cosmos/cosmos-sdk && git checkout "$(GIT_BRANCH)" && git pull
$(MAKE) -C $(GOPATH)/src/github.com/cosmos/cosmos-sdk get_vendor_deps install
@echo "*** Built basecoin from cosmos-sdk"
###
# Prepare package files
###
@ -97,7 +104,7 @@ build-gaia: git-branch
# set app_version
version-%: $(GOPATH)/bin/%
if [ -z "$(BUILD_NUMBER)" ]; then echo "BUILD_NUMBER not set" ; false ; fi
$(eval $*_version=$(shell $< version | cut -d- -f1 ))
$(eval $*_version=$(shell $< version | head -1 | cut -d- -f1 | sed 's/^\(ethermint:\s*\|\)\(v\|\)//' ))
# set build_folder
folder-%: version-%
@ -111,12 +118,12 @@ prepare-files = rm -rf $(build_folder) && mkdir -p $(build_folder) && cp -r ./$(
##
prepare-tendermint =
prepare-basecoin = cp $(GOPATH)/bin/basecli $(build_folder)/usr/bin
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-gaia = cp $(GOPATH)/bin/gaiacli $(build_folder)/usr/bin
prepare-basecoin = cp $(GOPATH)/bin/basecli $(GOPATH)/bin/basecoin $(GOPATH)/bin/baseserver $(GOPATH)/bin/counter $(GOPATH)/bin/countercli $(GOPATH)/bin/eyes $(GOPATH)/bin/eyescli $(build_folder)/usr/bin
###
# Package the binary for CentOS/RedHat (RPM) and Debian/Ubuntu (DEB)
@ -136,9 +143,10 @@ package-rpm-%: folder-%
mkdir -p {SPECS,tmp}
cp ./spectemplates/$*.spec SPECS
./generate-spec $* spectemplates SPECS
sed -i "s/@VERSION@/$($*_version)/" SPECS/$*.spec
sed -i "s/@BUILD_NUMBER@/$(BUILD_NUMBER)/" SPECS/$*.spec
sed -i "s/@PACKAGE_NAME@/$*/" SPECS/$*.spec
rpmbuild -bb SPECS/$*.spec --define "_topdir `pwd`" --define "_tmppath `pwd`/tmp"
./sign RPMS/x86_64/$*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm "$(gpg_key)" "`which gpg`"
@ -188,23 +196,23 @@ package-deb-%: folder-%
install-rpm-%: version-%
#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"
aws s3 sync s3://tendermint-packages/centos/ tmp/s3/ --delete
@echo "*** Uploading $*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm to AWS $(DEVOPS_PATH)CentOS repository"
aws s3 sync s3://tendermint-packages/$(DEVOPS_PATH)centos/ tmp/s3/ --delete
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 ./RPM-GPG-KEY-Tendermint tmp/s3/7/os/x86_64/
cp ./tendermint.repo tmp/s3/7/os/x86_64/
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 https://do9rmxapsag1v.cloudfront.net/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 https://tendermint-packages.interblock.io/$(DEVOPS_PATH)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)" --detach-sign -a tmp/s3/7/os/x86_64/repodata/repomd.xml
aws s3 sync tmp/s3/ s3://tendermint-packages/centos/ --delete --acl public-read
@echo "*** Uploaded $* to AWS CentOS repository"
aws s3 sync tmp/s3/ s3://tendermint-packages/$(DEVOPS_PATH)centos/ --delete --acl public-read
@echo "*** Uploaded $* to AWS $(DEVOPS_PATH)CentOS repository"
install-deb-%: version-%
@echo "*** Uploading $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb to AWS Debian repository"
@echo "*** Uploading $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb to AWS $(DEVOPS_PATH)Debian repository"
@echo "Testing if $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb is already uploaded"
test ! -f tmp/debian-s3/pool/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb
aws s3 sync s3://tendermint-packages/debian/ tmp/debian-s3/ --delete
aws s3 sync s3://tendermint-packages/$(DEVOPS_PATH)debian/ tmp/debian-s3/ --delete
@echo "Testing if $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb is already uploaded"
test ! -f tmp/debian-s3/pool/$*-$($*_version)-$(BUILD_NUMBER)_amd64.deb
cp ./tendermint.list tmp/debian-s3/
@ -263,8 +271,8 @@ install-deb-%: version-%
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
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"
aws s3 sync tmp/debian-s3/ s3://tendermint-packages/$(DEVOPS_PATH)debian/ --delete --acl public-read
@echo "*** Uploaded $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb to AWS $(DEVOPS_PATH)Debian repository"
mostlyclean:
rm -rf {BUILDROOT,SOURCES,SPECS,SRPMS,tmp}
@ -281,6 +289,8 @@ distclean: clean
rm -rf $(GOPATH)/bin/basecoin
rm -rf $(GOPATH)/bin/basecli
rm -rf $(GOPATH)/bin/ethermint
rm -rf $(GOPATH)/bin/gaia
rm -rf $(GOPATH)/bin/gaiacli
rm -rf $(GOPATH)/bin/tracko
rm -rf $(GOPATH)/bin/trackocli


+ 1
- 1
build/basecoin/DEBIAN/control View File

@ -3,7 +3,7 @@ Section: net
Priority: optional
Maintainer: Greg Szabo <greg@philosobear.com>
Build-Depends: debhelper (>=9)
Depends: tendermint (>=0.10.0)
Depends: tendermint (>=0.11.0)
Standards-Version: 3.9.6
Homepage: https://tendermint.com
Package: basecoin


+ 4
- 3
build/basecoin/etc/systemd/system/basecoin-server.service View File

@ -3,12 +3,13 @@ Description=Basecoin server
Requires=network-online.target
BindTo=basecoin.service
PartOf=basecoin.service
After=network-online.target basecoin.service
Before=basecoin.service
After=network-online.target
PropagatesReloadTo=basecoin.service
ReloadPropagatedFrom=basecoin.service
[Service]
Environment="TMHOME=/etc/basecoin/tendermint"
Environment="TMHOME=/etc/basecoin"
Restart=on-failure
User=basecoin
Group=basecoin
@ -18,6 +19,6 @@ ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target basecoin.service
WantedBy=multi-user.target
Also=basecoin.service

+ 2
- 3
build/basecoin/etc/systemd/system/basecoin.service View File

@ -7,8 +7,7 @@ BindTo=basecoin-server.service
#propagates stop and restart (one-way)
PartOf=basecoin-server.service
#order
Before=basecoin-server.service
After=network-online.target
After=network-online.target basecoin-server.service
#propagates reload
PropagatesReloadTo=basecoin-server.service
ReloadPropagatedFrom=basecoin-server.service
@ -24,6 +23,6 @@ ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target basecoin-server.service
Also=basecoin-server.service

+ 6
- 0
build/cosmos-sdk/DEBIAN/changelog View File

@ -0,0 +1,6 @@
cosmos-sdk (@VERSION@) @STABILITY@; urgency=medium
* Automatic build. See https://github.com/cosmos/cosmos-sdk for more information.
-- Greg Szabo <greg@philosobear.com> @DATETIMESTAMP@

+ 1
- 0
build/cosmos-sdk/DEBIAN/compat View File

@ -0,0 +1 @@
9

+ 15
- 0
build/cosmos-sdk/DEBIAN/control View File

@ -0,0 +1,15 @@
Source: cosmos-sdk
Section: net
Priority: optional
Maintainer: Greg Szabo <greg@philosobear.com>
Build-Depends: debhelper (>=9)
Depends: tendermint (>=0.11.0)
Standards-Version: 3.9.6
Homepage: https://tendermint.com
Package: cosmos-sdk
Architecture: amd64
Version: @VERSION@
Installed-Size: @INSTALLEDSIZE@
Description: cosmos-sdk is a Proof-of-Stake framework
Cosmos-SDK is a general purpose framework for the Tendermint consensus engine to form a Proof-of-Stake cryptocurrency.

+ 21
- 0
build/cosmos-sdk/DEBIAN/copyright View File

@ -0,0 +1,21 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: cosmos-sdk
Source: https://github.com/cosmos/cosmos-sdk
Files: *
Copyright: 2017 All In Bits, Inc.
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian systems, the full text of the Apache License 2.0 can be found
in the file `/usr/share/common-licenses/Apache-2.0'.

+ 46
- 0
build/cosmos-sdk/DEBIAN/postinst View File

@ -0,0 +1,46 @@
#!/bin/sh
# postinst script for cosmos-sdk
#
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
chown cosmos-sdk.cosmos-sdk /etc/cosmos-sdk
sudo -Hu cosmos-sdk basecoin init --home /etc/cosmos-sdk 2B24DEE2364762300168DF19B6C18BCE2D399EA2
#The above command generates a genesis.json file that contains validators. This is wrong, the validator part should be empty. https://github.com/tendermint/basecoin/issues/124
sudo -Hu cosmos-sdk tendermint init --home /etc/cosmos-sdk/tendermint
#The above command might need some kind of additional option in the future. https://github.com/tendermint/tendermint/issues/542
chmod 755 /etc/cosmos-sdk/tendermint
chown cosmos-sdk.cosmos-sdk /etc/cosmos-sdk/tendermint
systemctl daemon-reload
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

+ 41
- 0
build/cosmos-sdk/DEBIAN/postrm View File

@ -0,0 +1,41 @@
#!/bin/sh
# postrm script for cosmos-sdk
#
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
upgrade|failed-upgrade|abort-upgrade)
systemctl daemon-reload
;;
purge|remove|abort-install|disappear)
systemctl daemon-reload
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

+ 38
- 0
build/cosmos-sdk/DEBIAN/preinst View File

@ -0,0 +1,38 @@
#!/bin/sh
# preinst script for cosmos-sdk
#
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
if ! grep -q '^cosmos-sdk:' /etc/passwd ; then
useradd -k /dev/null -r -m -b /etc cosmos-sdk
chmod 755 /etc/cosmos-sdk
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

+ 39
- 0
build/cosmos-sdk/DEBIAN/prerm View File

@ -0,0 +1,39 @@
#!/bin/sh
# prerm script for cosmos-sdk
#
set -e
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|upgrade|deconfigure)
systemctl stop cosmos-sdk 2> /dev/null || :
systemctl stop cosmos-sdk-service 2> /dev/null || :
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

+ 3
- 0
build/cosmos-sdk/etc/systemd/system-preset/50-cosmos-sdk.preset View File

@ -0,0 +1,3 @@
disable cosmos-sdk.service
disable cosmos-sdk-server.service

+ 23
- 0
build/cosmos-sdk/etc/systemd/system/cosmos-sdk-server.service View File

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

+ 29
- 0
build/cosmos-sdk/etc/systemd/system/cosmos-sdk.service View File

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

+ 12
- 0
build/cosmos-sdk/usr/share/cosmos-sdk/key.json View File

@ -0,0 +1,12 @@
{
"address": "1B1BE55F969F54064628A63B9559E7C21C925165",
"priv_key": {
"type": "ed25519",
"data": "C70D6934B4F55F1B7BC33B56B9CA8A2061384AFC19E91E44B40C4BBA182953D1619D3678599971ED29C7529DDD4DA537B97129893598A17C82E3AC9A8BA95279"
},
"pub_key": {
"type": "ed25519",
"data": "619D3678599971ED29C7529DDD4DA537B97129893598A17C82E3AC9A8BA95279"
}
}

+ 12
- 0
build/cosmos-sdk/usr/share/cosmos-sdk/key2.json View File

@ -0,0 +1,12 @@
{
"address": "1DA7C74F9C219229FD54CC9F7386D5A3839F0090",
"priv_key": {
"type": "ed25519",
"data": "34BAE9E65CE8245FAD035A0E3EED9401BDE8785FFB3199ACCF8F5B5DDF7486A8352195DA90CB0B90C24295B90AEBA25A5A71BC61BAB2FE2387241D439698B7B8"
},
"pub_key": {
"type": "ed25519",
"data": "352195DA90CB0B90C24295B90AEBA25A5A71BC61BAB2FE2387241D439698B7B8"
}
}

+ 1
- 1
build/ethermint/DEBIAN/control View File

@ -3,7 +3,7 @@ Section: net
Priority: optional
Maintainer: Greg Szabo <greg@philosobear.com>
Build-Depends: debhelper (>=9)
Depends: tendermint (>=0.10.0)
Depends: tendermint (>=0.11.0)
Standards-Version: 3.9.6
Homepage: https://tendermint.com
Package: ethermint


+ 3
- 2
build/ethermint/etc/systemd/system/ethermint-server.service View File

@ -3,12 +3,13 @@ Description=Ethermint server
Requires=network-online.target
BindTo=ethermint.service
PartOf=ethermint.service
After=network-online.target ethermint.service
Before=ethermint.service
After=network-online.target
PropagatesReloadTo=ethermint.service
ReloadPropagatedFrom=ethermint.service
[Service]
Environment="TMHOME=/etc/ethermint/tendermint"
Environment="TMHOME=/etc/ethermint"
Restart=on-failure
User=ethermint
Group=ethermint


+ 2
- 3
build/ethermint/etc/systemd/system/ethermint.service View File

@ -7,8 +7,7 @@ BindTo=ethermint-server.service
#propagates stop and restart (one-way)
PartOf=ethermint-server.service
#order
Before=ethermint-server.service
After=network-online.target
After=network-online.target ethermint-server.service
#propagates reload
PropagatesReloadTo=ethermint-server.service
ReloadPropagatedFrom=ethermint-server.service
@ -23,6 +22,6 @@ ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target ethermint-server.service
Also=ethermint-server.service

+ 1
- 1
build/gaia/DEBIAN/control View File

@ -3,7 +3,7 @@ Section: net
Priority: optional
Maintainer: Greg Szabo <greg@philosobear.com>
Build-Depends: debhelper (>=9)
Depends: tendermint (>=0.10.0)
Depends: tendermint (>=0.11.0)
Standards-Version: 3.9.6
Homepage: https://cosmos.network
Package: gaia


+ 4
- 3
build/gaia/etc/systemd/system/gaia-server.service View File

@ -3,12 +3,13 @@ Description=Gaia server
Requires=network-online.target
BindTo=gaia.service
PartOf=gaia.service
After=network-online.target gaia.service
Before=gaia.service
After=network-online.target
PropagatesReloadTo=gaia.service
ReloadPropagatedFrom=gaia.service
[Service]
Environment="TMHOME=/etc/gaia/tendermint"
Environment="TMHOME=/etc/gaia"
Restart=on-failure
User=gaia
Group=gaia
@ -18,6 +19,6 @@ ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target gaia.service
WantedBy=multi-user.target
Also=gaia.service

+ 2
- 3
build/gaia/etc/systemd/system/gaia.service View File

@ -7,8 +7,7 @@ BindTo=gaia-server.service
#propagates stop and restart (one-way)
PartOf=gaia-server.service
#order
Before=gaia-server.service
After=network-online.target
After=network-online.target gaia-server.service
#propagates reload
PropagatesReloadTo=gaia-server.service
ReloadPropagatedFrom=gaia-server.service
@ -23,6 +22,6 @@ ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target gaia-server.service
Also=gaia-server.service

+ 36
- 0
build/generate-spec View File

@ -0,0 +1,36 @@
#!/bin/bash
if [ $# -ne 3 ]; then
echo "Usage: $0 <application> <template_source_dir> <SPEC_dir>"
exit 1
fi
app=$1
src=$2
dst=$3
# Find spectemplate
if [ ! -f "$src/$app.spec" ]; then
if [ ! -f "$src/app-template.spec" ]; then
echo "Source template not found."
exit 1
else
srcfile="$src/app-template.spec"
fi
else
srcfile="$src/$app.spec"
fi
# Copy spectemplate to SPECS
cp "$srcfile" "$dst/$app.spec"
# Apply any variables defined in .data
if [ -f "$src/$app.data" ]; then
srcdata="$src/$app.data"
source "$srcdata"
for var in `grep -v -e ^# -e ^\s*$ "$srcdata" | grep = | sed 's/\s*=.*$//'`
do
sed -i "s\\@${var}@\\${!var}\\g" "$dst/$app.spec"
done
fi

build/spectemplates/gaia.spec → build/spectemplates/app-template.spec View File


+ 5
- 0
build/spectemplates/basecoin.data View File

@ -0,0 +1,5 @@
PACKAGE_SUMMARY="basecoin is a Proof-of-Stake cryptocurrency and framework"
PACKAGE_URL="https://cosmos.network/"
PACKAGE_ADDITIONAL_HEADER="Provides: basecli"
PACKAGE_DESCRIPTION="Basecoin is an ABCI application designed to be used with the Tendermint consensus engine to form a Proof-of-Stake cryptocurrency. It also provides a general purpose framework for extending the feature-set of the cryptocurrency by implementing plugins."

+ 0
- 67
build/spectemplates/basecoin.spec View File

@ -1,67 +0,0 @@
Version: @VERSION@
Release: @BUILD_NUMBER@
%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{nil}
Name: basecoin
Summary: basecoin is a Proof-of-Stake cryptocurrency and framework
License: Apache 2.0
URL: https://tendermint.com/
Packager: Greg Szabo
Requires: tendermint >= 0.10.0
Provides: basecli
#Requires(pre): useradd
%description
Basecoin is an ABCI application designed to be used with the Tendermint consensus engine to form a Proof-of-Stake cryptocurrency. It also provides a general purpose framework for extending the feature-set of the cryptocurrency by implementing plugins.
%pre
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
useradd -k /dev/null -r -m -b %{_sysconfdir} %{name}
chmod 755 %{_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} basecoin init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
#The above command generates a genesis.json file that contains validators. This is wrong, the validator part should be empty. https://github.com/tendermint/basecoin/issues/124
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}/tendermint
#The above command might need some kind of additional option in the future. https://github.com/tendermint/tendermint/issues/542
chmod 755 %{_sysconfdir}/%{name}/tendermint
#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}
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
%{_bindir}/*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/systemd/system-preset/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%dir %{_defaultlicensedir}/%{name}
%doc %{_defaultlicensedir}/%{name}/LICENSE

+ 5
- 0
build/spectemplates/cosmos-sdk.data View File

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

+ 5
- 0
build/spectemplates/ethermint.data View File

@ -0,0 +1,5 @@
PACKAGE_SUMMARY="ethermint enables ethereum as an ABCI application on tendermint and the COSMOS hub"
PACKAGE_URL="https://tendermint.com/"
PACKAGE_ADDITIONAL_HEADER="Provides: basecli"
PACKAGE_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."

+ 11
- 12
build/spectemplates/ethermint.spec View File

@ -5,21 +5,23 @@ Release: @BUILD_NUMBER@
%define debug_package %{nil}
%define __os_install_post %{nil}
Name: ethermint
Summary: ethermint enables ethereum as an ABCI application on tendermint and the COSMOS hub
Name: @PACKAGE_NAME@
Summary: @PACKAGE_SUMMARY@
License: Apache 2.0
URL: https://tendermint.com/
URL: @PACKAGE_URL@
Packager: Greg Szabo
Requires: tendermint >= 0.10.0
#Requires(pre): useradd
Requires: tendermint >= 0.11.0
@PACKAGE_ADDITIONAL_HEADER@
%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.
@PACKAGE_DESCRIPTION@
%pre
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
useradd -k /dev/null -r -m -b %{_sysconfdir} %{name}
useradd -r -b %{_sysconfdir} %{name}
mkdir -p %{_sysconfdir}/%{name}
chmod 755 %{_sysconfdir}/%{name}
chown %{name}.%{name} %{_sysconfdir}/%{name}
fi
%prep
@ -33,10 +35,8 @@ cd %{name}-%{version}-%{release}
%{__cp} -a * %{buildroot}
%post
sudo -Hu %{name} %{_bindir}/%{name} --datadir %{_sysconfdir}/%{name} init %{_sysconfdir}/%{name}/genesis.json
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}/tendermint
chmod 755 %{_sysconfdir}/%{name}/tendermint
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}
sudo -Hu %{name} %{name} --datadir %{_sysconfdir}/%{name} init %{_sysconfdir}/%{name}/genesis.json
systemctl daemon-reload
@ -52,7 +52,6 @@ systemctl daemon-reload
%config(noreplace) %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/genesis.json
%attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/keystore
%attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/keystore/*
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
%{_bindir}/*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/systemd/system-preset/*


+ 5
- 0
build/spectemplates/gaia.data View File

@ -0,0 +1,5 @@
PACKAGE_SUMMARY="gaia - Tendermint Cosmos delegation game chain"
PACKAGE_URL="https://cosmos.network/"
PACKAGE_ADDITIONAL_HEADER="Provides: gaiacli"
PACKAGE_DESCRIPTION="Gaia description comes later."

+ 5
- 0
build/spectemplates/trackomatron.data View File

@ -0,0 +1,5 @@
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)."

+ 10
- 13
build/spectemplates/trackomatron.spec View File

@ -5,21 +5,23 @@ Release: @BUILD_NUMBER@
%define debug_package %{nil}
%define __os_install_post %{nil}
Name: trackomatron
Summary: Trackomatron - Track invoices on the blockchain
Name: @PACKAGE_NAME@
Summary: @PACKAGE_SUMMARY@
License: Apache 2.0
URL: https://tendermint.com/
URL: @PACKAGE_URL@
Packager: Greg Szabo
Requires: tendermint >= 0.10.0
#Requires(pre): useradd
Requires: tendermint >= 0.11.0
@PACKAGE_ADDITIONAL_HEADER@
%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).
@PACKAGE_DESCRIPTION@
%pre
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
useradd -k /dev/null -r -m -b %{_sysconfdir} %{name}
useradd -r -b %{_sysconfdir} %{name}
mkdir -p %{_sysconfdir}/%{name}
chmod 755 %{_sysconfdir}/%{name}
chown %{name}.%{name} %{_sysconfdir}/%{name}
fi
%prep
@ -33,12 +35,8 @@ 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
#The above command generates a genesis.json file that contains validators. This is wrong, the validator part should be empty. https://github.com/tendermint/basecoin/issues/124
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}/tendermint
#The above command might need some kind of additional option in the future. https://github.com/tendermint/tendermint/issues/542
chmod 755 %{_sysconfdir}/%{name}/tendermint
#Temporary until https://github.com/tendermint/basecoin/issues/123
rm -f %{_sysconfdir}/%{name}/key.json
@ -55,7 +53,6 @@ systemctl daemon-reload
%files
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
%{_bindir}/*
%{_sysconfdir}/systemd/system/*
%{_sysconfdir}/systemd/system-preset/*


+ 1
- 1
build/trackomatron/DEBIAN/control View File

@ -3,7 +3,7 @@ Section: net
Priority: optional
Maintainer: Greg Szabo <greg@philosobear.com>
Build-Depends: debhelper (>=9)
Depends: tendermint (>=0.10.0)
Depends: tendermint (>=0.11.0)
Standards-Version: 3.9.6
Homepage: https://tendermint.com
Package: trackomatron


+ 4
- 3
build/trackomatron/etc/systemd/system/trackomatron-server.service View File

@ -3,12 +3,13 @@ Description=Trackomatron server
Requires=network-online.target
BindTo=trackomatron.service
PartOf=trackomatron.service
After=network-online.target trackomatron.service
Before=trackomatron.service
After=network-online.target
PropagatesReloadTo=trackomatron.service
ReloadPropagatedFrom=trackomatron.service
[Service]
Environment="TMHOME=/etc/trackomatron/tendermint"
Environment="TMHOME=/etc/trackomatron"
Restart=on-failure
User=trackomatron
Group=trackomatron
@ -18,6 +19,6 @@ ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target trackomatron.service
WantedBy=multi-user.target
Also=trackomatron.service

+ 2
- 3
build/trackomatron/etc/systemd/system/trackomatron.service View File

@ -7,8 +7,7 @@ BindTo=trackomatron-server.service
#propagates stop and restart (one-way)
PartOf=trackomatron-server.service
#order
Before=trackomatron-server.service
After=network-online.target
After=network-online.target trackomatron-server.service
#propagates reload
PropagatesReloadTo=trackomatron-server.service
ReloadPropagatedFrom=trackomatron-server.service
@ -23,6 +22,6 @@ ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target trackomatron-server.service
Also=trackomatron-server.service

Loading…
Cancel
Save