mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-29 12:41:44 +00:00
@ -9,5 +9,8 @@
|
|||||||
"amount": 9007199254740992
|
"amount": 9007199254740992
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}]
|
}],
|
||||||
|
"plugin_options": [
|
||||||
|
"coin/issuer", {"app": "sigs", "addr": "1B1BE55F969F54064628A63B9559E7C21C925165"}
|
||||||
|
]
|
||||||
|
|
||||||
|
@ -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",
|
"name": "anton",
|
||||||
"address": "40CC622438D3E42148A1FFD3A27C07C100F8FA3D",
|
"address": "40CC622438D3E42148A1FFD3A27C07C100F8FA3D",
|
||||||
@ -22,30 +40,26 @@
|
|||||||
},
|
},
|
||||||
"coins": [
|
"coins": [
|
||||||
{
|
{
|
||||||
"denom": "anton",
|
"denom": "buckyball",
|
||||||
"amount": 9007199254740992
|
"amount": 9007199254740992
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"denom": "tank",
|
"denom": "antoncoin",
|
||||||
"amount": 99
|
"amount": 1000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "adrian",
|
"name": "adrian",
|
||||||
"address": "98F28277FA8C512968BBDE443F5DB27AC743F814",
|
"address": "0FA1DB09E8B174E81E94280C047C158D4271457B",
|
||||||
"pub_key": {
|
|
||||||
"type": "ed25519",
|
|
||||||
"data": "2E7EAB9E4C93D3657A63E063D6ABB851596BA97ED9F4EB9A2FC714043DC9685D"
|
|
||||||
},
|
|
||||||
"coins": [
|
"coins": [
|
||||||
{
|
{
|
||||||
"denom": "axi",
|
"denom": "buckyball",
|
||||||
"amount": 1928936473812
|
"amount": 1928936473812
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"denom": "bear",
|
"denom": "adriancoin",
|
||||||
"amount": 42
|
"amount": 1000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -62,16 +76,8 @@
|
|||||||
"amount": 20000000000
|
"amount": 20000000000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"denom": "bumblebee",
|
"denom": "buckycoin",
|
||||||
"amount": 100
|
"amount": 1000
|
||||||
},
|
|
||||||
{
|
|
||||||
"denom": "french",
|
|
||||||
"amount": 10
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"denom": "frey",
|
|
||||||
"amount": 4838271727204
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -84,34 +90,12 @@
|
|||||||
},
|
},
|
||||||
"coins": [
|
"coins": [
|
||||||
{
|
{
|
||||||
"denom": "radio",
|
"denom": "rigelcoin",
|
||||||
"amount": 50
|
"amount": 1000
|
||||||
},
|
|
||||||
{
|
|
||||||
"denom": "tv",
|
|
||||||
"amount": 3478765434568
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "gregkey",
|
|
||||||
"address": "B01C264BFE9CBD45458256E613A6F07061A3A6B6",
|
|
||||||
"pubkey": {
|
|
||||||
"type": "ed25519",
|
|
||||||
"data": "E1FFBD187FA2A922CE1B367532CEAC1AD8E606D576AB0D2E2CAA7EC6B7DAC10F"
|
|
||||||
},
|
|
||||||
"coins": [
|
|
||||||
{
|
|
||||||
"denom": "mycoin",
|
|
||||||
"amount": 3478765434568
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"denom": "buckyball",
|
"denom": "buckyball",
|
||||||
"amount": 8367251830291
|
"amount": 3478765434568
|
||||||
},
|
|
||||||
{
|
|
||||||
"denom": "playmoney",
|
|
||||||
"amount": 9999999999999
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -124,13 +108,87 @@
|
|||||||
},
|
},
|
||||||
"coins": [
|
"coins": [
|
||||||
{
|
{
|
||||||
"denom": "shadow",
|
"denom": "buckyball",
|
||||||
"amount": 53712836452781
|
"amount": 53712836452781
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"denom": "unit",
|
"denom": "shadowcoin",
|
||||||
"amount": 1
|
"amount": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "peng",
|
||||||
|
"address": "7B8422A210D0F0B8734908C093ECF0E9A768BDB8",
|
||||||
|
"coins": [
|
||||||
|
{
|
||||||
|
"denom": "buckyball",
|
||||||
|
"amount": 53712836452781
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"denom": "pengcoin",
|
||||||
|
"amount": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "matt",
|
||||||
|
"address": "C2104A8191E282AA45D210BA93282B36768EDDA1",
|
||||||
|
"coins": [
|
||||||
|
{
|
||||||
|
"denom": "buckyball",
|
||||||
|
"amount": 53712836452781
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"denom": "mattcoin",
|
||||||
|
"amount": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "frey",
|
||||||
|
"address": "0F8FB94B5A4D04220F15058B7AA16AF1328B57A9",
|
||||||
|
"coins": [
|
||||||
|
{
|
||||||
|
"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": "bianjiecoin",
|
||||||
|
"amount": 1000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
"plugin_options": [
|
||||||
|
"coin/issuer", {"app": "sigs", "addr": "B01C264BFE9CBD45458256E613A6F07061A3A6B6"}
|
||||||
]
|
]
|
||||||
|
@ -13,4 +13,8 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"plugin_options": [
|
||||||
|
"coin/issuer", {"app": "sigs", "addr": "1B1BE55F969F54064628A63B9559E7C21C925165"}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
8
ansible/getconfigtoml.yml
Normal file
8
ansible/getconfigtoml.yml
Normal 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
ansible/getfile.yml
Normal file
8
ansible/getfile.yml
Normal 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
|
||||||
|
|
@ -7,6 +7,6 @@
|
|||||||
roles:
|
roles:
|
||||||
- install
|
- install
|
||||||
- {role: generic-service, when: service == 'tendermint'}
|
- {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
|
- start
|
||||||
|
|
||||||
|
8
ansible/jsonconfig.yml
Normal file
8
ansible/jsonconfig.yml
Normal 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
|
||||||
|
|
@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
#tendermint_genesis_file: "<undefined>"
|
#genesis_file: "<undefined>"
|
||||||
#service_genesis_file: "<undefined>"
|
app_options_file: "app_options_files/public_testnet"
|
||||||
app_options_file: "app_options_files/dev_money"
|
|
||||||
seeds: ""
|
seeds: ""
|
||||||
testnet_name: testnet1
|
testnet_name: testnet1
|
||||||
validators: true
|
validators: true
|
||||||
|
@ -2,64 +2,56 @@
|
|||||||
|
|
||||||
- name: gather tendermint public keys
|
- name: gather tendermint public keys
|
||||||
when: (validators == true or validators == 'true') and tendermint_genesis_file is not defined
|
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
|
register: pubkeys
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: resetting permissions from root after gathering public keys
|
- 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
|
- name: register tendermint public keys as host facts
|
||||||
when: (validators == true or validators == 'true') and tendermint_genesis_file is not defined
|
when: (validators == true or validators == 'true') and tendermint_genesis_file is not defined
|
||||||
|
tags: reconfig-toml,reconfig-genesis
|
||||||
set_fact: "pubkey='{{pubkeys.stdout}}'"
|
set_fact: "pubkey='{{pubkeys.stdout}}'"
|
||||||
connection: local
|
connection: local
|
||||||
|
|
||||||
- name: copy generated tendermint genesis.json - genesis_time will be updated
|
- name: copy generated genesis.json - genesis_time will be updated
|
||||||
when: (validators == true or validators == 'true') and tendermint_genesis_file is not defined
|
when: (validators == true or validators == 'true') and (genesis_file is not defined)
|
||||||
|
tags: reconfig-genesis
|
||||||
template:
|
template:
|
||||||
src: genesis-server.json.j2
|
src: genesis.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')
|
|
||||||
template:
|
|
||||||
src: genesis-service.json.j2
|
|
||||||
dest: "/etc/{{service}}/genesis.json"
|
dest: "/etc/{{service}}/genesis.json"
|
||||||
owner: "{{service}}"
|
owner: "{{service}}"
|
||||||
group: "{{service}}"
|
group: "{{service}}"
|
||||||
|
|
||||||
- name: copy pre-created tendermint genesis.json
|
- name: copy pre-created genesis.json
|
||||||
when: tendermint_genesis_file is defined
|
when: genesis_file is defined
|
||||||
copy: "src={{tendermint_genesis_file}} dest=/etc/{{service}}/tendermint/genesis.json owner={{service}} group={{service}}"
|
copy: "src={{genesis_file}} dest=/etc/{{service}}/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 tendermint config.toml
|
- name: copy tendermint config.toml
|
||||||
tags: reconfig
|
tags: reconfig-toml
|
||||||
when: validators == true or validators == 'true'
|
when: validators == true or validators == 'true'
|
||||||
template:
|
template:
|
||||||
src: config.toml.j2
|
src: config.toml.j2
|
||||||
dest: "/etc/{{service}}/tendermint/config.toml"
|
dest: "/etc/{{service}}/config.toml"
|
||||||
owner: "{{service}}"
|
owner: "{{service}}"
|
||||||
group: "{{service}}"
|
group: "{{service}}"
|
||||||
|
|
||||||
- name: Copy validator network files for non-validators
|
- name: Copy validator network files for non-validators
|
||||||
when: validators == false or validators == 'false'
|
when: validators == false or validators == 'false'
|
||||||
|
tags: reconfig-toml,reconfig-genesis
|
||||||
get_url: "url={{item['src']}} dest={{item['dst']}} force=yes"
|
get_url: "url={{item['src']}} dest={{item['dst']}} force=yes"
|
||||||
with_items:
|
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}}/{{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}}/config.toml" , dst: "/etc/{{service}}/config.toml" }
|
||||||
- { src: "https://raw.githubusercontent.com/tendermint/testnets/master/{{validator_network}}/tendermint/config.toml" , dst: "/etc/{{service}}/tendermint/config.toml" }
|
|
||||||
|
|
||||||
- name: Set validator network files permissions for non-validators
|
- name: Set validator network files permissions for non-validators
|
||||||
when: validators == false or validators == 'false'
|
when: validators == false or validators == 'false'
|
||||||
|
tags: reconfig-toml,reconfig-genesis
|
||||||
file: "path={{item}} owner={{service}} group={{service}}"
|
file: "path={{item}} owner={{service}} group={{service}}"
|
||||||
with_items:
|
with_items:
|
||||||
- "/etc/{{service}}/genesis.json"
|
- "/etc/{{service}}/genesis.json"
|
||||||
- "/etc/{{service}}/tendermint/genesis.json"
|
- "/etc/{{service}}/config.toml"
|
||||||
- "/etc/{{service}}/tendermint/config.toml"
|
|
||||||
|
|
||||||
|
@ -4,13 +4,23 @@
|
|||||||
proxy_app = "tcp://127.0.0.1:46658"
|
proxy_app = "tcp://127.0.0.1:46658"
|
||||||
moniker = "{{inventory_hostname}}"
|
moniker = "{{inventory_hostname}}"
|
||||||
fast_sync = true
|
fast_sync = true
|
||||||
|
{% if service == 'tendermint' %}
|
||||||
|
|
||||||
db_backend = "memdb"
|
db_backend = "memdb"
|
||||||
#log_level = "mempool:error,*:debug"
|
log_level = "mempool:error,*:debug"
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
db_backend = "leveldb"
|
||||||
log_level = "state:info,*:error"
|
log_level = "state:info,*:error"
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
[rpc]
|
[rpc]
|
||||||
laddr = "tcp://0.0.0.0:46657"
|
laddr = "tcp://0.0.0.0:46657"
|
||||||
|
|
||||||
|
{% if service == 'tendermint' %}
|
||||||
|
|
||||||
[mempool]
|
[mempool]
|
||||||
recheck = false
|
recheck = false
|
||||||
broadcast = false
|
broadcast = false
|
||||||
@ -24,11 +34,21 @@ skip_timeout_commit = true
|
|||||||
timeout_commit = 1
|
timeout_commit = 1
|
||||||
wal_light = true
|
wal_light = true
|
||||||
block_part_size = 262144
|
block_part_size = 262144
|
||||||
|
create_empty_blocks_interval = 1
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
[consensus]
|
||||||
|
create_empty_blocks_interval = 1
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
[p2p]
|
[p2p]
|
||||||
|
{% if service == 'tendermint' %}
|
||||||
max_msg_packet_payload_size=65536
|
max_msg_packet_payload_size=65536
|
||||||
send_rate=51200000 # 50 MB/s
|
send_rate=51200000 # 50 MB/s
|
||||||
recv_rate=51200000 # 50 MB/s
|
recv_rate=51200000 # 50 MB/s
|
||||||
|
{% endif %}
|
||||||
laddr = "tcp://0.0.0.0:46656"
|
laddr = "tcp://0.0.0.0:46656"
|
||||||
{% if validators == true or validators == 'true' %}
|
{% 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 %}"
|
{% 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 %}"
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
"data": "{{hostvars[host]["pubkey"]["data"]}}",
|
"data": "{{hostvars[host]["pubkey"]["data"]}}",
|
||||||
"type": "{{hostvars[host]["pubkey"]["type"]}}"
|
"type": "{{hostvars[host]["pubkey"]["type"]}}"
|
||||||
},
|
},
|
||||||
"amount":10,
|
"power":10,
|
||||||
"name":"{{hostvars[host]["inventory_hostname"]}}"
|
"name":"{{hostvars[host]["inventory_hostname"]}}"
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
46
ansible/roles/config/templates/genesis.json.j2
Normal file
46
ansible/roles/config/templates/genesis.json.j2
Normal 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 %}
|
||||||
|
}
|
@ -15,11 +15,8 @@
|
|||||||
- name: Reload systemd services
|
- name: Reload systemd services
|
||||||
systemd: "name={{service}} daemon_reload=yes enabled=no"
|
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
|
- name: Initialize tendermint
|
||||||
command: "/usr/bin/tendermint init --home /etc/{{service}}/tendermint"
|
command: "/usr/bin/tendermint init --home /etc/{{service}}"
|
||||||
become: yes
|
become: yes
|
||||||
become_user: "{{service}}"
|
become_user: "{{service}}"
|
||||||
|
|
||||||
|
6
ansible/roles/getconfigtoml/tasks/main.yml
Normal file
6
ansible/roles/getconfigtoml/tasks/main.yml
Normal 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
ansible/roles/getfile/tasks/main.yml
Normal file
6
ansible/roles/getfile/tasks/main.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Get file from node
|
||||||
|
fetch: "dest={{ destination | default('.') }}/{{ source | basename }} flat=yes src='{{source}}'"
|
||||||
|
run_once: yes
|
||||||
|
|
@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
release_install: true
|
release_install: true
|
||||||
binary: "{{ lookup('env','GOPATH') | default('') }}/bin/{{service}}"
|
binary: "{{ lookup('env','GOPATH') | default('') }}/bin/{{service}}"
|
||||||
|
devops_path: false
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#Workaround
|
#Workaround
|
||||||
- name: Download repository key for CentOS/RedHat
|
- name: Download repository key for CentOS/RedHat
|
||||||
when: ansible_os_family == "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
|
- name: Import repository key for CentOS/RedHat
|
||||||
when: ansible_os_family == "RedHat"
|
when: ansible_os_family == "RedHat"
|
||||||
command: "rpm --import /root/RPM-GPG-KEY-Tendermint"
|
command: "rpm --import /root/RPM-GPG-KEY-Tendermint"
|
||||||
@ -22,13 +22,32 @@
|
|||||||
when: ansible_os_family == "RedHat"
|
when: ansible_os_family == "RedHat"
|
||||||
yum_repository:
|
yum_repository:
|
||||||
name: tendermint
|
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"
|
description: "Tendermint repo"
|
||||||
gpgcheck: yes
|
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
|
# 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={{service}} update_cache=yes state=latest"
|
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
|
||||||
|
|
||||||
|
@ -8,15 +8,24 @@
|
|||||||
- 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:
|
||||||
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
|
id: 2122CBE9
|
||||||
|
|
||||||
- name: Install tendermint repository on Debian/Ubuntu
|
- name: Install tendermint repository on Debian/Ubuntu
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
apt_repository:
|
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
|
- name: Install package on Debian/Ubuntu
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
apt: "pkg={{service}} update_cache=yes state=latest"
|
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
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
- name: Restart journald
|
- name: Restart journald
|
||||||
service: name=systemd-journald state=restarted
|
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
|
- include: debian.yml
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
|
360
ansible/roles/jsonconfig/library/jsonconfig.py
Normal file
360
ansible/roles/jsonconfig/library/jsonconfig.py
Normal 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
ansible/roles/jsonconfig/tasks/main.yml
Normal file
5
ansible/roles/jsonconfig/tasks/main.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Update
|
||||||
|
jsonconfig: "dest='{{destination}}' json='{{jsonconfig}}' state={{(remove | default(false) | bool) | ternary('absent','present')}}"
|
||||||
|
|
27
ansible/roles/setfile/tasks/main.yml
Normal file
27
ansible/roles/setfile/tasks/main.yml
Normal 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
ansible/roles/tomlconfig/defaults/main.yml
Normal file
3
ansible/roles/tomlconfig/defaults/main.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
destination: /etc/{{service}}/config.toml
|
||||||
|
|
386
ansible/roles/tomlconfig/library/tomlconfig.py
Normal file
386
ansible/roles/tomlconfig/library/tomlconfig.py
Normal 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
ansible/roles/tomlconfig/tasks/main.yml
Normal file
10
ansible/roles/tomlconfig/tasks/main.yml
Normal 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')}}"
|
||||||
|
|
@ -6,6 +6,8 @@
|
|||||||
when: "service == 'basecoin'"
|
when: "service == 'basecoin'"
|
||||||
become_user: 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}}"
|
become_user: "{{service}}"
|
||||||
|
|
||||||
|
- file: "path=/etc/{{service}}/data state=absent"
|
||||||
|
|
||||||
|
10
ansible/setfile.yml
Normal file
10
ansible/setfile.yml
Normal 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
ansible/tomlconfig.yml
Normal file
8
ansible/tomlconfig.yml
Normal 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
|
||||||
|
|
@ -60,12 +60,12 @@ build-tendermint: git-branch
|
|||||||
cp $(GOPATH)/src/github.com/tendermint/tendermint/build/tendermint $(GOPATH)/bin
|
cp $(GOPATH)/src/github.com/tendermint/tendermint/build/tendermint $(GOPATH)/bin
|
||||||
@echo "*** Built tendermint"
|
@echo "*** Built tendermint"
|
||||||
|
|
||||||
build-basecoin: git-branch
|
#build-basecoin: git-branch
|
||||||
@echo "*** Building basecoin"
|
# @echo "*** Building basecoin-old"
|
||||||
go get -d -u github.com/tendermint/basecoin/cmd/basecoin
|
# go get -d -u github.com/tendermint/basecoin/cmd/basecoin
|
||||||
cd $(GOPATH)/src/github.com/tendermint/basecoin && git checkout "$(GIT_BRANCH)" && git pull
|
# 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
|
# $(MAKE) -C $(GOPATH)/src/github.com/tendermint/basecoin get_vendor_deps install
|
||||||
@echo "*** Built basecoin"
|
# @echo "*** Built basecoin"
|
||||||
|
|
||||||
build-ethermint: git-branch
|
build-ethermint: git-branch
|
||||||
@echo "*** Building ethermint"
|
@echo "*** Building ethermint"
|
||||||
@ -77,7 +77,7 @@ build-ethermint: git-branch
|
|||||||
|
|
||||||
build-trackomatron: git-branch
|
build-trackomatron: git-branch
|
||||||
@echo "*** Building trackomatron"
|
@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
|
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
|
$(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 "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
|
$(MAKE) -C $(GOPATH)/src/github.com/cosmos/gaia get_vendor_deps install
|
||||||
@echo "*** Built gaia"
|
@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
|
# Prepare package files
|
||||||
###
|
###
|
||||||
@ -97,7 +104,7 @@ build-gaia: git-branch
|
|||||||
# set app_version
|
# set app_version
|
||||||
version-%: $(GOPATH)/bin/%
|
version-%: $(GOPATH)/bin/%
|
||||||
if [ -z "$(BUILD_NUMBER)" ]; then echo "BUILD_NUMBER not set" ; false ; fi
|
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
|
# set build_folder
|
||||||
folder-%: version-%
|
folder-%: version-%
|
||||||
@ -111,12 +118,12 @@ prepare-files = rm -rf $(build_folder) && mkdir -p $(build_folder) && cp -r ./$(
|
|||||||
##
|
##
|
||||||
|
|
||||||
prepare-tendermint =
|
prepare-tendermint =
|
||||||
prepare-basecoin = cp $(GOPATH)/bin/basecli $(build_folder)/usr/bin
|
|
||||||
prepare-ethermint = mkdir -p $(build_folder)/etc/ethermint && \
|
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 $(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
|
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-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)
|
# Package the binary for CentOS/RedHat (RPM) and Debian/Ubuntu (DEB)
|
||||||
@ -136,9 +143,10 @@ package-rpm-%: folder-%
|
|||||||
|
|
||||||
mkdir -p {SPECS,tmp}
|
mkdir -p {SPECS,tmp}
|
||||||
|
|
||||||
cp ./spectemplates/$*.spec SPECS
|
./generate-spec $* spectemplates SPECS
|
||||||
sed -i "s/@VERSION@/$($*_version)/" SPECS/$*.spec
|
sed -i "s/@VERSION@/$($*_version)/" SPECS/$*.spec
|
||||||
sed -i "s/@BUILD_NUMBER@/$(BUILD_NUMBER)/" 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"
|
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`"
|
./sign RPMS/x86_64/$*-$($*_version)-$(BUILD_NUMBER).x86_64.rpm "$(gpg_key)" "`which gpg`"
|
||||||
@ -188,23 +196,23 @@ package-deb-%: folder-%
|
|||||||
|
|
||||||
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 $(DEVOPS_PATH)CentOS repository"
|
||||||
aws s3 sync s3://tendermint-packages/centos/ tmp/s3/ --delete
|
aws s3 sync s3://tendermint-packages/$(DEVOPS_PATH)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 ./RPM-GPG-KEY-Tendermint tmp/s3/7/os/x86_64/
|
cp ./RPM-GPG-KEY-Tendermint tmp/s3/7/os/x86_64/
|
||||||
cp ./tendermint.repo 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
|
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
|
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
|
aws s3 sync tmp/s3/ s3://tendermint-packages/$(DEVOPS_PATH)centos/ --delete --acl public-read
|
||||||
@echo "*** Uploaded $* to AWS CentOS repository"
|
@echo "*** Uploaded $* to AWS $(DEVOPS_PATH)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 $(DEVOPS_PATH)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/ --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"
|
@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
|
||||||
cp ./tendermint.list tmp/debian-s3/
|
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
|
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/ --delete --acl public-read
|
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 Debian repository"
|
@echo "*** Uploaded $*-$($*_version)-$(BUILD_NUMBER)_amd64.deb to AWS $(DEVOPS_PATH)Debian repository"
|
||||||
|
|
||||||
mostlyclean:
|
mostlyclean:
|
||||||
rm -rf {BUILDROOT,SOURCES,SPECS,SRPMS,tmp}
|
rm -rf {BUILDROOT,SOURCES,SPECS,SRPMS,tmp}
|
||||||
@ -281,6 +289,8 @@ distclean: clean
|
|||||||
rm -rf $(GOPATH)/bin/basecoin
|
rm -rf $(GOPATH)/bin/basecoin
|
||||||
rm -rf $(GOPATH)/bin/basecli
|
rm -rf $(GOPATH)/bin/basecli
|
||||||
rm -rf $(GOPATH)/bin/ethermint
|
rm -rf $(GOPATH)/bin/ethermint
|
||||||
|
rm -rf $(GOPATH)/bin/gaia
|
||||||
|
rm -rf $(GOPATH)/bin/gaiacli
|
||||||
rm -rf $(GOPATH)/bin/tracko
|
rm -rf $(GOPATH)/bin/tracko
|
||||||
rm -rf $(GOPATH)/bin/trackocli
|
rm -rf $(GOPATH)/bin/trackocli
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ Section: net
|
|||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Greg Szabo <greg@philosobear.com>
|
Maintainer: Greg Szabo <greg@philosobear.com>
|
||||||
Build-Depends: debhelper (>=9)
|
Build-Depends: debhelper (>=9)
|
||||||
Depends: tendermint (>=0.10.0)
|
Depends: tendermint (>=0.11.0)
|
||||||
Standards-Version: 3.9.6
|
Standards-Version: 3.9.6
|
||||||
Homepage: https://tendermint.com
|
Homepage: https://tendermint.com
|
||||||
Package: basecoin
|
Package: basecoin
|
||||||
|
@ -3,12 +3,13 @@ Description=Basecoin server
|
|||||||
Requires=network-online.target
|
Requires=network-online.target
|
||||||
BindTo=basecoin.service
|
BindTo=basecoin.service
|
||||||
PartOf=basecoin.service
|
PartOf=basecoin.service
|
||||||
After=network-online.target basecoin.service
|
Before=basecoin.service
|
||||||
|
After=network-online.target
|
||||||
PropagatesReloadTo=basecoin.service
|
PropagatesReloadTo=basecoin.service
|
||||||
ReloadPropagatedFrom=basecoin.service
|
ReloadPropagatedFrom=basecoin.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment="TMHOME=/etc/basecoin/tendermint"
|
Environment="TMHOME=/etc/basecoin"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=basecoin
|
User=basecoin
|
||||||
Group=basecoin
|
Group=basecoin
|
||||||
@ -18,6 +19,6 @@ ExecReload=/bin/kill -HUP $MAINPID
|
|||||||
KillSignal=SIGTERM
|
KillSignal=SIGTERM
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target basecoin.service
|
WantedBy=multi-user.target
|
||||||
Also=basecoin.service
|
Also=basecoin.service
|
||||||
|
|
||||||
|
@ -7,8 +7,7 @@ BindTo=basecoin-server.service
|
|||||||
#propagates stop and restart (one-way)
|
#propagates stop and restart (one-way)
|
||||||
PartOf=basecoin-server.service
|
PartOf=basecoin-server.service
|
||||||
#order
|
#order
|
||||||
Before=basecoin-server.service
|
After=network-online.target basecoin-server.service
|
||||||
After=network-online.target
|
|
||||||
#propagates reload
|
#propagates reload
|
||||||
PropagatesReloadTo=basecoin-server.service
|
PropagatesReloadTo=basecoin-server.service
|
||||||
ReloadPropagatedFrom=basecoin-server.service
|
ReloadPropagatedFrom=basecoin-server.service
|
||||||
@ -24,6 +23,6 @@ ExecReload=/bin/kill -HUP $MAINPID
|
|||||||
KillSignal=SIGTERM
|
KillSignal=SIGTERM
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target basecoin-server.service
|
||||||
Also=basecoin-server.service
|
Also=basecoin-server.service
|
||||||
|
|
||||||
|
6
build/cosmos-sdk/DEBIAN/changelog
Normal file
6
build/cosmos-sdk/DEBIAN/changelog
Normal 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
build/cosmos-sdk/DEBIAN/compat
Normal file
1
build/cosmos-sdk/DEBIAN/compat
Normal file
@ -0,0 +1 @@
|
|||||||
|
9
|
15
build/cosmos-sdk/DEBIAN/control
Normal file
15
build/cosmos-sdk/DEBIAN/control
Normal 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
build/cosmos-sdk/DEBIAN/copyright
Normal file
21
build/cosmos-sdk/DEBIAN/copyright
Normal 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
build/cosmos-sdk/DEBIAN/postinst
Normal file
46
build/cosmos-sdk/DEBIAN/postinst
Normal 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
build/cosmos-sdk/DEBIAN/postrm
Normal file
41
build/cosmos-sdk/DEBIAN/postrm
Normal 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
build/cosmos-sdk/DEBIAN/preinst
Normal file
38
build/cosmos-sdk/DEBIAN/preinst
Normal 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
build/cosmos-sdk/DEBIAN/prerm
Normal file
39
build/cosmos-sdk/DEBIAN/prerm
Normal 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
|
@ -0,0 +1,3 @@
|
|||||||
|
disable cosmos-sdk.service
|
||||||
|
disable cosmos-sdk-server.service
|
||||||
|
|
@ -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
build/cosmos-sdk/etc/systemd/system/cosmos-sdk.service
Normal file
29
build/cosmos-sdk/etc/systemd/system/cosmos-sdk.service
Normal 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
build/cosmos-sdk/usr/share/cosmos-sdk/key.json
Normal file
12
build/cosmos-sdk/usr/share/cosmos-sdk/key.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"address": "1B1BE55F969F54064628A63B9559E7C21C925165",
|
||||||
|
"priv_key": {
|
||||||
|
"type": "ed25519",
|
||||||
|
"data": "C70D6934B4F55F1B7BC33B56B9CA8A2061384AFC19E91E44B40C4BBA182953D1619D3678599971ED29C7529DDD4DA537B97129893598A17C82E3AC9A8BA95279"
|
||||||
|
},
|
||||||
|
"pub_key": {
|
||||||
|
"type": "ed25519",
|
||||||
|
"data": "619D3678599971ED29C7529DDD4DA537B97129893598A17C82E3AC9A8BA95279"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
12
build/cosmos-sdk/usr/share/cosmos-sdk/key2.json
Normal file
12
build/cosmos-sdk/usr/share/cosmos-sdk/key2.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"address": "1DA7C74F9C219229FD54CC9F7386D5A3839F0090",
|
||||||
|
"priv_key": {
|
||||||
|
"type": "ed25519",
|
||||||
|
"data": "34BAE9E65CE8245FAD035A0E3EED9401BDE8785FFB3199ACCF8F5B5DDF7486A8352195DA90CB0B90C24295B90AEBA25A5A71BC61BAB2FE2387241D439698B7B8"
|
||||||
|
},
|
||||||
|
"pub_key": {
|
||||||
|
"type": "ed25519",
|
||||||
|
"data": "352195DA90CB0B90C24295B90AEBA25A5A71BC61BAB2FE2387241D439698B7B8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@ Section: net
|
|||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Greg Szabo <greg@philosobear.com>
|
Maintainer: Greg Szabo <greg@philosobear.com>
|
||||||
Build-Depends: debhelper (>=9)
|
Build-Depends: debhelper (>=9)
|
||||||
Depends: tendermint (>=0.10.0)
|
Depends: tendermint (>=0.11.0)
|
||||||
Standards-Version: 3.9.6
|
Standards-Version: 3.9.6
|
||||||
Homepage: https://tendermint.com
|
Homepage: https://tendermint.com
|
||||||
Package: ethermint
|
Package: ethermint
|
||||||
|
@ -3,12 +3,13 @@ Description=Ethermint server
|
|||||||
Requires=network-online.target
|
Requires=network-online.target
|
||||||
BindTo=ethermint.service
|
BindTo=ethermint.service
|
||||||
PartOf=ethermint.service
|
PartOf=ethermint.service
|
||||||
After=network-online.target ethermint.service
|
Before=ethermint.service
|
||||||
|
After=network-online.target
|
||||||
PropagatesReloadTo=ethermint.service
|
PropagatesReloadTo=ethermint.service
|
||||||
ReloadPropagatedFrom=ethermint.service
|
ReloadPropagatedFrom=ethermint.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment="TMHOME=/etc/ethermint/tendermint"
|
Environment="TMHOME=/etc/ethermint"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=ethermint
|
User=ethermint
|
||||||
Group=ethermint
|
Group=ethermint
|
||||||
|
@ -7,8 +7,7 @@ BindTo=ethermint-server.service
|
|||||||
#propagates stop and restart (one-way)
|
#propagates stop and restart (one-way)
|
||||||
PartOf=ethermint-server.service
|
PartOf=ethermint-server.service
|
||||||
#order
|
#order
|
||||||
Before=ethermint-server.service
|
After=network-online.target ethermint-server.service
|
||||||
After=network-online.target
|
|
||||||
#propagates reload
|
#propagates reload
|
||||||
PropagatesReloadTo=ethermint-server.service
|
PropagatesReloadTo=ethermint-server.service
|
||||||
ReloadPropagatedFrom=ethermint-server.service
|
ReloadPropagatedFrom=ethermint-server.service
|
||||||
@ -23,6 +22,6 @@ ExecReload=/bin/kill -HUP $MAINPID
|
|||||||
KillSignal=SIGTERM
|
KillSignal=SIGTERM
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target ethermint-server.service
|
||||||
Also=ethermint-server.service
|
Also=ethermint-server.service
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ Section: net
|
|||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Greg Szabo <greg@philosobear.com>
|
Maintainer: Greg Szabo <greg@philosobear.com>
|
||||||
Build-Depends: debhelper (>=9)
|
Build-Depends: debhelper (>=9)
|
||||||
Depends: tendermint (>=0.10.0)
|
Depends: tendermint (>=0.11.0)
|
||||||
Standards-Version: 3.9.6
|
Standards-Version: 3.9.6
|
||||||
Homepage: https://cosmos.network
|
Homepage: https://cosmos.network
|
||||||
Package: gaia
|
Package: gaia
|
||||||
|
@ -3,12 +3,13 @@ Description=Gaia server
|
|||||||
Requires=network-online.target
|
Requires=network-online.target
|
||||||
BindTo=gaia.service
|
BindTo=gaia.service
|
||||||
PartOf=gaia.service
|
PartOf=gaia.service
|
||||||
After=network-online.target gaia.service
|
Before=gaia.service
|
||||||
|
After=network-online.target
|
||||||
PropagatesReloadTo=gaia.service
|
PropagatesReloadTo=gaia.service
|
||||||
ReloadPropagatedFrom=gaia.service
|
ReloadPropagatedFrom=gaia.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment="TMHOME=/etc/gaia/tendermint"
|
Environment="TMHOME=/etc/gaia"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=gaia
|
User=gaia
|
||||||
Group=gaia
|
Group=gaia
|
||||||
@ -18,6 +19,6 @@ ExecReload=/bin/kill -HUP $MAINPID
|
|||||||
KillSignal=SIGTERM
|
KillSignal=SIGTERM
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target gaia.service
|
WantedBy=multi-user.target
|
||||||
Also=gaia.service
|
Also=gaia.service
|
||||||
|
|
||||||
|
@ -7,8 +7,7 @@ BindTo=gaia-server.service
|
|||||||
#propagates stop and restart (one-way)
|
#propagates stop and restart (one-way)
|
||||||
PartOf=gaia-server.service
|
PartOf=gaia-server.service
|
||||||
#order
|
#order
|
||||||
Before=gaia-server.service
|
After=network-online.target gaia-server.service
|
||||||
After=network-online.target
|
|
||||||
#propagates reload
|
#propagates reload
|
||||||
PropagatesReloadTo=gaia-server.service
|
PropagatesReloadTo=gaia-server.service
|
||||||
ReloadPropagatedFrom=gaia-server.service
|
ReloadPropagatedFrom=gaia-server.service
|
||||||
@ -23,6 +22,6 @@ ExecReload=/bin/kill -HUP $MAINPID
|
|||||||
KillSignal=SIGTERM
|
KillSignal=SIGTERM
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target gaia-server.service
|
||||||
Also=gaia-server.service
|
Also=gaia-server.service
|
||||||
|
|
||||||
|
36
build/generate-spec
Executable file
36
build/generate-spec
Executable 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
|
||||||
|
|
@ -5,21 +5,23 @@ Release: @BUILD_NUMBER@
|
|||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
%define __os_install_post %{nil}
|
%define __os_install_post %{nil}
|
||||||
|
|
||||||
Name: gaia
|
Name: @PACKAGE_NAME@
|
||||||
Summary: gaia - Tendermint Cosmos delegation game chain
|
Summary: @PACKAGE_SUMMARY@
|
||||||
License: Apache 2.0
|
License: Apache 2.0
|
||||||
URL: https://cosmos.network/
|
URL: @PACKAGE_URL@
|
||||||
Packager: Greg Szabo
|
Packager: Greg Szabo
|
||||||
Requires: tendermint >= 0.10.0
|
Requires: tendermint >= 0.11.0
|
||||||
#Requires(pre): useradd
|
@PACKAGE_ADDITIONAL_HEADER@
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Gaia description comes later.
|
@PACKAGE_DESCRIPTION@
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
|
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}
|
chmod 755 %{_sysconfdir}/%{name}
|
||||||
|
chown %{name}.%{name} %{_sysconfdir}/%{name}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
@ -33,12 +35,8 @@ cd %{name}-%{version}-%{release}
|
|||||||
%{__cp} -a * %{buildroot}
|
%{__cp} -a * %{buildroot}
|
||||||
|
|
||||||
%post
|
%post
|
||||||
sudo -Hu %{name} gaia init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
|
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}
|
||||||
#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} %{name} init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
|
||||||
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
|
#Temporary until https://github.com/tendermint/basecoin/issues/123
|
||||||
rm -f %{_sysconfdir}/%{name}/key.json
|
rm -f %{_sysconfdir}/%{name}/key.json
|
||||||
@ -55,7 +53,6 @@ systemctl daemon-reload
|
|||||||
|
|
||||||
%files
|
%files
|
||||||
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
|
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
|
||||||
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
|
|
||||||
%{_bindir}/*
|
%{_bindir}/*
|
||||||
%{_sysconfdir}/systemd/system/*
|
%{_sysconfdir}/systemd/system/*
|
||||||
%{_sysconfdir}/systemd/system-preset/*
|
%{_sysconfdir}/systemd/system-preset/*
|
5
build/spectemplates/basecoin.data
Normal file
5
build/spectemplates/basecoin.data
Normal 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."
|
||||||
|
|
@ -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
build/spectemplates/cosmos-sdk.data
Normal file
5
build/spectemplates/cosmos-sdk.data
Normal 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
build/spectemplates/ethermint.data
Normal file
5
build/spectemplates/ethermint.data
Normal 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."
|
||||||
|
|
@ -5,21 +5,23 @@ Release: @BUILD_NUMBER@
|
|||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
%define __os_install_post %{nil}
|
%define __os_install_post %{nil}
|
||||||
|
|
||||||
Name: ethermint
|
Name: @PACKAGE_NAME@
|
||||||
Summary: ethermint enables ethereum as an ABCI application on tendermint and the COSMOS hub
|
Summary: @PACKAGE_SUMMARY@
|
||||||
License: Apache 2.0
|
License: Apache 2.0
|
||||||
URL: https://tendermint.com/
|
URL: @PACKAGE_URL@
|
||||||
Packager: Greg Szabo
|
Packager: Greg Szabo
|
||||||
Requires: tendermint >= 0.10.0
|
Requires: tendermint >= 0.11.0
|
||||||
#Requires(pre): useradd
|
@PACKAGE_ADDITIONAL_HEADER@
|
||||||
|
|
||||||
%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.
|
@PACKAGE_DESCRIPTION@
|
||||||
|
|
||||||
%pre
|
%pre
|
||||||
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
|
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}
|
chmod 755 %{_sysconfdir}/%{name}
|
||||||
|
chown %{name}.%{name} %{_sysconfdir}/%{name}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
@ -33,10 +35,8 @@ cd %{name}-%{version}-%{release}
|
|||||||
%{__cp} -a * %{buildroot}
|
%{__cp} -a * %{buildroot}
|
||||||
|
|
||||||
%post
|
%post
|
||||||
sudo -Hu %{name} %{_bindir}/%{name} --datadir %{_sysconfdir}/%{name} init %{_sysconfdir}/%{name}/genesis.json
|
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}
|
||||||
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}/tendermint
|
sudo -Hu %{name} %{name} --datadir %{_sysconfdir}/%{name} init %{_sysconfdir}/%{name}/genesis.json
|
||||||
|
|
||||||
chmod 755 %{_sysconfdir}/%{name}/tendermint
|
|
||||||
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
@ -52,7 +52,6 @@ systemctl daemon-reload
|
|||||||
%config(noreplace) %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/genesis.json
|
%config(noreplace) %attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/genesis.json
|
||||||
%attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/keystore
|
%attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/keystore
|
||||||
%attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/keystore/*
|
%attr(0644, %{name}, %{name}) %{_sysconfdir}/%{name}/keystore/*
|
||||||
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
|
|
||||||
%{_bindir}/*
|
%{_bindir}/*
|
||||||
%{_sysconfdir}/systemd/system/*
|
%{_sysconfdir}/systemd/system/*
|
||||||
%{_sysconfdir}/systemd/system-preset/*
|
%{_sysconfdir}/systemd/system-preset/*
|
||||||
|
5
build/spectemplates/gaia.data
Normal file
5
build/spectemplates/gaia.data
Normal 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
build/spectemplates/trackomatron.data
Normal file
5
build/spectemplates/trackomatron.data
Normal 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)."
|
||||||
|
|
@ -5,21 +5,23 @@ Release: @BUILD_NUMBER@
|
|||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
%define __os_install_post %{nil}
|
%define __os_install_post %{nil}
|
||||||
|
|
||||||
Name: trackomatron
|
Name: @PACKAGE_NAME@
|
||||||
Summary: Trackomatron - Track invoices on the blockchain
|
Summary: @PACKAGE_SUMMARY@
|
||||||
License: Apache 2.0
|
License: Apache 2.0
|
||||||
URL: https://tendermint.com/
|
URL: @PACKAGE_URL@
|
||||||
Packager: Greg Szabo
|
Packager: Greg Szabo
|
||||||
Requires: tendermint >= 0.10.0
|
Requires: tendermint >= 0.11.0
|
||||||
#Requires(pre): useradd
|
@PACKAGE_ADDITIONAL_HEADER@
|
||||||
|
|
||||||
%description
|
%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
|
%pre
|
||||||
if ! %{__grep} -q '^%{name}:' /etc/passwd ; then
|
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}
|
chmod 755 %{_sysconfdir}/%{name}
|
||||||
|
chown %{name}.%{name} %{_sysconfdir}/%{name}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
@ -33,12 +35,8 @@ cd %{name}-%{version}-%{release}
|
|||||||
%{__cp} -a * %{buildroot}
|
%{__cp} -a * %{buildroot}
|
||||||
|
|
||||||
%post
|
%post
|
||||||
|
sudo -Hu %{name} tendermint init --home %{_sysconfdir}/%{name}
|
||||||
sudo -Hu %{name} tracko init --home %{_sysconfdir}/%{name} 2B24DEE2364762300168DF19B6C18BCE2D399EA2
|
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
|
#Temporary until https://github.com/tendermint/basecoin/issues/123
|
||||||
rm -f %{_sysconfdir}/%{name}/key.json
|
rm -f %{_sysconfdir}/%{name}/key.json
|
||||||
@ -55,7 +53,6 @@ systemctl daemon-reload
|
|||||||
|
|
||||||
%files
|
%files
|
||||||
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
|
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}
|
||||||
%ghost %attr(0755, %{name}, %{name}) %dir %{_sysconfdir}/%{name}/tendermint
|
|
||||||
%{_bindir}/*
|
%{_bindir}/*
|
||||||
%{_sysconfdir}/systemd/system/*
|
%{_sysconfdir}/systemd/system/*
|
||||||
%{_sysconfdir}/systemd/system-preset/*
|
%{_sysconfdir}/systemd/system-preset/*
|
||||||
|
@ -3,7 +3,7 @@ Section: net
|
|||||||
Priority: optional
|
Priority: optional
|
||||||
Maintainer: Greg Szabo <greg@philosobear.com>
|
Maintainer: Greg Szabo <greg@philosobear.com>
|
||||||
Build-Depends: debhelper (>=9)
|
Build-Depends: debhelper (>=9)
|
||||||
Depends: tendermint (>=0.10.0)
|
Depends: tendermint (>=0.11.0)
|
||||||
Standards-Version: 3.9.6
|
Standards-Version: 3.9.6
|
||||||
Homepage: https://tendermint.com
|
Homepage: https://tendermint.com
|
||||||
Package: trackomatron
|
Package: trackomatron
|
||||||
|
@ -3,12 +3,13 @@ Description=Trackomatron server
|
|||||||
Requires=network-online.target
|
Requires=network-online.target
|
||||||
BindTo=trackomatron.service
|
BindTo=trackomatron.service
|
||||||
PartOf=trackomatron.service
|
PartOf=trackomatron.service
|
||||||
After=network-online.target trackomatron.service
|
Before=trackomatron.service
|
||||||
|
After=network-online.target
|
||||||
PropagatesReloadTo=trackomatron.service
|
PropagatesReloadTo=trackomatron.service
|
||||||
ReloadPropagatedFrom=trackomatron.service
|
ReloadPropagatedFrom=trackomatron.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment="TMHOME=/etc/trackomatron/tendermint"
|
Environment="TMHOME=/etc/trackomatron"
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=trackomatron
|
User=trackomatron
|
||||||
Group=trackomatron
|
Group=trackomatron
|
||||||
@ -18,6 +19,6 @@ ExecReload=/bin/kill -HUP $MAINPID
|
|||||||
KillSignal=SIGTERM
|
KillSignal=SIGTERM
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target trackomatron.service
|
WantedBy=multi-user.target
|
||||||
Also=trackomatron.service
|
Also=trackomatron.service
|
||||||
|
|
||||||
|
@ -7,8 +7,7 @@ BindTo=trackomatron-server.service
|
|||||||
#propagates stop and restart (one-way)
|
#propagates stop and restart (one-way)
|
||||||
PartOf=trackomatron-server.service
|
PartOf=trackomatron-server.service
|
||||||
#order
|
#order
|
||||||
Before=trackomatron-server.service
|
After=network-online.target trackomatron-server.service
|
||||||
After=network-online.target
|
|
||||||
#propagates reload
|
#propagates reload
|
||||||
PropagatesReloadTo=trackomatron-server.service
|
PropagatesReloadTo=trackomatron-server.service
|
||||||
ReloadPropagatedFrom=trackomatron-server.service
|
ReloadPropagatedFrom=trackomatron-server.service
|
||||||
@ -23,6 +22,6 @@ ExecReload=/bin/kill -HUP $MAINPID
|
|||||||
KillSignal=SIGTERM
|
KillSignal=SIGTERM
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target trackomatron-server.service
|
||||||
Also=trackomatron-server.service
|
Also=trackomatron-server.service
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user