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

Deploy new version of Celostats and minnor change from celo-blockchain #1714

Merged
merged 28 commits into from
Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
58afefe
wip
jcortejoso Oct 30, 2019
60e754e
Added env variable for authorized and banned enodes in celostats
jcortejoso Nov 1, 2019
9b0f577
Merge branch 'master' of github.com:celo-org/celo-monorepo into deplo…
jcortejoso Nov 1, 2019
6322393
New geth and blockscout images
jcortejoso Nov 4, 2019
608dcd6
Added ethstats keys for berlintestnet002
jcortejoso Nov 12, 2019
20af717
Updated with latest changes from celostats and c.blockchain
jcortejoso Nov 14, 2019
12b5098
Merge branch 'master' of github.com:celo-org/celo-monorepo into deplo…
jcortejoso Nov 14, 2019
68b948c
Removed ethstats secret references from celotool
jcortejoso Nov 14, 2019
7878dba
Removed terraform references to verification_pool_url
jcortejoso Nov 14, 2019
4da4110
Merge branch 'master' into jcortejoso/deploy_ethstats
diminator Nov 14, 2019
cdb49cf
Prepared for using etherbase accounts for authorized nodes
jcortejoso Nov 14, 2019
d96ae69
Merge branch 'master' of github.com:celo-org/celo-monorepo into jcort…
jcortejoso Nov 14, 2019
e74afad
Merge branch 'jcortejoso/deploy_ethstats' of github.com:jcortejoso/ce…
jcortejoso Nov 14, 2019
54b5cf8
Moved from enodes to eth addresses in ethstats lists
jcortejoso Nov 14, 2019
3c9ba20
Merge branch 'master' into jcortejoso/deploy_ethstats
diminator Nov 14, 2019
d2bbf0d
Merge branch 'master' into jcortejoso/deploy_ethstats
diminator Nov 14, 2019
4a4678c
Removed references to verification_pool_url
jcortejoso Nov 14, 2019
c475409
Merge branch 'jcortejoso/deploy_ethstats' of github.com:jcortejoso/ce…
jcortejoso Nov 14, 2019
7263bdc
Merge branch 'master' into jcortejoso/deploy_ethstats
diminator Nov 15, 2019
c2aad4a
Merge branch 'master' into jcortejoso/deploy_ethstats
diminator Nov 15, 2019
86758e2
Forcing lowercase in authorized etherbase accounts
jcortejoso Nov 15, 2019
41a147b
Merge branch 'jcortejoso/deploy_ethstats' of github.com:jcortejoso/ce…
jcortejoso Nov 15, 2019
ee949da
Merge branch 'master' of github.com:celo-org/celo-monorepo into jcort…
jcortejoso Nov 15, 2019
5af401e
Merge branch 'master' into jcortejoso/deploy_ethstats
jcortejoso Nov 20, 2019
f8f7624
Merge branch 'master' into jcortejoso/deploy_ethstats
jcortejoso Nov 21, 2019
b06032c
Merge branch 'master' into jcortejoso/deploy_ethstats
jcortejoso Nov 21, 2019
0925560
Merge branch 'master' into jcortejoso/deploy_ethstats
jcortejoso Nov 21, 2019
50bae84
Merge branch 'master' into jcortejoso/deploy_ethstats
timmoreton Nov 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
6 changes: 4 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ CLUSTER_DOMAIN_NAME="celo-networks-dev"
TESTNET_PROJECT_NAME="celo-testnet"

BLOCKSCOUT_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/blockscout"
BLOCKSCOUT_DOCKER_IMAGE_TAG="5fba4843b3e78b5ab75d01766214cb24c6a40649"
BLOCKSCOUT_DOCKER_IMAGE_TAG="8be64adeccbb8f67dea3b6653600021577e544c5"
BLOCKSCOUT_WEB_REPLICAS=3
BLOCKSCOUT_DB_SUFFIX=

ETHSTATS_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/ethstats"
ETHSTATS_DOCKER_IMAGE_TAG="0ffe524c625ea59e4492dc92c2e638689c36e4b0"
ETHSTATS_DOCKER_IMAGE_TAG="cd037ea1e18848466452ba9890c1f1bcd3f61009"
ETHSTATS_TRUSTED_ADDRESSES="0x480b0e0A641AE45521377d4984d085a003934561,0xF523976B9FB2160e9a43D8Aee016b98ea8f57837"
ETHSTATS_BANNED_ADDRESSES="0xFd24A0699288E141A855bC8c0dd0400C5E89D5e5"

