mirror of
https://github.com/status-im/infra-faucet.git
synced 2025-02-24 00:28:30 +00:00
use the new infra-role-geth for faucet API
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
ed58e6acf0
commit
1d7a23f5b7
@ -1,8 +1,20 @@
|
||||
---
|
||||
# stage contains the network name
|
||||
faucet_network: '{{ stage }}'
|
||||
faucet_account_pass: '{{lookup("passwordstore", "services/faucet/account-pass")}}'
|
||||
faucet_account_addr: '{{lookup("passwordstore", "services/faucet/account-addr")}}'
|
||||
faucet_account_json: '{{lookup("passwordstore", "services/faucet/account-json")}}'
|
||||
faucet_domain: 'faucet-{{ stage }}.status.im'
|
||||
faucet_cors_rule: '^https?://.*\.infura\.status.im'
|
||||
#faucet_geth_rpc_port: 8545
|
||||
#faucet_geth_name: 'faucet-geth'
|
||||
#faucet_geth_alias: 'geth'
|
||||
|
||||
# geth necessary for Faucet to work
|
||||
geth_network_name: '{{ faucet_network }}'
|
||||
geth_rpc_port: '{{ faucet_geth_cont_rpc_port }}'
|
||||
geth_cont_name: '{{ faucet_geth_cont_name }}'
|
||||
geth_extra_alias: '{{ faucet_geth_cont_alias }}'
|
||||
geth_sync_mode: light
|
||||
geth_log_level_name: info
|
||||
|
||||
geth_account_pass: '{{lookup("passwordstore", "services/faucet/account-pass")}}'
|
||||
geth_account_addr: '{{lookup("passwordstore", "services/faucet/account-addr")}}'
|
||||
geth_account_json: '{{lookup("passwordstore", "services/faucet/account-json")}}'
|
||||
|
@ -4,6 +4,8 @@
|
||||
roles:
|
||||
- role: origin-cert
|
||||
tags: origin-cert
|
||||
- role: infra-role-geth
|
||||
tags: geth
|
||||
- role: faucet
|
||||
tags: faucet
|
||||
|
||||
|
@ -16,3 +16,7 @@
|
||||
- name: consul-service
|
||||
src: git@github.com:status-im/infra-role-consul-service.git
|
||||
scm: git
|
||||
|
||||
- name: infra-role-geth
|
||||
src: git@github.com:status-im/infra-role-geth.git
|
||||
scm: git
|
||||
|
@ -2,13 +2,21 @@
|
||||
|
||||
This role configures the [faucet](https://github.com/status-im/faucet) service which provides a REST API for receiving funds from our Ropsten and Rinkeby miner cluster.
|
||||
|
||||
# Requirements
|
||||
|
||||
This role assumes it has a `geth` container with JSON RPC port open.
|
||||
|
||||
The container needs to match these settings:
|
||||
```yaml
|
||||
faucet_geth_cont_name: 'faucet-geth'
|
||||
faucet_geth_cont_alias: 'geth'
|
||||
faucet_geth_cont_rpc_port: 8545
|
||||
```
|
||||
|
||||
# Configuration
|
||||
|
||||
The only required settings are:
|
||||
```yaml
|
||||
faucet_account_addr: 0x12312312312312321
|
||||
faucet_account_json: '{"wallet":"json"}'
|
||||
faucet_account_pass: 'very-secret-password'
|
||||
faucet_network: 'rinkeby-faucet.example.org'
|
||||
faucet_domain: 'rinkeby'
|
||||
faucet_cors_rule: '.*'
|
||||
|
@ -1,7 +1,4 @@
|
||||
---
|
||||
faucet_account_pass: ~
|
||||
faucet_account_addr: ~
|
||||
faucet_account_json: ~
|
||||
faucet_domain: ~
|
||||
faucet_network: ~
|
||||
faucet_cors_rule: ~
|
||||
@ -11,18 +8,10 @@ faucet_cont_image: 'statusteam/faucet:{{ faucet_cont_tag }}'
|
||||
faucet_cont_name: 'faucet-api'
|
||||
faucet_http_port: 3001
|
||||
|
||||
faucet_geth_sync_mode: light
|
||||
faucet_geth_tag: 'v1.8.26'
|
||||
faucet_geth_image: 'ethereum/client-go:{{ faucet_geth_tag }}'
|
||||
faucet_geth_name: 'faucet-geth'
|
||||
faucet_geth_vol: '/docker/{{ faucet_geth_name }}'
|
||||
faucet_geth_main_port: 30303
|
||||
faucet_geth_rpc_port: 8545
|
||||
faucet_geth_rcp_api: 'eth,net,web3,admin,personal,shh'
|
||||
faucet_geth_alias: 'geth'
|
||||
faucet_geth_bootnodes: []
|
||||
# 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail
|
||||
faucet_geth_log_level: 3
|
||||
# info about geth container we connect to
|
||||
faucet_geth_cont_name: 'faucet-geth'
|
||||
faucet_geth_cont_alias: 'geth'
|
||||
faucet_geth_cont_rpc_port: 8545
|
||||
|
||||
# generic container settings
|
||||
cont_state: started
|
||||
|
@ -1,31 +1,4 @@
|
||||
---
|
||||
- name: Create geth sync check script
|
||||
copy:
|
||||
dest: /usr/local/bin/check_geth_sync.sh
|
||||
mode: 0755
|
||||
content: |
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
echo -n "Geth synced: "
|
||||
RESP=$(curl -s -X POST -H 'Content-type:application/json' \
|
||||
--data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' \
|
||||
http://localhost:{{ faucet_geth_rpc_port }}/)
|
||||
echo "${RESP}" | jq -e ".result == false" \
|
||||
|| ( echo "${RESP}" | jq . ; exit 1 )
|
||||
|
||||
- name: 'Consul service definition - {{ faucet_geth_name }}-rpc'
|
||||
include_role: name=consul-service
|
||||
vars:
|
||||
consul_config_name: '{{ faucet_geth_name | replace("-", "_") }}_rpc'
|
||||
consul_services:
|
||||
- name: '{{ faucet_geth_name }}-rpc'
|
||||
tags: ['{{ env }}.{{ stage }}', 'faucet', 'geth', 'rpc']
|
||||
port: '{{ faucet_geth_rpc_port }}'
|
||||
checks:
|
||||
- id: faucet-geth-sync-status
|
||||
type: script
|
||||
script: '/usr/local/bin/check_geth_sync.sh'
|
||||
|
||||
- name: 'Consul service definition - {{ faucet_cont_name }}'
|
||||
include_role: name=consul-service
|
||||
vars:
|
||||
|
@ -13,10 +13,10 @@
|
||||
labels:
|
||||
com.centurylinklabs.watchtower.enable: 'true'
|
||||
links:
|
||||
- '{{ faucet_geth_name }}:{{ faucet_geth_alias }}'
|
||||
- '{{ faucet_geth_cont_name }}:{{ geth_extra_cont_alias }}'
|
||||
ports:
|
||||
- '127.0.0.1:{{ faucet_http_port | mandatory }}:{{ faucet_http_port }}'
|
||||
command: |
|
||||
-network={{ faucet_network | mandatory }}
|
||||
-geth=http://{{ faucet_geth_alias }}:{{ faucet_geth_rpc_port }}/
|
||||
-geth=http://{{ geth_extra_cont_alias }}:{{ faucet_geth_cont_rpc_port }}/
|
||||
-acc_pass={{ faucet_account_pass | mandatory }}
|
||||
|
@ -1,19 +1,4 @@
|
||||
---
|
||||
- name: Enable geth port
|
||||
iptables:
|
||||
comment: 'Enable geth {{ item }}'
|
||||
action: insert
|
||||
chain: DOCKER-USER
|
||||
jump: ACCEPT
|
||||
source: '0.0.0.0/0'
|
||||
protocol: '{{ item }}'
|
||||
destination_port: '{{ faucet_geth_main_port }}'
|
||||
with_items:
|
||||
- tcp
|
||||
- udp
|
||||
notify:
|
||||
- Save iptables rules
|
||||
|
||||
- name: Enable faucet HTTP port
|
||||
iptables:
|
||||
comment: 'Enable faucet'
|
||||
|
@ -1,34 +0,0 @@
|
||||
---
|
||||
- name: 'Create geth container: {{ faucet_geth_name }}'
|
||||
docker_container:
|
||||
name: '{{ faucet_geth_name }}'
|
||||
image: '{{ faucet_geth_image }}'
|
||||
user: root
|
||||
pull: true
|
||||
restart_policy: always
|
||||
state: '{{ cont_state }}'
|
||||
recreate: '{{ cont_recreate }}'
|
||||
restart: '{{ cont_restart }}'
|
||||
command: |
|
||||
{% if faucet_network == "rinkeby" %}
|
||||
--rinkeby
|
||||
{% elif faucet_network == "ropsten" %}
|
||||
--testnet
|
||||
{% endif %}
|
||||
--verbosity={{ faucet_geth_log_level }}
|
||||
--port={{ faucet_geth_main_port }}
|
||||
--unlock={{ faucet_account_addr }}
|
||||
--datadir=/data
|
||||
--password=/data/keystore/wallet.pass
|
||||
--syncmode={{ faucet_geth_sync_mode }}
|
||||
--rpc
|
||||
--rpcaddr=0.0.0.0
|
||||
--rpcapi={{ faucet_geth_rcp_api }}
|
||||
--rpcport={{ faucet_geth_rpc_port }}
|
||||
--rpcvhosts={{ faucet_geth_alias }},localhost
|
||||
--v5disc
|
||||
ports:
|
||||
- '127.0.0.1:{{ faucet_geth_rpc_port }}:{{ faucet_geth_rpc_port }}'
|
||||
- '{{ faucet_geth_main_port }}:{{ faucet_geth_main_port }}'
|
||||
volumes:
|
||||
- '{{ faucet_geth_vol }}/data:/data'
|
@ -1,7 +1,6 @@
|
||||
---
|
||||
- import_tasks: wrapper.yml
|
||||
- import_tasks: config.yml
|
||||
- import_tasks: geth.yml
|
||||
- import_tasks: faucet.yml
|
||||
- import_tasks: proxy.yml
|
||||
- import_tasks: firewall.yml
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
if [[ -z "$@" ]]; then
|
||||
docker exec -it {{ faucet_geth_name }} geth attach http://localhost:{{ faucet_geth_rpc_port }}
|
||||
else
|
||||
docker exec {{ faucet_geth_name }} geth attach http://localhost:{{ faucet_geth_rpc_port }} --exec "$@"
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user