Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM testnet tx-nodes & blockscout #687

Merged
merged 53 commits into from
Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
661e63f
VM testnet works, celotool initial and destroy works
tkporter Aug 6, 2019
079e3e0
Make names of resources specific to a celo_env
tkporter Aug 6, 2019
e0d23dc
Remove hardcoded vars for bootnode
tkporter Aug 6, 2019
607b991
Add small READMEs to terraform modules
tkporter Aug 6, 2019
e1935c6
Fix failing ci-lint
tkporter Aug 8, 2019
9b60aff
Specify kube-hosted ethstats in vm testnet
tkporter Aug 12, 2019
6bb0fc9
Make names of resources specific to a celo_env
tkporter Aug 6, 2019
523bb94
Remove hardcoded vars for bootnode
tkporter Aug 6, 2019
996b96e
Generate and upload vm testnet node secrets to google cloud
tkporter Aug 12, 2019
baeada5
Refactor to separate terraform logic from vm testnet logic
tkporter Aug 12, 2019
de2065f
Move toward using secrets via google storage
tkporter Aug 12, 2019
0446c52
Move terraform validators to use secrets from gcloud storage
tkporter Aug 13, 2019
387aac9
Make bootnode use cloud storage secrets
tkporter Aug 13, 2019
225fb7e
Go back to a load test bootnode key
tkporter Aug 13, 2019
17d72b1
Work on credentials
tkporter Aug 13, 2019
54fb33f
Add a service account for VMs whose permissions are limited
tkporter Aug 14, 2019
89ec2ae
Use correct ethstats secret
tkporter Aug 14, 2019
2525185
Merge master
tkporter Aug 14, 2019
6fda0e8
Fix unresolved merge conflict
tkporter Aug 14, 2019
99cacf4
Use correct ethstats secret
tkporter Aug 14, 2019
ac6cef2
Clean up
tkporter Aug 14, 2019
6af8e9e
Merge branch 'master' into trevor/vm-testnet-secrets
tkporter Aug 14, 2019
99f477d
Merge branch 'master' into trevor/vm-testnet-secrets
tkporter Aug 14, 2019
fb551b1
Merge branch 'master' into trevor/vm-testnet-secrets
tkporter Aug 14, 2019
b0a3aa1
Remove note in comment
tkporter Aug 15, 2019
e8082ec
Merge branch 'trevor/vm-testnet-secrets' of github.com:celo-org/celo-…
tkporter Aug 15, 2019
43a0b87
Merge branch 'master' into trevor/vm-testnet-secrets
tkporter Aug 15, 2019
ad59ded
Merge branch 'master' of github.com:celo-org/celo-monorepo into trevo…
tkporter Aug 16, 2019
ca5aa20
Add tx nodes
tkporter Aug 19, 2019
c9f8e91
Working internal tx-node load balancer
tkporter Aug 20, 2019
4b3dc39
Run terraform fmt
tkporter Aug 20, 2019
053d827
Set up blockscout
tkporter Aug 20, 2019
a6079ff
Blockscout working with VPC network destruction safety
tkporter Aug 21, 2019
009e5a3
Merge branch 'master' of github.com:celo-org/celo-monorepo into trevo…
tkporter Aug 21, 2019
417d91d
Minor fixes
tkporter Aug 21, 2019
b42201d
Terraform fmt
tkporter Aug 21, 2019
f05ff9a
Add env-utils.ts
tkporter Aug 21, 2019
c9c6659
More refactor
tkporter Aug 21, 2019
b06148f
Some more refactor
tkporter Aug 21, 2019
5bd70c0
Get rid of error
tkporter Aug 21, 2019
8121915
Get blockscout celotool working
tkporter Aug 21, 2019
b7bae58
Fix tsc build error
tkporter Aug 21, 2019
ba391b3
Clean up
tkporter Aug 21, 2019
595b034
Only use non default network for vm testnets
tkporter Aug 21, 2019
05dc5df
Merge branch 'master' of github.com:celo-org/celo-monorepo into trevo…
tkporter Aug 21, 2019
c182d38
Fix lint errors
tkporter Aug 21, 2019
d0d1032
Merge branch 'master' into trevor/vm-testnet-tx-nodes
tkporter Aug 22, 2019
7e9fbfa
Merge branch 'master' into trevor/vm-testnet-tx-nodes
tkporter Aug 22, 2019
161f69f
Hopefully fix import path error
tkporter Aug 22, 2019
69ad8e3
Merge branch 'master' of github.com:celo-org/celo-monorepo into trevo…
tkporter Aug 22, 2019
4a3d92a
Merge branch 'trevor/vm-testnet-tx-nodes' of github.com:celo-org/celo…
tkporter Aug 22, 2019
5a5d602
Fix create before destroy issue
tkporter Aug 22, 2019
348ba89
Merge branch 'master' into trevor/vm-testnet-tx-nodes
tkporter Aug 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move terraform validators to use secrets from gcloud storage
  • Loading branch information