GETH_NODE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/geth"
# When upgrading change this to latest commit hash from the master of the geth repo
Expand Down
3 changes: 2 additions & 1 deletion packages/celotool/src/lib/env-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export enum envVar {
LOOKBACK = 'LOOKBACK',
ETHSTATS_DOCKER_IMAGE_REPOSITORY = 'ETHSTATS_DOCKER_IMAGE_REPOSITORY',
ETHSTATS_DOCKER_IMAGE_TAG = 'ETHSTATS_DOCKER_IMAGE_TAG',
ETHSTATS_WEBSOCKETSECRET = 'ETHSTATS_WEBSOCKETSECRET',
ETHSTATS_TRUSTED_ADDRESSES = 'ETHSTATS_TRUSTED_ADDRESSES',
ETHSTATS_BANNED_ADDRESSES = 'ETHSTATS_BANNED_ADDRESSES',
GETH_ACCOUNT_SECRET = 'GETH_ACCOUNT_SECRET',
GETH_BOOTNODE_DOCKER_IMAGE_REPOSITORY = 'GETH_BOOTNODE_DOCKER_IMAGE_REPOSITORY',
GETH_BOOTNODE_DOCKER_IMAGE_TAG = 'GETH_BOOTNODE_DOCKER_IMAGE_TAG',
Expand Down
20 changes: 17 additions & 3 deletions packages/celotool/src/lib/ethstats.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { installGenericHelmChart, removeGenericHelmChart } from 'src/lib/helm_deploy'
import { execCmdWithExitOnFailure } from 'src/lib/utils'
import { envVar, fetchEnv, isVmBased } from './env-utils'
import { envVar, fetchEnv } from './env-utils'
import { AccountType, getAddressesFor } from './generate_utils'

const helmChartPath = '../helm-charts/ethstats'

Expand Down Expand Up @@ -29,13 +30,26 @@ export async function upgradeHelmChart(celoEnv: string) {
function helmParameters() {
return [
`--set domain.name=${fetchEnv(envVar.CLUSTER_DOMAIN_NAME)}`,
`--set ethstats.createSecret=${isVmBased()}`,
`--set ethstats.webSocketSecret="${fetchEnv(envVar.ETHSTATS_WEBSOCKETSECRET)}"`,
`--set ethstats.image.repository=${fetchEnv(envVar.ETHSTATS_DOCKER_IMAGE_REPOSITORY)}`,
`--set ethstats.image.tag=${fetchEnv(envVar.ETHSTATS_DOCKER_IMAGE_TAG)}`,
`--set ethstats.trusted_addresses='{${generateAuthorizedAddresses()}}'`,
`--set ethstats.banned_addresses='{${fetchEnv(envVar.ETHSTATS_BANNED_ADDRESSES)}}'`,
]
}

function releaseName(celoEnv: string) {
return `${celoEnv}-ethstats`
}

function generateAuthorizedAddresses() {
// TODO: Add the Proxy eth addresses when available
const mnemonic = fetchEnv(envVar.MNEMONIC)
const publicKeys = []
const txNodes = parseInt(fetchEnv(envVar.TX_NODES), 0)
const validatorNodes = parseInt(fetchEnv(envVar.VALIDATORS), 0)
publicKeys.push(getAddressesFor(AccountType.TX_NODE, mnemonic, txNodes))
publicKeys.push(getAddressesFor(AccountType.VALIDATOR, mnemonic, validatorNodes))

publicKeys.push(fetchEnv(envVar.ETHSTATS_TRUSTED_ADDRESSES).split(','))
return publicKeys.reduce((accumulator, value) => accumulator.concat(value), [])
}
1 change: 0 additions & 1 deletion packages/celotool/src/lib/helm_deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ async function helmParameters(celoEnv: string) {
`--set mnemonic="${fetchEnv('MNEMONIC')}"`,
`--set contracts.cron_jobs.enabled=${fetchEnv('CONTRACT_CRONJOBS_ENABLED')}`,
`--set geth.account.secret="${fetchEnv('GETH_ACCOUNT_SECRET')}"`,
`--set ethstats.webSocketSecret="${fetchEnv('ETHSTATS_WEBSOCKETSECRET')}"`,
`--set geth.ping_ip_from_packet=${fetchEnvOrFallback('PING_IP_FROM_PACKET', 'false')}`,
`--set geth.in_memory_discovery_table=${fetchEnvOrFallback(
'IN_MEMORY_DISCOVERY_TABLE',
Expand Down
1 change: 0 additions & 1 deletion packages/celotool/src/lib/vm-testnet-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ function generateValidatorSecretEnvVars(accountType: AccountType, index: number)
),
PRIVATE_KEY: privateKey,
[envVar.GETH_ACCOUNT_SECRET]: fetchEnv(envVar.GETH_ACCOUNT_SECRET),
[envVar.ETHSTATS_WEBSOCKETSECRET]: fetchEnv(envVar.ETHSTATS_WEBSOCKETSECRET),
[envVar.MNEMONIC]: mnemonic,
}
return formatEnvVars(secrets)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,40 @@ spec:
- name: ethstats
image: {{ .Values.ethstats.image.repository }}:{{ .Values.ethstats.image.tag }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
command:
- /bin/sh
- -c
args:
- |
cat <<'EOF' > /celostats-server/lib/utils/config.js
timmoreton marked this conversation as resolved.
Show resolved Hide resolved
var trusted = [
{{- range .Values.ethstats.trusted_addresses }}
{{- if . }}
"{{lower . }}",
{{- end }}
{{- end }}
]
var banned = [
{{- range .Values.ethstats.banned_addresses }}
{{- if . }}
"{{lower . }}",
{{- end }}
{{- end }}
]
module.exports = {
trusted: trusted,
banned: banned,
reserved: []
};
EOF
npm start
ports:
- name: http
containerPort: 3000
resources:
requests:
cpu: 100m
memory: 250Mi
env:
- name: WS_SECRET
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}
key: WS_SECRET
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
Expand Down
14 changes: 0 additions & 14 deletions packages/helm-charts/ethstats/templates/ethstats.secret.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions packages/helm-charts/ethstats/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ ethstats:
tag: latest
service:
type: NodePort
trusted_addresses: []
banned_addresses: []
14 changes: 2 additions & 12 deletions packages/helm-charts/testnet/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ spec:
--consoleformat=json \
--consoleoutput=stdout \
--etherbase=${ACCOUNT_ADDRESS} \
--ethstats=${HOSTNAME}:${ETHSTATS_SECRET}@${ETHSTATS_SVC} \
--ethstats=${HOSTNAME}@${ETHSTATS_SVC} \
--metrics \
--mine \
--networkid=${NETWORK_ID} \
Expand Down Expand Up @@ -238,11 +238,6 @@ spec:
env:
- name: ETHSTATS_SVC
value: {{ template "ethereum.fullname" . }}-ethstats.{{ .Release.Namespace }}
- name: ETHSTATS_SECRET
valueFrom:
secretKeyRef:
name: {{ template "ethereum.fullname" . }}-ethstats
key: WS_SECRET
- name: ACCOUNT_ADDRESS
value: {{ .Node.address }}
- name: NETWORK_ID
Expand Down Expand Up @@ -307,7 +302,7 @@ spec:
- "geth --bootnodes=`cat /root/.celo/bootnodes` \
--consoleformat=json \
--consoleoutput=stdout \
--ethstats=${HOSTNAME}:${ETHSTATS_SECRET}@${ETHSTATS_SVC} \
--ethstats=${HOSTNAME}@${ETHSTATS_SVC} \
--lightpeers 250 \
--lightserv 90 \
--metrics \
Expand Down Expand Up @@ -347,11 +342,6 @@ spec:
env:
- name: ETHSTATS_SVC
value: {{ template "ethereum.fullname" . }}-ethstats.{{ .Release.Namespace }}
- name: ETHSTATS_SECRET
valueFrom:
secretKeyRef:
name: {{ template "ethereum.fullname" . }}-ethstats
key: WS_SECRET
- name: TARGET_GAS_LIMIT
value: {{ .Values.geth.genesis.gasLimit | quote }}
- name: NETWORK_ID
Expand Down
12 changes: 0 additions & 12 deletions packages/helm-charts/testnet/templates/ethstats.secret.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,16 @@ spec:
--networkid=${NETWORK_ID} \
--syncmode=full \
${NAT_FLAG} \
--ethstats=${HOSTNAME}:${ETHSTATS_SECRET}@${ETHSTATS_SVC} \
--ethstats=${HOSTNAME}@${ETHSTATS_SVC} \
--consoleformat=json \
--consoleoutput=stdout \
--verbosity={{ .Values.geth.verbosity }} \
--ethstats=${HOSTNAME}:${ETHSTATS_SECRET}@${ETHSTATS_SVC} \
--metrics \
${PING_IP_FROM_PACKET_FLAG} \
${IN_MEMORY_DISCOVERY_TABLE_FLAG}
env:
- name: ETHSTATS_SVC
value: {{ template "ethereum.fullname" . }}-ethstats.{{ .Release.Namespace }}
- name: ETHSTATS_SECRET
valueFrom:
secretKeyRef:
name: {{ template "ethereum.fullname" . }}-ethstats
key: WS_SECRET
- name: NETWORK_ID
valueFrom:
configMapKeyRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,10 @@ spec:
--etherbase=${ACCOUNT_ADDRESS} \
--networkid=${NETWORK_ID} \
--syncmode=full \
--ethstats=${HOSTNAME}:${ETHSTATS_SECRET}@${ETHSTATS_SVC} \
--ethstats=${HOSTNAME}@${ETHSTATS_SVC} \
--consoleformat=json \
--consoleoutput=stdout \
--verbosity={{ .Values.geth.verbosity }} \
--ethstats=${HOSTNAME}:${ETHSTATS_SECRET}@${ETHSTATS_SVC} \
${FAULTY_NODE_FLAGS} \
--istanbul.blockperiod={{ .Values.geth.blocktime }} \
--istanbul.requesttimeout={{ .Values.geth.istanbulrequesttimeout }} \
Expand All @@ -166,11 +165,6 @@ spec:
fieldPath: status.podIP
- name: ETHSTATS_SVC
value: {{ template "ethereum.fullname" . }}-ethstats.{{ .Release.Namespace }}
- name: ETHSTATS_SECRET
valueFrom:
secretKeyRef:
name: {{ template "ethereum.fullname" . }}-ethstats
key: WS_SECRET
- name: NETWORK_ID
valueFrom:
configMapKeyRef:
Expand Down