split role netstat and explorer
This commit is contained in:
parent
dea10f70c0
commit
f28c111876
|
@ -0,0 +1,102 @@
|
||||||
|
---
|
||||||
|
- name: Create explorer security group
|
||||||
|
hosts: localhost
|
||||||
|
gather_facts: False
|
||||||
|
tasks:
|
||||||
|
- name: Create Security group
|
||||||
|
ec2_group:
|
||||||
|
ec2_access_key: "{{ access_key }}"
|
||||||
|
ec2_secret_key: "{{ secret_key }}"
|
||||||
|
name: explorer-security
|
||||||
|
description: "Default security group"
|
||||||
|
region: "{{ region }}"
|
||||||
|
# purge_rules_egress: true
|
||||||
|
# purge_rules: true
|
||||||
|
rules:
|
||||||
|
- proto: tcp
|
||||||
|
from_port: 22
|
||||||
|
to_port: 22
|
||||||
|
cidr_ip: 0.0.0.0/0
|
||||||
|
- proto: tcp
|
||||||
|
from_port: 443
|
||||||
|
to_port: 443
|
||||||
|
cidr_ip: 0.0.0.0/0
|
||||||
|
- proto: tcp
|
||||||
|
from_port: 3000
|
||||||
|
to_port: 3000
|
||||||
|
cidr_ip: 0.0.0.0/0
|
||||||
|
- proto: tcp
|
||||||
|
from_port: 30303
|
||||||
|
to_port: 30303
|
||||||
|
cidr_ip: 0.0.0.0/0
|
||||||
|
- proto: udp
|
||||||
|
from_port: 30303
|
||||||
|
to_port: 30303
|
||||||
|
cidr_ip: 0.0.0.0/0
|
||||||
|
rules_egress:
|
||||||
|
- proto: all
|
||||||
|
from_port: all
|
||||||
|
to_port: all
|
||||||
|
cidr_ip: 0.0.0.0/0
|
||||||
|
tags: explorer
|
||||||
|
|
||||||
|
|
||||||
|
- name: Create explorer
|
||||||
|
hosts: localhost
|
||||||
|
gather_facts: False
|
||||||
|
vars:
|
||||||
|
volumes:
|
||||||
|
- device_name: /dev/sda1
|
||||||
|
volume_size: 128
|
||||||
|
delete_on_termination: true
|
||||||
|
tasks:
|
||||||
|
- name: Launch instance
|
||||||
|
ec2:
|
||||||
|
ec2_access_key: "{{ access_key }}"
|
||||||
|
ec2_secret_key: "{{ secret_key }}"
|
||||||
|
key_name: "{{ awskeypair_name }}"
|
||||||
|
instance_tags:
|
||||||
|
Name: "{{ explorer_instance_name }}"
|
||||||
|
group: "{{ explorer_security_group }}"
|
||||||
|
instance_type: "{{ explorer_instance_type }}"
|
||||||
|
image: "{{ image }}"
|
||||||
|
count: "{{ explorer_count_instances }}"
|
||||||
|
wait: yes
|
||||||
|
region: "{{ region }}"
|
||||||
|
vpc_subnet_id: "{{ vpc_subnet_id }}"
|
||||||
|
volumes: "{{ volumes }}"
|
||||||
|
assign_public_ip: yes
|
||||||
|
register: ec2
|
||||||
|
- name: Add new instance to host group
|
||||||
|
add_host: hostname={{ item.public_ip }} groupname=launched
|
||||||
|
with_items: "{{ ec2.instances }}"
|
||||||
|
- name: Wait for SSH to come up
|
||||||
|
wait_for: host={{ item.public_ip }} port=22 delay=90 timeout=320 state=started
|
||||||
|
with_items: "{{ ec2.instances }}"
|
||||||
|
tags: explorer
|
||||||
|
|
||||||
|
- name: Installing python
|
||||||
|
hosts: all
|
||||||
|
hosts: launched
|
||||||
|
gather_facts: False
|
||||||
|
user: ubuntu
|
||||||
|
become: True
|
||||||
|
vars:
|
||||||
|
ansible_ssh_port: 22
|
||||||
|
tasks:
|
||||||
|
- name: Install python
|
||||||
|
raw: test -e /usr/bin/python || (sudo apt -y update && sudo apt install -y python-minimal)
|
||||||
|
|
||||||
|
- name: Configure instance(s)
|
||||||
|
hosts: launched
|
||||||
|
user: ubuntu
|
||||||
|
become: True
|
||||||
|
vars:
|
||||||
|
ansible_ssh_port: 22
|
||||||
|
gather_facts: True
|
||||||
|
roles:
|
||||||
|
- preconf
|
||||||
|
tags: preconf
|
||||||
|
tasks:
|
||||||
|
- name: restart machine after setup
|
||||||
|
shell: shutdown -r 1
|
|
@ -69,3 +69,9 @@ owner_instance_type: "t2.large"
|
||||||
owner_instance_name: "owner"
|
owner_instance_name: "owner"
|
||||||
owner_count_instances: "1"
|
owner_count_instances: "1"
|
||||||
owner_security_group: "owner-security"
|
owner_security_group: "owner-security"
|
||||||
|
|
||||||
|
#explorer
|
||||||
|
explorer_instance_type: "t2.large"
|
||||||
|
explorer_instance_name: "explorer"
|
||||||
|
explorer_count_instances: "1"
|
||||||
|
explorer_security_group: "explorer-security"
|
||||||
|
|
|
@ -16,8 +16,11 @@
|
||||||
|
|
||||||
[mining]
|
[mining]
|
||||||
|
|
||||||
|
[explorer]
|
||||||
|
|
||||||
[oracles:children]
|
[oracles:children]
|
||||||
bootnode
|
bootnode
|
||||||
owner
|
owner
|
||||||
netstat
|
netstat
|
||||||
mining
|
mining
|
||||||
|
explorer
|
||||||
|
|
16
netstat.yml
16
netstat.yml
|
@ -25,22 +25,6 @@
|
||||||
from_port: 3000
|
from_port: 3000
|
||||||
to_port: 3000
|
to_port: 3000
|
||||||
cidr_ip: 0.0.0.0/0
|
cidr_ip: 0.0.0.0/0
|
||||||
- proto: tcp
|
|
||||||
from_port: 4000
|
|
||||||
to_port: 4000
|
|
||||||
cidr_ip: 0.0.0.0/0
|
|
||||||
- proto: tcp
|
|
||||||
from_port: 8545
|
|
||||||
to_port: 8545
|
|
||||||
cidr_ip: 0.0.0.0/0
|
|
||||||
- proto: tcp
|
|
||||||
from_port: 30303
|
|
||||||
to_port: 30303
|
|
||||||
cidr_ip: 0.0.0.0/0
|
|
||||||
- proto: udp
|
|
||||||
from_port: 30303
|
|
||||||
to_port: 30303
|
|
||||||
cidr_ip: 0.0.0.0/0
|
|
||||||
rules_egress:
|
rules_egress:
|
||||||
- proto: all
|
- proto: all
|
||||||
from_port: all
|
from_port: all
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
- name: restart oracles-chain-explorer
|
||||||
|
service: name=oracles-chain-explorer state=restarted
|
|
@ -0,0 +1,78 @@
|
||||||
|
---
|
||||||
|
- name: Create directory parity_data/keys/OraclesPoA
|
||||||
|
file:
|
||||||
|
path: "{{ home }}/parity_data/keys/OraclesPoA"
|
||||||
|
state: directory
|
||||||
|
mode: 0700
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ username }}"
|
||||||
|
|
||||||
|
- name: Create logs directories
|
||||||
|
file:
|
||||||
|
path: "/{{ home }}/logs/old"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ username }}"
|
||||||
|
|
||||||
|
- name: Download spec.json
|
||||||
|
get_url: url={{ item }} dest={{ home }}/ mode=0644
|
||||||
|
with_items:
|
||||||
|
- "https://raw.githubusercontent.com/oraclesorg/oracles-scripts/sokol/spec.json"
|
||||||
|
- "https://raw.githubusercontent.com/oraclesorg/deployment-azure/dev-mainnet/nodes/bootnodes.txt"
|
||||||
|
- "https://raw.githubusercontent.com/oraclesorg/deployment-azure/dev-mainnet/nodes/netstats-server/node.toml"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Change nat in node.toml
|
||||||
|
lineinfile:
|
||||||
|
path: "{{ home }}/node.toml"
|
||||||
|
insertafter: '^\[network\]'
|
||||||
|
line: nat="extip:{{ ansible_host }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Change reserved_peers in node.toml
|
||||||
|
lineinfile:
|
||||||
|
path: "{{ home }}/node.toml"
|
||||||
|
insertafter: '^\[network\]'
|
||||||
|
line: reserved_peers="{{ home }}/bootnodes.txt"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add log file in node.toml
|
||||||
|
blockinfile:
|
||||||
|
path: "{{ home }}/node.toml"
|
||||||
|
block: |
|
||||||
|
[misc]
|
||||||
|
log_file = "{{ home }}/logs/parity.log"
|
||||||
|
|
||||||
|
- git: repo=https://github.com/oraclesorg/oracles-dapps-keys-generation.git dest={{ home }}/parity_data/dapps/KeysGenerator
|
||||||
|
- git: repo=https://github.com/oraclesorg/oracles-dapps-voting.git dest={{ home }}/parity_data/dapps/Voting
|
||||||
|
- git: repo=https://github.com/oraclesorg/oracles-dapps-validators.git dest={{ home }}/parity_data/dapps/ValidatorsList
|
||||||
|
|
||||||
|
- git: repo=https://github.com/oraclesorg/chain-explorer dest={{ home }}/chain-explorer
|
||||||
|
|
||||||
|
- name: Install chain_explorer app.json
|
||||||
|
template: src=app.json.j2 dest={{ home }}/chain-explorer/app.json owner={{ username }} group={{ username }} mode=0644
|
||||||
|
notify:
|
||||||
|
- restart oracles-chain-explorer
|
||||||
|
|
||||||
|
- file: path={{ home }} owner={{ username }} group={{ username }} recurse=yes
|
||||||
|
|
||||||
|
- name: install npm chain_explorer
|
||||||
|
shell: "cd /home/{{ username }}/chain-explorer; /usr/bin/npm install"
|
||||||
|
become: true
|
||||||
|
become_user: "{{ username }}"
|
||||||
|
notify:
|
||||||
|
- restart oracles-chain-explorer
|
||||||
|
|
||||||
|
- name: Install chain_explorer config.js
|
||||||
|
template: src=config.js.j2 dest={{ home }}/chain-explorer/config.js owner={{ username }} group={{ username }} mode=0644
|
||||||
|
notify:
|
||||||
|
- restart oracles-chain-explorer
|
||||||
|
|
||||||
|
- name: Install oracles-chain-explorer service
|
||||||
|
template: src=oracles-chain-explorer.j2 dest=/etc/systemd/system/oracles-chain-explorer.service owner=root group=root mode=0755
|
||||||
|
notify:
|
||||||
|
- restart oracles-chain-explorer
|
||||||
|
|
||||||
|
- name: Ensure oracles-chain-explorer is running and enabled to start at boot
|
||||||
|
service: name=oracles-chain-explorer state=started enabled=yes
|
|
@ -0,0 +1,19 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name" : "explorer",
|
||||||
|
"script" : "./bin/www",
|
||||||
|
"log_date_format" : "YYYY-MM-DD HH:mm:SS Z",
|
||||||
|
"error_file" : "/home/{{ username }}/logs/explorer.err",
|
||||||
|
"out_file" : "/home/{{ username }}/logs/explorer.out",
|
||||||
|
"merge_logs" : false,
|
||||||
|
"watch" : false,
|
||||||
|
"max_restarts" : 100,
|
||||||
|
"exec_interpreter" : "node",
|
||||||
|
"exec_mode" : "fork_mode",
|
||||||
|
"env":
|
||||||
|
{
|
||||||
|
"NODE_ENV" : "production",
|
||||||
|
"PORT" : 4000,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1,12 @@
|
||||||
|
var web3 = require('web3');
|
||||||
|
var net = require('net');
|
||||||
|
var config = function () {
|
||||||
|
this.logFormat = "combined";
|
||||||
|
this.ipcPath = "/home/{{ username }}/parity_data/jsonrpc.ipc";
|
||||||
|
this.provider = new web3.providers.IpcProvider(this.ipcPath, net);
|
||||||
|
this.bootstrapUrl = "https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/yeti/bootstrap.min.css";
|
||||||
|
this.names = {
|
||||||
|
"{{ OWNER_ADDRESS }}": "Owner",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
module.exports = config;
|
|
@ -1,6 +1,3 @@
|
||||||
---
|
---
|
||||||
- name: restart oracles-chain-explorer
|
|
||||||
service: name=oracles-chain-explorer state=restarted
|
|
||||||
|
|
||||||
- name: restart oracles-dashboard
|
- name: restart oracles-dashboard
|
||||||
service: name=oracles-dashboard state=restarted
|
service: name=oracles-dashboard state=restarted
|
||||||
|
|
|
@ -49,10 +49,6 @@
|
||||||
- git: repo=https://github.com/oraclesorg/oracles-dapps-validators.git dest={{ home }}/parity_data/dapps/ValidatorsList
|
- git: repo=https://github.com/oraclesorg/oracles-dapps-validators.git dest={{ home }}/parity_data/dapps/ValidatorsList
|
||||||
|
|
||||||
- git: repo=https://github.com/oraclesorg/eth-netstats dest={{ home }}/eth-netstats
|
- git: repo=https://github.com/oraclesorg/eth-netstats dest={{ home }}/eth-netstats
|
||||||
- git: repo=https://github.com/oraclesorg/chain-explorer dest={{ home }}/chain-explorer
|
|
||||||
|
|
||||||
- name: Install chain_explorer app.json
|
|
||||||
template: src=app.json.j2 dest={{ home }}/chain-explorer/app.json owner={{ username }} group={{ username }} mode=0644
|
|
||||||
|
|
||||||
- file: path={{ home }} owner={{ username }} group={{ username }} recurse=yes
|
- file: path={{ home }} owner={{ username }} group={{ username }} recurse=yes
|
||||||
|
|
||||||
|
@ -76,18 +72,6 @@
|
||||||
notify:
|
notify:
|
||||||
- restart oracles-dashboard
|
- restart oracles-dashboard
|
||||||
|
|
||||||
- name: install npm chain_explorer
|
|
||||||
shell: "cd /home/{{ username }}/chain-explorer; /usr/bin/npm install"
|
|
||||||
become: true
|
|
||||||
become_user: "{{ username }}"
|
|
||||||
notify:
|
|
||||||
- restart oracles-dashboard
|
|
||||||
|
|
||||||
- name: Install chain_explorer config.js
|
|
||||||
template: src=config.js.j2 dest={{ home }}/chain-explorer/config.js owner={{ username }} group={{ username }} mode=0644
|
|
||||||
notify:
|
|
||||||
- restart oracles-chain-explorer
|
|
||||||
|
|
||||||
- name: Install oracles-dashboard service
|
- name: Install oracles-dashboard service
|
||||||
template: src=oracles-dashboard.j2 dest=/etc/systemd/system/oracles-dashboard.service owner=root group=root mode=0755
|
template: src=oracles-dashboard.j2 dest=/etc/systemd/system/oracles-dashboard.service owner=root group=root mode=0755
|
||||||
notify:
|
notify:
|
||||||
|
@ -95,11 +79,3 @@
|
||||||
|
|
||||||
- name: Ensure oracles-dashboard is running and enabled to start at boot
|
- name: Ensure oracles-dashboard is running and enabled to start at boot
|
||||||
service: name=oracles-dashboard state=started enabled=yes
|
service: name=oracles-dashboard state=started enabled=yes
|
||||||
|
|
||||||
- name: Install oracles-chain-explorer service
|
|
||||||
template: src=oracles-chain-explorer.j2 dest=/etc/systemd/system/oracles-chain-explorer.service owner=root group=root mode=0755
|
|
||||||
notify:
|
|
||||||
- restart oracles-chain-explorer
|
|
||||||
|
|
||||||
- name: Ensure oracles-chain-explorer is running and enabled to start at boot
|
|
||||||
service: name=oracles-chain-explorer state=started enabled=yes
|
|
||||||
|
|
18
site.yml
18
site.yml
|
@ -65,6 +65,24 @@
|
||||||
tags:
|
tags:
|
||||||
- netstat
|
- netstat
|
||||||
|
|
||||||
|
- hosts: explorer
|
||||||
|
vars:
|
||||||
|
PROXY_PORT: "4000"
|
||||||
|
explorerS_SERVER: "localhost"
|
||||||
|
username: "explorer"
|
||||||
|
users:
|
||||||
|
- name: "explorer"
|
||||||
|
home: "/home/explorer"
|
||||||
|
roles:
|
||||||
|
- usermanager
|
||||||
|
- nodejs
|
||||||
|
- oracles-logrotate
|
||||||
|
- oracles-pm2
|
||||||
|
- oracles-netstats
|
||||||
|
- explorer
|
||||||
|
tags:
|
||||||
|
- explorer
|
||||||
|
|
||||||
- hosts: owner
|
- hosts: owner
|
||||||
vars:
|
vars:
|
||||||
username: "owner"
|
username: "owner"
|
||||||
|
|
Loading…
Reference in New Issue