tkporter committed Aug 14, 2019
commit 0446c52d3eca5034e4f2b59695f2c8bb61b0afee
2 changes: 0 additions & 2 deletions packages/celotool/src/cmds/deploy/upgrade/vm-testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { UpgradeArgv } from '@celo/celotool/src/cmds/deploy/upgrade'
import { deploy } from '@celo/celotool/src/lib/vm-testnet-utils'

export const command = 'vm-testnet'

export const describe = 'upgrade a testnet on a VM'

export const builder = {}

export const handler = async (argv: UpgradeArgv) => {
Expand Down
4 changes: 1 addition & 3 deletions packages/celotool/src/lib/terraform.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { execCmd } from '@celo/celotool/src/lib/utils'
import fs from 'fs'
import path from 'path'

import { generateGenesisFromEnv } from '@celo/celotool/src/lib/generate_utils'
import { envVar, execCmd, fetchEnv } from '@celo/celotool/src/lib/utils'

const terraformModulesPath = path.join(__dirname, '../../../terraform-modules')

export interface TerraformVars {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ resource "google_compute_instance" "bootnode" {
geth_bootnode_docker_image_repository: var.geth_bootnode_docker_image_repository,
geth_bootnode_docker_image_tag: var.geth_bootnode_docker_image_tag,
ip_address: google_compute_address.bootnode.address,
mnemonic: var.mnemonic
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ docker pull $CELOTOOL_DOCKER_IMAGE

echo "Generating node key..."
NODE_KEY=`docker run --rm $CELOTOOL_DOCKER_IMAGE \
celotooljs.sh generate bip32 --mnemonic "${mnemonic}" \
celotooljs.sh generate bip32 --mnemonic "this is a fake mnemonic" \
--accountType bootnode --index 0`

echo "Pulling bootnode..."
Expand Down
2 changes: 0 additions & 2 deletions packages/terraform-modules/testnet/modules/validator/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@ resource "google_compute_instance" "validator" {
gcloud_secrets_base_path: var.gcloud_secrets_base_path,
gcloud_secrets_bucket: var.gcloud_secrets_bucket,
genesis_content_base64: var.genesis_content_base64,
geth_account_secret: var.geth_account_secret,
geth_node_docker_image_repository: var.geth_node_docker_image_repository,
geth_node_docker_image_tag: var.geth_node_docker_image_tag,
geth_verbosity: var.geth_verbosity,
ip_address: google_compute_address.validator[count.index].address,
max_peers: var.validator_count * 2,
mnemonic: var.mnemonic,
network_id: var.network_id,
rid: count.index,
validator_name: "${var.celo_env}-validator-${count.index}",
Expand Down
45 changes: 9 additions & 36 deletions packages/terraform-modules/testnet/modules/validator/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,48 +12,21 @@ systemctl start docker
echo "Configuring Docker..."
gcloud auth configure-docker

# CELOTOOL_DOCKER_IMAGE=${celotool_docker_image_repository}:${celotool_docker_image_tag}
GETH_NODE_DOCKER_IMAGE=${geth_node_docker_image_repository}:${geth_node_docker_image_tag}

# download & apply secrets pulled from Cloud Storage as environment vars
echo "Downloading secrets from Google Cloud Storage..."
SECRETS_ENV_PATH=/var/.env.celo.secrets
gsutil cp gs://${gcloud_secrets_bucket}/${gcloud_secrets_base_path}/.env.validator-${rid} $SECRETS_ENV_PATH
# Applies the .env file
. $SECRETS_ENV_PATH

# docker pull $CELOTOOL_DOCKER_IMAGE
#
# echo "Pulled celotool docker image"
# # start the celotool Docker container so we can use it for multiple commands
# CELOTOOL_CONTAINER_ID=`docker run -td $CELOTOOL_DOCKER_IMAGE /bin/sh`
#
# echo "Created celotool container" $CELOTOOL_CONTAINER_ID
#
# celotooljs () {
# # NOTE(trevor): I ran into issues when using $@ directly in `docker exec`
# CELOTOOL_ARGS=$@
# docker exec $CELOTOOL_CONTAINER_ID /bin/sh -c "celotooljs.sh $CELOTOOL_ARGS"
# }
#
# # Set up account
#
# echo "Generating private key for rid=${rid}"
# PRIVATE_KEY=`celotooljs generate bip32 --mnemonic \"${mnemonic}\" --accountType validator --index ${rid}`
#
# echo "Generating address"
# ACCOUNT_ADDRESS=`celotooljs generate account-address --private-key $PRIVATE_KEY`
# echo "Address: $ACCOUNT_ADDRESS"
#
# echo "Generating Bootnode enode address for the validator:"
# BOOTNODE_ENODE_ADDRESS=`celotooljs generate public-key --mnemonic \"${mnemonic}\" --accountType load_testing --index 0`
# echo "Bootnode enode address: $BOOTNODE_ENODE_ADDRESS"

# gsutil cp gs://${gcloud_secrets_bucket}/${gcloud_secrets_base_path}/
echo "Address: $ACCOUNT_ADDRESS"
echo "Bootnode enode address: $BOOTNODE_ENODE_ADDRESS"

BOOTNODE_ENODE=$BOOTNODE_ENODE_ADDRESS@${bootnode_ip_address}:30301
echo "Bootnode enode: $BOOTNODE_ENODE"

# stop and remove the celotool Docker container as we no longer need it
echo "Stopping celotool container"
docker stop $CELOTOOL_CONTAINER_ID
echo "Removing celotool container"
docker rm $CELOTOOL_CONTAINER_ID

docker pull $GETH_NODE_DOCKER_IMAGE

echo "Starting geth...."
Expand All @@ -69,7 +42,7 @@ docker run --net=host --entrypoint /bin/sh -d $GETH_NODE_DOCKER_IMAGE -c "\
echo -n '$ACCOUNT_ADDRESS' > /root/.celo/address && \
echo -n '$BOOTNODE_ENODE_ADDRESS' > /root/.celo/bootnodeEnodeAddress && \
echo -n '$BOOTNODE_ENODE' > /root/.celo/bootnodeEnode && \
echo -n '${geth_account_secret}' > /root/.celo/account/accountSecret && \
echo -n '$GETH_ACCOUNT_SECRET' > /root/.celo/account/accountSecret && \
geth init /var/geth/genesis.json && \
geth account import --password /root/.celo/account/accountSecret /root/.celo/pkey && \
geth \
Expand Down
10 changes: 0 additions & 10 deletions packages/terraform-modules/testnet/modules/validator/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ variable genesis_content_base64 {
description = "Content of the genesis file encoded in base64"
}

variable geth_account_secret {
type = string
description = "Geth account secret"
}

variable geth_node_docker_image_repository {
type = string
description = "Repository of the geth docker image"
Expand All @@ -68,11 +63,6 @@ variable geth_verbosity {
description = "Verbosity of the validator nodes"
}

variable mnemonic {
type = string
description = "Mnemonic for the validators"
}

variable network_id {
type = number
description = "The network ID number"
Expand Down
10 changes: 0 additions & 10 deletions packages/terraform-modules/testnet/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ variable geth_verbosity {
description = "Verbosity of all geth nodes"
}

variable mnemonic {
type = string
description = "Mnemonic for the nodes"
}

variable network_id {
type = number
description = "The network ID number"
Expand All @@ -83,11 +78,6 @@ variable validator_count {
description = "Number of validators to create"
}

variable validator_geth_account_secret {
type = string
description = "Geth account secret for validators"
}

variable verification_pool_url {
type = string
description = "URL of the verification pool"
Expand Down