berkeley-migration-cronjob
by O(1) Labs
Creating replayer CronJobs for Mina mainnet migration
About this chart
Berkeley Migration CronJobs
This Helm Chart aims to ease the process of scripting the Mina mainnet migration replayers by isolating the script from the Kubernetes manifests.
The way it works can be summarized in the following items:
- A Kubernetes Secret with the contents of
.Values.gcloudKeyfileRefis created. It essentially retrieves the secret stored in GCP Secret Manager containing a validgcloud-keyfile.json. This Secret will be mounted at/gcloud/keyfile.jsonon allreplayerscontainers. - As many CronJobs are created as entries in the
.Values.replayerslist.- A Kubernetes Secret called
{{ .Values.replayers.[*].script.secretName }}is created with the contents of{{ .Values.replayers.[*].script.scriptName }}and mounted at eachreplayercontainer at/scripts/{{ .Values.replayers.[*].scriptName }}
- A Kubernetes Secret called
- Replayers have the following entrypoint:
/bin/bash -c /scripts/{{ .Values.replayers.[*].scriptName }} - These are deployed using
gitops-infratructure. But may also be deployed from a user environment usinghelm-secrets(withvals) and sufficient authz in GCP to read GCP Secret Manager.
Deployment
These CronJobs are deployed using ArgoCD. Refer to GitOps-Infrastructure repository for platform configurations.
(Optional, requires authz) Deploy the CronJobs from your workstation
As manifests secure secrets using GCP Secrets Manager, helm-secrets plugin must be used to either deploy or check the rendered manifests (e.g., via helm template). To achieve this install helm-secrets plugin and either:
a. Check manifests
# at mina/helm/cron_jobs/replayer-cronjobs
helm secrets --evaluate-templates template . -f values.yaml
# decode the evaluated templates by (values are shown in b64, though)
helm secrets --evaluate-templates --evaluate-templates-decode-secrets template . -f values.yaml
b. Deploy Chart
NAME=mainnet-replayer
NAMESPACE=my-namespace
helm secrets --evaluate-templates upgrade --install $NAME . -f values.yaml --namespace $NAMESPACE
You can perform this operation every time you change a value in the Chart or update the scripts under files.
Notes
- Some
values.yamlare considered global (e.g.,.Values.image) and are referenced in eachreplayerusing YAML anchors. - An Example script
test-run.shis included so a debuggingreplayercan be launched. It essentially performs the same package installations as e.g.,mainnet-migrated.shbut with asleep 3600instruction at the end. If you want to try it, simply uncomment thetest-runentry under.Values.replayers.
Deploy berkeley-migration-cronjob with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has berkeley-migration-cronjob on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartberkeley-migration-cronjob is pinned at v0.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply