run all faucets on just one host
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
b39720f7b1
commit
a3e837297d
|
@ -14,6 +14,10 @@ This repo defines infrasctructure for Rinkeby and Ropsten Ethereum faucets.
|
||||||
|
|
||||||
For how to use this repo read the [Infra Repo Usage](https://github.com/status-im/infra-docs/blob/master/articles/infra_repo_usage.md) doc.
|
For how to use this repo read the [Infra Repo Usage](https://github.com/status-im/infra-docs/blob/master/articles/infra_repo_usage.md) doc.
|
||||||
|
|
||||||
|
# Miners
|
||||||
|
|
||||||
|
Currently there are no miners. Mainly because we have plenty of ETH in Ropsten and both Rinkeby and Goerli are Proof-of-Authority neworks, so mining doesn't give rewards.
|
||||||
|
|
||||||
# Sub-Sections
|
# Sub-Sections
|
||||||
|
|
||||||
Read up on the roles:
|
Read up on the roles:
|
||||||
|
|
|
@ -1,27 +1,35 @@
|
||||||
---
|
---
|
||||||
# stage contains the network name
|
# WARNING: this needs to be set
|
||||||
faucet_network: '{{ stage }}'
|
faucet_network: '{{ faucet_network | mandatory }}'
|
||||||
faucet_domain: 'faucet-{{ stage }}.status.im'
|
|
||||||
|
# faucet api settings
|
||||||
|
faucet_cont_name: 'faucet-{{ faucet_network }}-api'
|
||||||
|
faucet_domain: 'faucet-{{ faucet_network }}.status.im'
|
||||||
faucet_cors_rule: '^https?://.*\.infura\.status.im'
|
faucet_cors_rule: '^https?://.*\.infura\.status.im'
|
||||||
faucet_geth_cont_alias: 'faucet-geth'
|
faucet_geth_cont_name: '{{ geth_cont_name }}'
|
||||||
faucet_account_pass: '{{lookup("passwordstore", "services/faucet/account-pass")}}'
|
faucet_account_pass: '{{lookup("passwordstore", "services/faucet/account-pass")}}'
|
||||||
|
faucet_geth_cont_rpc_port: '{{ geth_rpc_port }}'
|
||||||
|
|
||||||
# geth necessary for Faucet to work
|
# geth necessary for Faucet to work
|
||||||
geth_network_name: '{{ faucet_network }}'
|
geth_network_name: '{{ faucet_network }}'
|
||||||
geth_rpc_port: '{{ faucet_geth_cont_rpc_port }}'
|
geth_rpc_port: '{{ faucet_geth_cont_rpc_port }}'
|
||||||
geth_cont_name: '{{ faucet_geth_cont_name }}'
|
geth_cont_name: 'faucet-{{ faucet_network }}-geth'
|
||||||
geth_extra_alias: '{{ faucet_geth_cont_alias }}'
|
geth_extra_alias: '{{ faucet_geth_cont_name }}'
|
||||||
geth_sync_mode: '{{ (stage == "goerli") | ternary("full", "light") }}'
|
geth_sync_mode: '{{ (faucet_network == "goerli") | ternary("full", "light") }}'
|
||||||
geth_log_level_name: info
|
geth_log_level_name: info
|
||||||
|
|
||||||
# adjust cache size to available memory
|
# adjust cache size to available memory
|
||||||
mem_cache_ratio: 0.75
|
mem_cache_ratio: 0.3
|
||||||
geth_cache: '{{ (ansible_memtotal_mb * mem_cache_ratio|float) | int }}'
|
geth_cache: '{{ (ansible_memtotal_mb * mem_cache_ratio|float) | int }}'
|
||||||
|
# has to be higher than mem_cache_ratio
|
||||||
|
cont_mem_ratio: 0.2
|
||||||
|
|
||||||
|
# credentials for the wallet
|
||||||
geth_account_pass: '{{lookup("passwordstore", "services/faucet/account-pass")}}'
|
geth_account_pass: '{{lookup("passwordstore", "services/faucet/account-pass")}}'
|
||||||
geth_account_addr: '{{lookup("passwordstore", "services/faucet/account-addr")}}'
|
geth_account_addr: '{{lookup("passwordstore", "services/faucet/account-addr")}}'
|
||||||
geth_account_json: '{{lookup("passwordstore", "services/faucet/account-json")}}'
|
geth_account_json: '{{lookup("passwordstore", "services/faucet/account-json")}}'
|
||||||
|
|
||||||
# geth metrics
|
# geth metrics
|
||||||
geth_source_cont_name: '{{ geth_cont_name }}'
|
geth_source_cont_name: '{{ geth_cont_name }}'
|
||||||
geth_expo_cont_name: '{{ geth_cont_name }}-metrics'
|
geth_expo_cont_name: 'faucet-{{ faucet_network }}-metrics'
|
||||||
|
geth_expo_consul_name: '{{ geth_expo_cont_name }}'
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
---
|
|
||||||
# stage contains the network name
|
|
||||||
geth_network_name: '{{ stage }}'
|
|
||||||
geth_miner_enabled: true
|
|
||||||
geth_cont_name: 'geth-miner'
|
|
||||||
geth_extra_alias: 'miner'
|
|
||||||
geth_sync_mode: full
|
|
||||||
geth_log_level_name: info
|
|
||||||
|
|
||||||
# adjust cache size to available memory
|
|
||||||
mem_cache_ratio: 0.6
|
|
||||||
geth_cache: '{{ (ansible_memtotal_mb * mem_cache_ratio|float) | int }}'
|
|
||||||
# has to be higher than mem_cache_ratio
|
|
||||||
cont_mem_ratio: 0.8
|
|
||||||
|
|
||||||
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")}}'
|
|
||||||
|
|
||||||
# geth metrics
|
|
||||||
geth_source_cont_name: '{{ geth_cont_name }}'
|
|
||||||
geth_expo_cont_name: '{{ geth_cont_name }}-metrics'
|
|
|
@ -1,22 +1,48 @@
|
||||||
---
|
---
|
||||||
- name: Configure faucet proxy
|
- name: Install origin certificates
|
||||||
hosts: faucet-master
|
hosts: faucet-master
|
||||||
roles:
|
roles:
|
||||||
- role: origin-cert
|
- role: origin-cert
|
||||||
tags: origin-cert
|
|
||||||
- role: infra-role-geth
|
|
||||||
tags: geth
|
|
||||||
- role: infra-role-geth-exporter
|
|
||||||
tags: metrics
|
|
||||||
- role: geth-peer-fix
|
|
||||||
tags: geth-peer-fix
|
|
||||||
- role: faucet-api
|
|
||||||
tags: faucet-api
|
|
||||||
|
|
||||||
- name: Configure faucet miners
|
- name: Configure ropsten faucet
|
||||||
hosts: faucet-miners
|
hosts: faucet-master
|
||||||
roles:
|
roles:
|
||||||
- role: infra-role-geth
|
- role: infra-role-geth
|
||||||
tags: geth
|
|
||||||
- role: infra-role-geth-exporter
|
- role: infra-role-geth-exporter
|
||||||
tags: metrics
|
- role: faucet-api
|
||||||
|
- role: geth-peer-fix
|
||||||
|
vars:
|
||||||
|
faucet_network: ropsten
|
||||||
|
faucet_http_port: 3000
|
||||||
|
geth_port: 30303
|
||||||
|
geth_rpc_port: 8545
|
||||||
|
geth_expo_cont_port: 9200
|
||||||
|
|
||||||
|
- name: Configure rinkeby faucet
|
||||||
|
hosts: faucet-master
|
||||||
|
roles:
|
||||||
|
- role: infra-role-geth
|
||||||
|
- role: infra-role-geth-exporter
|
||||||
|
- role: faucet-api
|
||||||
|
- role: geth-peer-fix
|
||||||
|
vars:
|
||||||
|
faucet_network: rinkeby
|
||||||
|
faucet_http_port: 3001
|
||||||
|
geth_port: 30304
|
||||||
|
geth_rpc_port: 8546
|
||||||
|
geth_expo_cont_port: 9201
|
||||||
|
|
||||||
|
|
||||||
|
- name: Configure rinkeby faucet
|
||||||
|
hosts: faucet-master
|
||||||
|
roles:
|
||||||
|
- role: infra-role-geth
|
||||||
|
- role: infra-role-geth-exporter
|
||||||
|
- role: faucet-api
|
||||||
|
- role: geth-peer-fix
|
||||||
|
vars:
|
||||||
|
faucet_network: goerli
|
||||||
|
faucet_http_port: 3002
|
||||||
|
geth_port: 30305
|
||||||
|
geth_rpc_port: 8547
|
||||||
|
geth_expo_cont_port: 9202
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
ports:
|
ports:
|
||||||
- '127.0.0.1:{{ faucet_http_port | mandatory }}:{{ faucet_http_port }}'
|
- '127.0.0.1:{{ faucet_http_port | mandatory }}:{{ faucet_http_port }}'
|
||||||
command: |
|
command: |
|
||||||
|
-endpoint=":{{ faucet_http_port }}"
|
||||||
-network={{ faucet_network | mandatory }}
|
-network={{ faucet_network | mandatory }}
|
||||||
-geth=http://{{ faucet_geth_cont_alias }}:{{ faucet_geth_cont_rpc_port }}/
|
-geth=http://{{ faucet_geth_cont_alias }}:{{ faucet_geth_cont_rpc_port }}/
|
||||||
-acc_pass={{ faucet_account_pass | mandatory }}
|
-acc_pass={{ faucet_account_pass | mandatory }}
|
||||||
|
|
45
main.tf
45
main.tf
|
@ -25,22 +25,17 @@ terraform {
|
||||||
key_file = "ansible/files/consul-client.key"
|
key_file = "ansible/files/consul-client.key"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* WORKSPACES -----------------------------------*/
|
|
||||||
|
|
||||||
locals {
|
|
||||||
ws = "${merge(local.env["defaults"], local.env[terraform.workspace])}"
|
|
||||||
}
|
|
||||||
|
|
||||||
/* RESOURCES ------------------------------------*/
|
/* RESOURCES ------------------------------------*/
|
||||||
|
|
||||||
module "faucet-master" {
|
module "main" {
|
||||||
source = "github.com/status-im/infra-tf-google-cloud"
|
source = "github.com/status-im/infra-tf-google-cloud"
|
||||||
name = "master"
|
name = "master"
|
||||||
env = "faucet"
|
env = "faucet"
|
||||||
group = "faucet-master"
|
group = "faucet-master"
|
||||||
type = "n1-standard-1"
|
type = "n1-standard-1"
|
||||||
count = 1
|
count = 1
|
||||||
vol_size = "${local.ws["master_volume_size"]}"
|
vol_size = 10
|
||||||
domain = "${var.domain}"
|
domain = "${var.domain}"
|
||||||
open_ports = [
|
open_ports = [
|
||||||
"80-80", /* HTTP */
|
"80-80", /* HTTP */
|
||||||
|
@ -49,26 +44,28 @@ module "faucet-master" {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "cloudflare_record" "api" {
|
/* DNS Entries for faucet APIs */
|
||||||
|
|
||||||
|
resource "cloudflare_record" "main-ropsten" {
|
||||||
domain = "${var.public_domain}"
|
domain = "${var.public_domain}"
|
||||||
name = "faucet-${terraform.workspace}"
|
name = "faucet-ropsten"
|
||||||
value = "${module.faucet-master.public_ips[0]}"
|
value = "${module.main.public_ips[0]}"
|
||||||
type = "A"
|
type = "A"
|
||||||
proxied = true
|
proxied = true
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MINERS ---------------------------------------*/
|
resource "cloudflare_record" "main-rinkeby" {
|
||||||
|
domain = "${var.public_domain}"
|
||||||
module "faucet-miners" {
|
name = "faucet-rinkeby"
|
||||||
source = "github.com/status-im/infra-tf-google-cloud"
|
value = "${module.main.public_ips[0]}"
|
||||||
name = "miner"
|
type = "A"
|
||||||
env = "faucet"
|
proxied = true
|
||||||
group = "faucet-miners"
|
}
|
||||||
count = "${local.ws["miner_count"]}"
|
|
||||||
type = "${local.ws["miner_instance_type"]}"
|
resource "cloudflare_record" "main-goerli" {
|
||||||
vol_size = "${local.ws["miner_volume_size"]}"
|
domain = "${var.public_domain}"
|
||||||
domain = "${var.domain}"
|
name = "faucet-goerli"
|
||||||
open_ports = [
|
value = "${module.main.public_ips[0]}"
|
||||||
"30303" /* GETH */
|
type = "A"
|
||||||
]
|
proxied = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
/* WORKSPACES ---------------------------------------------*/
|
|
||||||
/**
|
|
||||||
* This is a hacky way of binding specific variable
|
|
||||||
* values to different Terraform workspaces.
|
|
||||||
*
|
|
||||||
* Details:
|
|
||||||
* https://github.com/hashicorp/terraform/issues/15966
|
|
||||||
*/
|
|
||||||
|
|
||||||
locals {
|
|
||||||
env = {
|
|
||||||
defaults = {
|
|
||||||
miner_count = 3
|
|
||||||
/* By default we use 2 CPU 7.5 GB RAM instances */
|
|
||||||
miner_instance_type = "n1-standard-2"
|
|
||||||
/* 100 GBs is fine for now */
|
|
||||||
miner_volume_size = 100
|
|
||||||
/* 10 Gbs is fine, master usually syncs with LES */
|
|
||||||
master_volume_size = 10
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Default settings for Rinkeby */
|
|
||||||
rinkeby = {
|
|
||||||
/* Proof-of-Authority neworks don't give mining rewards */
|
|
||||||
miner_count = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ropsten is memory intensive, 13 GB of RAM given */
|
|
||||||
ropsten = {
|
|
||||||
miner_instance_type = "n1-highmem-2"
|
|
||||||
/* Currently we have ~64k ETH on Ropsten, no need for miners */
|
|
||||||
miner_count = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
goerli = {
|
|
||||||
master_volume_size = 50
|
|
||||||
/* Proof-of-Authority neworks don't give mining rewards */
|
|
||||||
miner_count = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------*/
|
|
Loading…
Reference in New Issue