forked from graphprotocol/indexer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
k8s, terraform: Update infrastructure for new payments
Changes in this commit: - Split up the terraform configuration into separate files, grouping private information under new secrets. - Make indexer-agent and indexer-service stateful sets. - Add Vector node configuration and stateful set.
- Loading branch information
Showing
15 changed files
with
417 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: indexer-agent | ||
spec: | ||
type: NodePort | ||
selector: | ||
app: indexer-agent | ||
ports: | ||
- name: vector-events | ||
protocol: TCP | ||
port: 8001 | ||
targetPort: 8001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: vector-node | ||
spec: | ||
selector: | ||
app: vector-node | ||
ports: | ||
- name: api | ||
protocol: TCP | ||
port: 80 | ||
targetPort: api | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: vector-node | ||
labels: | ||
app: vector-node | ||
spec: | ||
serviceName: vector-node | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: vector-node | ||
template: | ||
metadata: | ||
labels: | ||
app: vector-node | ||
spec: | ||
containers: | ||
- name: node | ||
image: vector-node | ||
ports: | ||
- name: api | ||
containerPort: 8000 | ||
livenessProbe: | ||
httpGet: | ||
path: /ping | ||
port: 8000 | ||
readinessProbe: | ||
httpGet: | ||
path: /ping | ||
port: 8000 | ||
env: | ||
- name: VECTOR_CONFIG | ||
valueFrom: | ||
secretKeyRef: | ||
name: vector-env | ||
key: config | ||
- name: VECTOR_PROD | ||
value: 'true' | ||
- name: VECTOR_MNEMONIC | ||
valueFrom: | ||
secretKeyRef: | ||
name: vector-env | ||
key: mnemonic | ||
- name: VECTOR_PG_HOST | ||
valueFrom: | ||
secretKeyRef: | ||
name: postgres-credentials | ||
key: host | ||
- name: VECTOR_PG_PORT | ||
value: '5432' | ||
- name: VECTOR_PG_DATABASE | ||
valueFrom: | ||
secretKeyRef: | ||
name: postgres-credentials | ||
key: vector_db | ||
- name: VECTOR_PG_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: postgres-credentials | ||
key: user | ||
- name: VECTOR_PG_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: postgres-credentials | ||
key: password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
kind: StatefulSet | ||
metadata: | ||
name: indexer-service | ||
spec: | ||
replicas: 4 | ||
template: | ||
spec: | ||
containers: | ||
- name: indexer-service | ||
env: | ||
# Set this to your Ethereum node/provider | ||
- name: INDEXER_SERVICE_ETHEREUM | ||
value: https://kovan.alchemyapi.io/jsonrpc/demo/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# | ||
# CloudSQL Postgres Database | ||
# | ||
|
||
# CloudSQL requires that a fairly long, unspecified amount of time | ||
# passes before a database name can be reused. To ease testing where | ||
# we create and destroy databases a lot, we append 4 random digits to | ||
# the database name. | ||
resource "random_integer" "dbname" { | ||
min = 1000 | ||
max = 9999 | ||
keepers = { | ||
indexer = "${var.indexer}" | ||
} | ||
} | ||
|
||
resource "google_sql_database_instance" "graph" { | ||
database_version = "POSTGRES_12" | ||
name = "${var.indexer}-${random_integer.dbname.result}" | ||
settings { | ||
activation_policy = "ALWAYS" | ||
availability_type = "ZONAL" | ||
disk_autoresize = true | ||
disk_size = 100 | ||
disk_type = "PD_SSD" | ||
tier = var.database_tier | ||
ip_configuration { | ||
ipv4_enabled = false | ||
private_network = "projects/${var.project}/global/networks/default" | ||
} | ||
backup_configuration { | ||
binary_log_enabled = false | ||
enabled = true | ||
start_time = "02:00" | ||
} | ||
database_flags { | ||
name = "log_temp_files" | ||
value = "-1" | ||
} | ||
database_flags { | ||
name = "log_lock_waits" | ||
value = "on" | ||
} | ||
} | ||
} | ||
|
||
resource "google_sql_database" "graph" { | ||
name = "graph" | ||
instance = google_sql_database_instance.graph.name | ||
} | ||
|
||
resource "google_sql_database" "indexer-service" { | ||
name = "indexer-service" | ||
instance = google_sql_database_instance.graph.name | ||
} | ||
|
||
resource "google_sql_database" "vector" { | ||
name = "vector" | ||
instance = google_sql_database_instance.graph.name | ||
} | ||
|
||
resource "google_sql_user" "graph" { | ||
name = "graph" | ||
instance = google_sql_database_instance.graph.name | ||
password = var.database_password | ||
} |
Oops, something went wrong.