Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2bed864
Showing
53 changed files
with
1,610 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.env | ||
|
||
# Ansible | ||
*.retry | ||
|
||
# Vagrant | ||
.vagrant | ||
|
||
# Terraform | ||
*.tfstate | ||
*.tfstate.backup | ||
.terraform | ||
/clusters/aws-example.inventory | ||
|
||
# CLion | ||
cmake-build-debug | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2017 The Dash Core Group, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Dash Cluster Ansible | ||
==================== | ||
|
||
What is this? | ||
------------- | ||
|
||
This is an Ansible project to setup and manage devnet (and later testnet) networks. Devnets | ||
are like regular Dash networks (mainnet, testnet) but easier to bootstrap and easier to have | ||
multiple in parallel. | ||
|
||
This project is work in progress and in its initial state only meant to be used by Dash Core | ||
developers to assist in Dash Evolution development. | ||
|
||
Detailed documentation on how to use this repo will come when more interest from the public | ||
arises or when Evolution is released. | ||
|
||
Getting started | ||
--------------- | ||
|
||
Create your own cluster configuration in `clusters`. Use `aws-example.*` as a skeleton. The | ||
following commands will all directly use the aws-example, while you should change it to use | ||
your own config. | ||
|
||
Setup the AWS infrastructure with terraform: | ||
|
||
```bash | ||
$ cd terraform/aws | ||
$ terraform apply -var-file=../../clusters/aws-example.tfvars | ||
``` | ||
|
||
Create the inventory file for Ansible | ||
|
||
```bash | ||
$ terraform output ansible_inventory > ../../clusters/aws-example.inventory | ||
``` | ||
|
||
Invoke ansible-playbook | ||
```bash | ||
$ cd ../.. # Go back to root dir of project | ||
$ ansible-playbook -i clusters/aws-example.inventory -e @clusters/aws-example.yml cluster.yml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[defaults] | ||
host_key_checking = False | ||
|
||
[ssh_connection] | ||
pipelining = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
###################### | ||
# Bootstrap | ||
|
||
- hosts: all | ||
gather_facts: False | ||
become: true | ||
pre_tasks: | ||
- name: install python 2 | ||
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) | ||
- name: Check if inside AWS. | ||
uri: | ||
url: http://169.254.169.254/latest/meta-data | ||
timeout: 2 | ||
register: aws_uri_check | ||
failed_when: False | ||
- set_fact: | ||
is_aws_environment: "{{ aws_uri_check.status == 200 }}" | ||
roles: | ||
- role: aws | ||
when: is_aws_environment | ||
|
||
###################### | ||
|
||
- hosts: all | ||
become: true | ||
vars: | ||
pip_install_packages: | ||
- name: docker | ||
- name: docker-compose | ||
roles: | ||
- geerlingguy.pip | ||
- geerlingguy.docker | ||
- ecr-login | ||
- dash-cli | ||
|
||
# private nodes | ||
- hosts: wallet-nodes | ||
become: true | ||
roles: | ||
- role: dashd | ||
dashd_indexes: true | ||
dashd_zmq: true | ||
|
||
# public nodes | ||
- hosts: full-nodes, masternodes | ||
become: true | ||
pre_tasks: | ||
- set_fact: | ||
masternode: '{{ masternodes[inventory_hostname] }}' | ||
when: inventory_hostname in masternodes | ||
roles: | ||
- role: dashd | ||
dashd_listen: true | ||
- role: mn-sentinel | ||
when: masternode is defined | ||
|
||
# generate first block on seed node so that all nodes leave IBD mode (required for mining) | ||
- hosts: seed-node | ||
become: true | ||
roles: | ||
- role: generate-firstblock | ||
when: dash_network == "devnet" or dash_network == "regtest" | ||
|
||
- hosts: miners | ||
become: true | ||
roles: | ||
- role: regtest-miner | ||
when: dash_network == "regtest" | ||
- role: cpuminer | ||
when: dash_network != "regtest" | ||
|
||
- hosts: web | ||
become: true | ||
roles: | ||
- multifaucet | ||
|
||
- hosts: masternode-wallet | ||
become: true | ||
roles: | ||
- mn-fund-collateral | ||
- mn-pay-faucet | ||
- mn-conf | ||
- mn-start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Put your cluster configurations here. See aws-example.yml for an example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dash_network="devnet" | ||
dash_devnet_name="aws-example" | ||
dashd_port=20001 | ||
dashd_rpc_port=20002 | ||
node_count=1 | ||
miner_count=2 | ||
masternode_count = 13 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
|
||
dash_network: devnet | ||
dash_devnet_name: aws-example | ||
dashd_port: 20001 | ||
dashd_rpcport: 20002 | ||
|
||
dashd_rpcuser: dashrpc | ||
dashd_rpcpassword: password | ||
|
||
faucet_address: yhvXpqQjfN9S4j5mBKbxeGxiETJrrLETg5 | ||
faucet_privkey: cR4t6evwVZoCp1JsLk4wURK4UmBCZzZotNzn9T1mhBT19SH9JtNt | ||
|
||
masternodes: | ||
masternode-1: | ||
address: yiRNTUNCS39WPu3VhT7utRWTJYzmUdf1aR | ||
address_key: cSrCXqZ1oVw3vpeuoyPKHBpGiMmf6pQerF64MYMcS11HQ4bGquDF | ||
privkey: 92KdqxzX7HCnxCtwt1yHENGrXq71SAxD4vrrsFArbSU2wUKdQCM | ||
masternode-2: | ||
address: ybpwqoZ2Q4goxrzgPx9b3cbPrvy6UbC1ct | ||
address_key: cN88MoW1XEv1s4wt6zgbQ8aR9KYM4RZihSeoRUcdWmwdAyu6HaDu | ||
privkey: 93Fd7XY2zF4q9YKTZUSFxLgp4Xs7MuaMnvY9kpvH7V8oXWqsCC1 | ||
masternode-3: | ||
address: yQuwR1uaci2SCQBgqcaKRzfq7upL4n513j | ||
address_key: cTEGsaAqx9jUFYkNECeGKfixa6vgMiUoSwqsdncc11mS6BZerTpT | ||
privkey: 93EmoMmHgTCg8yVhRtK5sxpv5k4Sq1KoHCVB43VxbbZpVPtHMnc | ||
masternode-4: | ||
address: yQCV7FnK99crDwmiwrLCwgaDKz5qV4my6u | ||
address_key: cSMvsssFKziHctH2d2FNfeCaKuEckC9PB8aQD1E6ecYjSpDdYrLf | ||
privkey: 931yVsW5MFNCRSPDYPR6UFJHp3SVRDkuhGGwqgmPiEaayRrdcoW | ||
masternode-5: | ||
address: yiS4S2aLvXf61WcJEc2mzkuLHCeBgd7wLp | ||
address_key: cVMFBkeZ4X3HAz14CjQnpA9KqDSLGUbxNVx5BxXMxkBj4Us3HDpc | ||
privkey: 92Srupy73xqSbXVK2MARo8Euq9kmdv5KVsaeZtdNCxQREU9xS4x | ||
masternode-6: | ||
address: yZrCcddoxdH16STwQpmpEPbn6urenS8yjf | ||
address_key: cRNS6N2gakrSZWEz4NsxLwSzv9GYxS9wS4efLyntKo66ZiaenZyo | ||
privkey: 92D4QRUTz1svVMgfmXrHqpYV7JZQ1ECP1d65m6j9AuLY9Wr6mGX | ||
masternode-7: | ||
address: yQSQoco2uAR4sc2AkXGNcAcBnbYY4q7a6T | ||
address_key: cNj3itrDW4abS97dv6fE1dy16kDbfB8K63zws8Q65xMTEgZ8Gtqz | ||
privkey: 92mSVHx5eji6QHAiMANYKMFcVeoukwf7cGG9SjvR3jbG9n5nFzu | ||
masternode-8: | ||
address: yXrf4MNYipnGmSQqGv1HGqmD3xxWELs9T9 | ||
address_key: cQy6bcyDYwHR97wa4zUnuJAp6Fw3gJHoq1nFBCXqJBs2G17siFki | ||
privkey: 92iu2nJLxreHMVSzMn7XeAS3zScuNPMocp9wrLUcCHJdgzLRFzR | ||
masternode-9: | ||
address: yTezNspASgUWeRvkVbQx7brFzJYnihkCdB | ||
address_key: cQKSAVBd87j5EGtWEf2m5zip1qFmWBWzZ3yRhGeTMvB8wjLarxM2 | ||
privkey: 92C4n8apRbzU91ETwM1KxAMGzzsjy9mRtqph9NptbRc5XJV1xAg | ||
masternode-10: | ||
address: yN4YJuZUUCiVTNoKwtNsNTapGvW9PbmzXk | ||
address_key: cMdZCshfc8mhSTb8oauuraWKAZjfGDnx4xX9HE2D4nP74WwEk1HN | ||
privkey: 91f9gi61MzGFSBuwzq5zZq4NHnA8vGL3qUUZyNijGWnimEtfnuq | ||
masternode-11: | ||
address: yTWgsUVk66vV2csfYFDxvYU31BupXDD2mE | ||
address_key: cPaGBsFGjvsxBqZKzSCdERACg7EPkKBJf8kP4h6f9S8ZZeCoBqHh | ||
privkey: 93Mhiq2KS5ZUGo4M7XnvuccMZQSvLvt81Ac5A7LgrH17DcE9Cp2 | ||
masternode-12: | ||
address: yUtqnQw3DHgn6BEwjnR1hVabKDM4F8pAuP | ||
address_key: cNsvfpZb3RY3k7LvcxGriGavBqznE4Cn1q1QF8bGZo5eHMu7ngW3 | ||
privkey: 91k7JxVWDDBoWpA8DZHc9FZwV5b1wZEf52v1m5dwzrzroyxhxHN | ||
masternode-13: | ||
address: yYzxjiTcG8HuKBXS3VW5yhjfZdMhMV1NqB | ||
address_key: cPknbev5GEhHKug7QNzPRb4jpDM7PaJtfyaZgtivV86NBeCVvPFf | ||
privkey: 933cojtvorhVLJxDdhaM9hf1wp7es7VHFxbms26DQ2tnZjxdgku |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
|
||
dash_docker_repo: dashpay | ||
dashd_image: '{{ dash_docker_repo }}/dashd-develop' | ||
|
||
dashd_user: dash | ||
dashd_group: dash | ||
dashd_home: /dash | ||
|
||
dash_network: devnet | ||
dash_devnet_name: devnet1 | ||
dashd_port: 29999 | ||
|
||
# Please provide your own credentials in cluster config | ||
dashd_rpcuser: dashrpc | ||
dashd_rpcpassword: password | ||
dashd_rpcport: 29998 | ||
|
||
# You can provide your own seed node in cluster config. May be useful if you want to connect to another cluster | ||
dashd_seednode: '{{ hostvars[groups["seed-node"][0]]["public_ip"] }}' | ||
|
||
# Faucet stuff | ||
|
||
faucet_rpc_host: '{{ hostvars[groups["faucet-wallet"][0]]["private_ip"] }}' | ||
faucet_rpc_port: '{{ dashd_rpcport }}' | ||
faucet_rpc_user: '{{ dashd_rpcuser }}' | ||
faucet_rpc_password: '{{ dashd_rpcpassword }}' | ||
faucet_rpc_args: '-rpcconnect={{ faucet_rpc_host }} -rpcport={{ faucet_rpc_port }} -rpcuser={{ faucet_rpc_user }} -rpcpassword={{ faucet_rpc_password }}' | ||
|
||
# Example faucet address/privkey (provide your own in cluster config) | ||
#faucet_address: yhvXpqQjfN9S4j5mBKbxeGxiETJrrLETg5 | ||
#faucet_privkey: cR4t6evwVZoCp1JsLk4wURK4UmBCZzZotNzn9T1mhBT19SH9JtNt | ||
|
||
# Miner stuff | ||
|
||
miner_rpc_host: '{{ faucet_rpc_host }}' | ||
miner_rpc_port: '{{ faucet_rpc_port }}' | ||
miner_rpc_user: '{{ faucet_rpc_user }}' | ||
miner_rpc_password: '{{ faucet_rpc_password }}' | ||
miner_payment_address: "{{ faucet_address }}" | ||
|
||
# Allow to run miners at 100% by default | ||
miner_cpu_quota: 100000 # 100% | ||
|
||
# Masternode stuff | ||
|
||
masternode_wallet_rpc_host: '{{ hostvars[groups["masternode-wallet"][0]]["private_ip"] }}' | ||
masternode_wallet_rpc_port: '{{ dashd_rpcport }}' | ||
masternode_wallet_rpc_user: '{{ dashd_rpcuser }}' | ||
masternode_wallet_rpc_password: '{{ dashd_rpcpassword }}' | ||
masternode_wallet_rpc_args: '-rpcconnect={{ masternode_wallet_rpc_host }} -rpcport={{ masternode_wallet_rpc_port }} -rpcuser={{ masternode_wallet_rpc_user }} -rpcpassword={{ masternode_wallet_rpc_password }}' | ||
|
||
# Example masternodes list (provide your own in cluster config) | ||
#masternodes: | ||
# masternode-1: | ||
# address: yiRNTUNCS39WPu3VhT7utRWTJYzmUdf1aR | ||
# address_key: cSrCXqZ1oVw3vpeuoyPKHBpGiMmf6pQerF64MYMcS11HQ4bGquDF | ||
# privkey: 92KdqxzX7HCnxCtwt1yHENGrXq71SAxD4vrrsFArbSU2wUKdQCM | ||
# masternode-2: | ||
# address: ybpwqoZ2Q4goxrzgPx9b3cbPrvy6UbC1ct | ||
# address_key: cN88MoW1XEv1s4wt6zgbQ8aR9KYM4RZihSeoRUcdWmwdAyu6HaDu | ||
# privkey: 93Fd7XY2zF4q9YKTZUSFxLgp4Xs7MuaMnvY9kpvH7V8oXWqsCC1 | ||
# masternode-3: | ||
# address: yQuwR1uaci2SCQBgqcaKRzfq7upL4n513j | ||
# address_key: cTEGsaAqx9jUFYkNECeGKfixa6vgMiUoSwqsdncc11mS6BZerTpT | ||
# privkey: 93EmoMmHgTCg8yVhRtK5sxpv5k4Sq1KoHCVB43VxbbZpVPtHMnc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- hosts: all | ||
become: true | ||
roles: | ||
- kill-cluster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
|
||
- name: update hostname | ||
hostname: | ||
name: '{{ inventory_hostname }}' | ||
|
||
- name: ensure hostname is in /etc/hosts | ||
lineinfile: | ||
path: /etc/hosts | ||
regexp: '^127\.0\.0\.1' | ||
line: '127.0.0.1 localhost {{ inventory_hostname }}' | ||
owner: root | ||
group: root | ||
mode: 0644 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
|
||
cpuminer_image: 'ablock/dash-cpuminer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
|
||
- name: create cpuminer container | ||
docker_container: | ||
name: dash-cpuminer | ||
state: started | ||
#cpu_quota: "{{ miner_cpu_quota }}" | ||
image: '{{ cpuminer_image }}' | ||
pull: true | ||
restart_policy: always | ||
command: '-r 1 -a x11 --no-getwork --no-stratum -o http://{{ miner_rpc_host }}:{{ miner_rpc_port }} -u {{ miner_rpc_user }} -p {{ miner_rpc_password }} --coinbase-addr={{ miner_payment_address }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
|
||
- name: pull dashd image | ||
shell: docker pull {{ dashd_image }} | ||
|
||
- name: copy dash-cli from docker container | ||
shell: docker run --rm -v /tmp:/host-tmp {{ dashd_image }} cp /usr/bin/dash-cli /host-tmp/ && mv /tmp/dash-cli /usr/local/bin/dash-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
|
||
dashd_debug: 1 | ||
|
||
dashd_indexes: false | ||
dashd_zmq: false | ||
|
||
dashd_listen: false | ||
dashd_externalip: '{{ public_ip }}' | ||
dashd_isseednode: '{{ dashd_externalip == dashd_seednode }}' | ||
|
||
dashd_private_net_prefix: 16 | ||
dashd_private_cidr: '{{ private_ip|ipsubnet(dashd_private_net_prefix) }}' | ||
|
||
# When running devnet/regtest in local networks, we have to allow RFC1918/private addresses | ||
dashd_allowprivatenet: '{% if dashd_externalip|ipaddr("private") == dashd_externalip %}1{% else %}0{% endif %}' |
Oops, something went wrong.