Added blockscout role

This commit is contained in:
natalia 2018-09-18 23:01:59 -07:00
parent c84ac2161c
commit 69c8cb5258
9 changed files with 165 additions and 2 deletions

9
Vagrantfile vendored
View File

@ -3,7 +3,7 @@ ENV["LC_ALL"] = "en_US.UTF-8"
Vagrant.configure("2") do |config|
servers = [ "validator", "explorer", "moc", "bootnode", "netstat" ]
servers = [ "validator", "explorer", "moc", "bootnode", "netstat", "blockscout" ]
platform_os = ENV["poa_platform"]
if platform_os == "ubuntu"
@ -19,6 +19,10 @@ Vagrant.configure("2") do |config|
node.vm.box = platform
node.vm.hostname = machine
if machine == "blockscout"
node.vm.network "forwarded_port", guest: 4000, host: 4001
end
node.vm.provision :ansible do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "site.yml"
@ -28,8 +32,9 @@ Vagrant.configure("2") do |config|
"netstat" => ["netstat"],
"moc" => ["moc"],
"bootnode" => ["bootnode"],
"blockscout" => ["blockscout"],
}
ansible.groups[platform_os] = [ "validator", "explorer", "netstat", "moc", "bootnode" ]
ansible.groups[platform_os] = [ "validator", "explorer", "netstat", "moc", "bootnode", "blockscout" ]
end
node.vm.provision :shell do |shell|

4
blockscout.yml Normal file
View File

@ -0,0 +1,4 @@
- hosts: blockscout
become: True
roles:
- blockscout

View File

@ -0,0 +1,16 @@
username: "blockscout"
users:
- name: "{{ username }}"
home: "/home/{{ username }}"
nginx_headers: "off"
PROXY_PORT: "3000"
configure_extended_tcp_settings: false
install_debug_tools: "yes"
reboot_after_completion: false
blockscout_version: "master"
postgres_password: "dhu4Hfdlllf2htHYbjeeuhy34"
db_user: "blockscout"
db_user_password: "dvYYTbhdhuuOLMf74ghu"

View File

@ -0,0 +1,27 @@
---
user: ubuntu
allow_explorer_ssh: true
allow_explorer_p2p: true
allow_explorer_http: true
username: "blockscout"
users:
- name: "{{ username }}"
home: "/home/{{ username }}"
nginx_headers: "off"
PROXY_PORT: "3000"
MAIN_REPO_FETCH: "poanetwork"
MOC_ADDRESS: "0xdd0bb0e2a1594240fed0c2f2c17c1e9ab4f87126"
reboot_after_completion: false
install_debug_tools: "no"
install_firewall: false
blockscout_version: "master"
postgres_password: "dhu4Hfdlllf2htHYbjeeuhy34"
db_user: "blockscout"
db_user_password: "dvYYTbhdhuuOLMf74ghu"

View File

@ -0,0 +1,9 @@
dependencies:
- { role: usermanager }
- { role: preconf }
- { role: nodejs }
- { role: poa-logrotate }
- { role: poa-parity }
- { role: poa-pm2 }
- { role: nginx }
- { role: debug-tools, when: "install_debug_tools == 'yes'" }

View File

@ -0,0 +1,89 @@
---
- name: Add ubuntu/erlang_solutions signing key
apt_key:
url: https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc
state: present
- name: Add erlang-solutions repository into sources list
apt_repository:
repo: deb https://packages.erlang-solutions.com/ubuntu xenial contrib
state: present
- name: Install erlang and elixir
apt:
pkg: "{{ item }}"
state: present
update_cache: yes
cache_valid_time: 3600
with_items:
- esl-erlang
- elixir
- name: Add PostgreSQL signing key
become: True
shell: wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add -
- name: Add PostgreSQL into sources list
become: True
shell: sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
- name: Install PostgreSQL
become: True
shell: apt-get update && apt-get install postgresql postgresql-contrib -y
- name: Install tools
apt:
pkg: "{{ item }}"
state: present
update_cache: yes
cache_valid_time: 3600
with_items:
- automake
- libtool
- libpng-dev
- zlib1g-dev
- name: Clone poanetwork/blockscout repo from GitHub
git:
repo: "https://github.com/{{ MAIN_REPO_FETCH }}/blockscout"
dest: "{{ home }}/blockscout"
version: "{{ blockscout_version }}"
- name: Add explorer dev.secret
template:
src: dev.secret.j2
dest: "{{ home }}/blockscout/apps/explorer/config/dev.secret.exs"
- name: Add block_scout_web dev.secret
shell: cp {{ home }}/blockscout/apps/block_scout_web/config/dev.secret.exs.example {{ home }}/blockscout/apps/block_scout_web/config/dev.secret.exs
- name: Install dependencies
shell: cd {{ home }}/blockscout && mix local.hex --force && mix do deps.get, local.rebar --force, deps.compile, compile
- name: Change postgres password
shell: sudo -u postgres psql -c "alter user postgres with encrypted password '{{ postgres_password }}';"
- name: Create db user
shell: sudo -u postgres psql -c "create user {{ db_user }};"
- name: Make db user a superuser
shell: sudo -u postgres psql -c "alter user {{ db_user }} with superuser;"
- name: Set password for db user
shell: sudo -u postgres psql -c "alter user {{ db_user }} with encrypted password '{{ db_user_password }}';"
- name: Create db
shell: cd {{ home }}/blockscout && mix do ecto.create, ecto.migrate
- name: Install node dependensies in the apps/block_scout_web
shell: cd {{ home }}/blockscout/apps/block_scout_web/assets && npm install; cd -
- name: Install node-sass
shell: cd {{ home }}/blockscout/apps/block_scout_web/assets && npm install node-sass --unsafe-perm; cd -
- name: Install node dependensies in the apps/explorer
shell: cd {{ home }}/blockscout/apps/explorer && npm install; cd -
- name: Start server
shell: cd {{ home }}/blockscout && mix phx.server

View File

@ -0,0 +1,6 @@
use Mix.Config
config :explorer, Explorer.Repo,
username: "{{ db_user }}",
password: "{{ db_user_password }}"

View File

@ -17,3 +17,7 @@
- name: Validator deployment
import_playbook: validator.yml
tags: validator
- name: Blockscout deployment
import_playbook: blockscout.yml
tags: blockscout

3
tests/blockscout.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
echo "This is a stub for blockscout integration tests"