Fixes issues 83, 89, 91, 93. Also fixes issue with provisioning an io1 DB
This commit is contained in:
parent
ea30bc6a4f
commit
0b39626c1f
12
README.md
12
README.md
|
@ -63,6 +63,7 @@ alb_ssl_policy: "ELBSecurityPolicy-2016-08"
|
|||
alb_certificate_arn: "arn:aws:acm:us-east-1:290379793816:certificate/6d1bab74-fb46-4244-aab2-832bf519ab24"
|
||||
root_block_size: 120
|
||||
pool_size: 30
|
||||
elixir_version: v1.7.4
|
||||
secret_key_base: "TPGMvGK0iIwlXBQuQDA5KRqk77VETbEBlG4gAWeb93TvBsYAjvoAvdODMd6ZeguPwf2YTRY3n7uvxXzQP4WayQ=="
|
||||
new_relic_app_name: ""
|
||||
new_relic_license_key: ""
|
||||
|
@ -110,7 +111,9 @@ chain_db_instance_class:
|
|||
chain_db_storage:
|
||||
mychain: "200"
|
||||
chain_db_storage_type:
|
||||
mychain: "gp2"
|
||||
chain: "io1"
|
||||
chain_db_iops:
|
||||
chain: "1000"
|
||||
chain_db_version:
|
||||
mychain: "10.5"
|
||||
```
|
||||
|
@ -121,7 +124,12 @@ chain_db_version:
|
|||
- `bucket` and `dynamodb_table` represents the name of AWS resources that will be used for Terraform state management;
|
||||
- If `ec2_ssh_key_content` variable is not empty, Terraform will try to create EC2 SSH key with the `ec2_ssh_key_name` name. Otherwise, the existing key with `ec2_ssh_key_name` name will be used;
|
||||
- `instance_type` defines a size of the Blockscout instance that will be launched during the deployment process;
|
||||
- `vpc_cidr`, `public_subnet_cidr`, `db_subnet_cidr` represents the network configuration for the deployment. Usually you want to leave it as is. However, if you want to modify it, please, expect that `db_subnet_cidr` represents not a single network, but a group of networks united with one CIDR block that will be divided during the deployment. For details, see [subnets.tf](https://github.com/ArseniiPetrovich/blockscout-terraform/blob/master/roles/main_infra/files/subnets.tf#L35) for details;
|
||||
- `vpc_cidr`, `public_subnet_cidr`, `db_subnet_cidr` represents the network configuration for the deployment. Usually you want to leave it as is. However, if you want to modify it, please, expect that `db_subnet_cidr` represents not a single network, but a group of networks started with defined CIDR block increased by 8 bits.
|
||||
Example:
|
||||
Number of networks: 2
|
||||
`db_subnet_cidr`: "10.0.1.0/16"
|
||||
Real networks: 10.0.1.0/24 and 10.0.2.0/24
|
||||
|
||||
- An internal DNS zone with`dns_zone_name` name will be created to take care of BlockScout internal communications;
|
||||
- `prefix` - is a unique tag to use for provisioned resources (5 alphanumeric chars or less);
|
||||
- The name of a IAM key pair to use for EC2 instances, if you provide a name which
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
- name: Clean TF cache
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- name: Clean TF cache
|
||||
file:
|
||||
state: absent
|
||||
path: "{{ item }}"
|
||||
with_items:
|
||||
- roles/main_infra/files/.terraform
|
||||
- roles/main_infra/files/terraform.tfstate.d
|
||||
- roles/main_infra/files/main.tfvars
|
||||
- roles/main_infra/files/backend.tfvars
|
|
@ -26,6 +26,9 @@ instance_type: "m5.large"
|
|||
## VPC containing Blockscout resources will be created as following:
|
||||
vpc_cidr: "10.0.0.0/16"
|
||||
public_subnet_cidr: "10.0.0.0/24"
|
||||
# This variable should be interpreted as following:
|
||||
# Variable: 10.0.1.0/16
|
||||
# Real networks: 10.0.1+{{ number of chain starting with 0 }}.0/24
|
||||
db_subnet_cidr: "10.0.1.0/16"
|
||||
|
||||
## Internal DNS zone will looks like:
|
||||
|
@ -55,6 +58,9 @@ secret_key_base: "TPGMvGK0iIwlXBQuQDA5KRqk77VETbEBlG4gAWeb93TvBsYAjvoAvdODMd6Zeg
|
|||
new_relic_app_name: ""
|
||||
new_relic_license_key: ""
|
||||
|
||||
## The following variable represents the elixir version that will be used to run BlockScout instance. Will be used to download the Elixir at the following link: https://github.com/elixir-lang/elixir/releases/download/{{ elixir_version }}/Precompiled.zip
|
||||
elixir_version: "v1.7.4"
|
||||
|
||||
# Network related variables
|
||||
## This variable represents network RPC endpoint:
|
||||
chains:
|
||||
|
@ -163,6 +169,11 @@ chain_db_storage_type:
|
|||
core: "io1"
|
||||
sokol: "gp2"
|
||||
|
||||
# This should be set only if chain_db_storage is set to io1
|
||||
#chain_db_iops:
|
||||
# core: "1000"
|
||||
# sokol: "1500"
|
||||
|
||||
# Blockscout uses Postgres as the DB engine. This variable describes the Postgres version used in each particular chain.
|
||||
chain_db_version:
|
||||
core: "10.5"
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
msg: "The prefix '{{ prefix }}' is invalid. It must consist only of the lowercase characters a-z and digits 0-9, and must be between 3 and 5 characters long."
|
||||
when: prefix|length < 3 or prefix|length > 5 or prefix is not match("^[a-z0-9]+$")
|
||||
|
||||
- name: Check chain names
|
||||
fail:
|
||||
msg: "The prefix '{{ item }}' is invalid. It must consist only of the lowercase characters a-z and digits 0-9, and must not more than 5 characters long."
|
||||
when: item.key|length > 5 or item.key is not match("^[a-z0-9]+$")
|
||||
with_dict: "{{ chains }}"
|
||||
|
||||
- name: Check if terraform is installed
|
||||
command: which terraform
|
||||
register: terraform_status
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
resource "aws_ssm_parameter" "elixir_version" {
|
||||
count = "${var.new_relic_license_key == "" ? 0 : length(var.chains)}"
|
||||
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/elixir_version"
|
||||
value = "${var.elixir_version}"
|
||||
type = "String"
|
||||
}
|
||||
|
||||
resource "aws_ssm_parameter" "block_transformer" {
|
||||
count = "${length(var.chains)}"
|
||||
name = "/${var.prefix}/${element(keys(var.chains),count.index)}/block_transformer"
|
||||
|
|
|
@ -135,9 +135,10 @@ wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/
|
|||
yum install -y wxGTK-devel unixODBC-devel >"$LOG"
|
||||
yum install -y esl-erlang_21.1-1~centos~7_amd64.rpm >"$LOG"
|
||||
|
||||
ELIXIR_VERSION="$(get_param 'elixir_version')"
|
||||
log "Installing Elixir to /opt/elixir.."
|
||||
mkdir -p /opt/elixir
|
||||
wget https://github.com/elixir-lang/elixir/releases/download/v1.7.4/Precompiled.zip >"$LOG"
|
||||
wget https://github.com/elixir-lang/elixir/releases/download/${ELIXIR_VERSION}/Precompiled.zip >"$LOG"
|
||||
unzip Precompiled.zip -d /opt/elixir >"$LOG"
|
||||
log "Elixir installed successfully!"
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ resource "aws_db_instance" "default" {
|
|||
vpc_security_group_ids = ["${aws_security_group.database.id}"]
|
||||
db_subnet_group_name = "${aws_db_subnet_group.database.id}"
|
||||
apply_immediately = true
|
||||
iops = "${lookup(var.chain_db_iops,element(keys(var.chains),count.index),"0")}"
|
||||
|
||||
|
||||
depends_on = ["aws_security_group.database"]
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ variable "dns_zone_name" {}
|
|||
variable "instance_type" {}
|
||||
variable "root_block_size" {}
|
||||
variable "pool_size" {}
|
||||
variable "elixir_version" {}
|
||||
|
||||
variable "key_content" {
|
||||
default = ""
|
||||
|
@ -71,6 +72,10 @@ variable "chain_db_storage_type" {
|
|||
default = {}
|
||||
}
|
||||
|
||||
variable "chain_db_iops" {
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "chain_db_instance_class" {
|
||||
default = {}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ use_ssl = "{{ use_ssl }}"
|
|||
new_relic_app_name = "{{ new_relic_app_name }}"
|
||||
new_relic_license_key = "{{ new_relic_license_key }}"
|
||||
secret_key_base = "{{ secret_key_base }}"
|
||||
elixir_version = "{{ elixir_version }}"
|
||||
|
||||
chains = {
|
||||
{% for key, value in chains.iteritems() %}
|
||||
|
@ -149,6 +150,12 @@ chain_db_storage_type = {
|
|||
{% endfor %}
|
||||
}
|
||||
|
||||
chain_db_iops = {
|
||||
{% for key, value in chain_db_iops.iteritems() %}
|
||||
{{ key }} = "{{ value }}"{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
chain_db_version = {
|
||||
{% for key, value in chain_db_version.iteritems() %}
|
||||
{{ key }} = "{{ value }}"{% if not loop.last %},{% endif %}
|
||||
|
|
Loading…
Reference in New Issue