-
Notifications
You must be signed in to change notification settings - Fork 375
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 an oracle cronjob #1814
Merged
Merged
Deploy an oracle cronjob #1814
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f12411f
add helm chart for oracle cronjob
yerdua f3c0616
celotool command for deploying an oracle job (WIP)
yerdua e7710d4
more helm chart work
yerdua 19f0e69
move some values into .env. add a dockerfile for a standalone cli ima…
yerdua 9600fe1
deal with some envVars in a better way
yerdua cb319f6
hardcode a node's IP because forno is broken. fix some bits of the ce…
yerdua 25e7668
various things to make the oracle actually work
yerdua e95cba0
get rid of temporary hardcode now that forno works
yerdua 9e4e9e5
yarn.lock cleanup via yarn install
yerdua 75d9681
make oracle schedule be in the .env file
yerdua 35e8d51
remove cli changes from this PR, since they're not in published cli
yerdua 5b202a0
fix contractkit dependency for cli
yerdua 61b8a6e
add the new envvars to all .envs. Use a cli docker image that actuall…
yerdua 92ad324
addOracle expects leading '0x' on the address. Don't assume the addre…
yerdua 3cda3c7
add destroy oracle command
yerdua 3f137d6
Merge branch 'master' into yerdua/oracle-cronjob
yerdua d1d5e8e
get latest .env.baklavastaging from trevor's branch
yerdua ce6a931
oops. actually include the necessary bits of the destroy oracle command
yerdua ced08ae
fix minor issues
yerdua 706eaf4
Merge branch 'master' into yerdua/oracle-cronjob
tkporter 60fcf27
Merge branch 'master' into yerdua/oracle-cronjob
tkporter 2f03d67
Merge branch 'master' into yerdua/oracle-cronjob
tkporter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,107 @@ | ||
# Don't use "//" for comments in this file. | ||
# This file is meant to be executed as a bash script for testing. | ||
ENV_TYPE="staging" | ||
|
||
GETH_VERBOSITY=2 | ||
|
||
VM_BASED=true | ||
|
||
KUBERNETES_CLUSTER_NAME="baklavastaging" | ||
KUBERNETES_CLUSTER_ZONE="us-west1-a" | ||
CLUSTER_DOMAIN_NAME="celo-testnet" | ||
|
||
TESTNET_PROJECT_NAME="celo-testnet" | ||
|
||
BLOCKSCOUT_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/blockscout" | ||
BLOCKSCOUT_DOCKER_IMAGE_TAG="c42d9c2f3ef5e79c152c44a82fa0f12233dcfb5c" | ||
BLOCKSCOUT_WEB_REPLICAS=3 | ||
# Increment this value everytime you redeploy blockscout. Or else the deployment will fail due to the | ||
# existing database. | ||
BLOCKSCOUT_DB_SUFFIX="0" | ||
BLOCKSCOUT_SUBNETWORK_NAME="Baklava Staging" | ||
|
||
ETHSTATS_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/ethstats" | ||
ETHSTATS_DOCKER_IMAGE_TAG="bbc89603d872af1c6b37cf00e8220ed26237fc91" | ||
ETHSTATS_TRUSTED_ADDRESSES="" | ||
ETHSTATS_BANNED_ADDRESSES="" | ||
|
||
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 | ||
# `geth $ git show | head -n 1` | ||
GETH_NODE_DOCKER_IMAGE_TAG="a85db20179b503b802430aef7085d35aa761c63d" | ||
|
||
GETH_BOOTNODE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/geth-all" | ||
# When upgrading change this to latest commit hash from the master of the geth repo | ||
# `geth $ git show | head -n 1` | ||
GETH_BOOTNODE_DOCKER_IMAGE_TAG="a85db20179b503b802430aef7085d35aa761c63d" | ||
|
||
CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" | ||
CELOTOOL_DOCKER_IMAGE_TAG="celotool-51ae8e72be34a614346950b6fbd8ba3b94223947" | ||
|
||
CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" | ||
CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2" | ||
|
||
# Schedule for an oracle deployed via celotool, expressed in crontab syntax | ||
# This schedule is "every 5th minute" | ||
ORACLE_CRON_SCHEDULE="*/5 * * * *" | ||
|
||
ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle" | ||
ORACLE_DOCKER_IMAGE_TAG="baklavastaging" | ||
|
||
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" | ||
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-51ae8e72be34a614346950b6fbd8ba3b94223947" | ||
|
||
ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/celo-monorepo" | ||
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-c8e3392aa2ca44ff83b4035700ece5fd12ed2b84" | ||
|
||
GETH_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet-production/geth-exporter" | ||
GETH_EXPORTER_DOCKER_IMAGE_TAG="ed7d21bd50592709173368cd697ef73c1774a261" | ||
|
||
# Genesis Vars | ||
NETWORK_ID=31416 | ||
CONSENSUS_TYPE="istanbul" | ||
BLOCK_TIME=5 | ||
# Minimum epoch length is 15 minutes | ||
EPOCH=180 | ||
LOOKBACK=12 | ||
ISTANBUL_REQUEST_TIMEOUT_MS=10000 | ||
|
||
# the number of load test clients that will be given funds in the genesis & migrations | ||
LOAD_TEST_CLIENTS=10 | ||
# every 3.6 seconds, so that 1000 transactions are sent by a client every hour | ||
LOAD_TEST_TX_DELAY_MS=3600 | ||
|
||
VALIDATORS=70 | ||
PROXIED_VALIDATORS=35 | ||
TX_NODES=5 | ||
# STATIC_IPS_FOR_GETH_NODES=false | ||
# Whether tx_nodes/validators stateful set should use ssd persistent disks | ||
# GETH_NODES_SSD_DISKS=true | ||
IN_MEMORY_DISCOVERY_TABLE=false | ||
# PING_IP_FROM_PACKET=false | ||
|
||
# Testnet vars | ||
# GETH_NODES_BACKUP_CRONJOB_ENABLED=true | ||
# CONTRACT_CRONJOBS_ENABLED=true | ||
CLUSTER_CREATION_FLAGS="--enable-autoscaling --min-nodes 3 --max-nodes 8 --machine-type=n1-standard-4" | ||
|
||
|
||
GETH_NODE_CPU_REQUEST=400m | ||
GETH_NODE_MEMORY_REQUEST=2.5G | ||
|
||
VERIFICATION_POOL_URL="https://us-central1-celo-testnet.cloudfunctions.net/handleVerificationRequestbaklavastaging/v0.1/sms/" | ||
VERIFICATION_REWARDS_URL="https://us-central1-celo-testnet.cloudfunctions.net/handleVerificationRequestbaklavastaging/v0.1/rewards/" | ||
|
||
STACKDRIVER_MONITORING_DASHBOARD="https://app.google.stackdriver.com/dashboards/11713866848730522797?project=celo-testnet" | ||
STACKDRIVER_NOTIFICATION_CHANNEL_APPLICATIONS="12047595356119796119" | ||
STACKDRIVER_NOTIFICATION_CHANNEL_PROTOCOL="12047595356119796119" | ||
STACKDRIVER_NOTIFICATION_APPLICATIONS_PREFIX="notification-service-,blockchain-api-,faucet-" | ||
|
||
MOBILE_WALLET_PLAYSTORE_LINK="https://play.google.com/apps/internaltest/4700990475000634666" | ||
|
||
# NOTIFICATION_SERVICE_FIREBASE_DB="https://console.firebase.google.com/u/0/project/celo-org-mobile/database/celo-org-mobile-int/data" | ||
|
||
PROMTOSD_SCRAPE_INTERVAL="5m" | ||
PROMTOSD_EXPORT_INTERVAL="5m" | ||
|
||
SMS_RETRIEVER_HASH_CODE=l5k6LvdPDXS |
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,15 @@ | ||
FROM node:10-alpine | ||
|
||
RUN apk update && apk add python git make gcc g++ bash | ||
|
||
RUN adduser -D -S celo | ||
|
||
USER celo | ||
|
||
RUN mkdir /home/celo/.npm-global | ||
ENV PATH=/home/celo/.npm-global/bin:$PATH | ||
ENV NPM_CONFIG_PREFIX=/home/celo/.npm-global | ||
|
||
WORKDIR /home/celo/ | ||
|
||
RUN npm install -g @celo/celocli@0.0.30-beta2 |
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,16 @@ | ||
import { createClusterIfNotExists, switchToClusterFromEnv } from 'src/lib/cluster' | ||
import { removeHelmRelease } from 'src/lib/oracle' | ||
import { DestroyArgv } from '../../deploy/destroy' | ||
|
||
export const command = 'oracle' | ||
|
||
export const describe = 'destroy the oracle package' | ||
|
||
export const builder = {} | ||
|
||
export const handler = async (argv: DestroyArgv) => { | ||
await createClusterIfNotExists() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should be able to remove this line to decrease the run time-- if we're destroying we should assume that the cluster exists & if it doesn't there's no need in creating it |
||
await switchToClusterFromEnv() | ||
|
||
await removeHelmRelease(argv.celoEnv) | ||
} |
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,17 @@ | ||
import { InitialArgv } from 'src/cmds/deploy/initial' | ||
import { switchToClusterFromEnv } from 'src/lib/cluster' | ||
import { installHelmChart } from 'src/lib/oracle' | ||
import yargs from 'yargs' | ||
|
||
export const command = 'oracle' | ||
|
||
export const describe = 'deploy the oracle for the specified network' | ||
|
||
export const builder = (argv: yargs.Argv) => { | ||
return argv | ||
} | ||
|
||
export const handler = async (argv: InitialArgv) => { | ||
await switchToClusterFromEnv() | ||
await installHelmChart(argv.celoEnv) | ||
} |
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,31 @@ | ||
import { envVar, fetchEnv } from 'src/lib/env-utils' | ||
import { installGenericHelmChart, removeGenericHelmChart } from 'src/lib/helm_deploy' | ||
|
||
const helmChartPath = '../helm-charts/oracle' | ||
|
||
export async function installHelmChart(celoEnv: string) { | ||
return installGenericHelmChart( | ||
celoEnv, | ||
releaseName(celoEnv), | ||
helmChartPath, | ||
helmParameters(celoEnv) | ||
) | ||
} | ||
|
||
function helmParameters(celoEnv: string) { | ||
return [ | ||
`--set celotool.image.repository=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_REPOSITORY)}`, | ||
`--set celotool.image.tag=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_TAG)}`, | ||
`--set mnemonic="${fetchEnv(envVar.MNEMONIC)}"`, | ||
`--set oracle.cronSchedule="${fetchEnv(envVar.ORACLE_CRON_SCHEDULE)}"`, | ||
`--set oracle.image.repository=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_REPOSITORY)}`, | ||
`--set oracle.image.tag=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_TAG)}`, | ||
`--set celocli.nodeUrl=${getFornoUrl(celoEnv)}`, | ||
`--set celocli.image.repository=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_REPOSITORY)}`, | ||
`--set celocli.image.tag=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_TAG)}`, | ||
] | ||
} | ||
|
||
function releaseName(celoEnv: string) { | ||
return `${celoEnv}-oracle` | ||
} |
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,22 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,5 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: A Helm chart for Kubernetes | ||
name: oracle | ||
version: 0.1.0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The origin of this file is @tkporter's branch for baklavastaging deployment, as it is today (Dec 2). These vars are the only ones I added:
So, if there are merge conflicts in this file that do not involve these variables, the resolution is to pick whatever the other branch has.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only one of these that should be different for
baklava
is:ORACLE_DOCKER_IMAGE_TAG="baklava"
That docker image already exists and is ready to go.