{"id":23579606,"url":"https://github.com/awootton/libra-statefulset","last_synced_at":"2026-04-30T10:01:48.868Z","repository":{"id":92890027,"uuid":"245587894","full_name":"awootton/libra-statefulset","owner":"awootton","description":"A golang utility to create a kubernetes stateful-set of Libra validator nodes in a kubernetes namespace. ","archived":false,"fork":false,"pushed_at":"2020-03-09T09:06:31.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-16T18:12:32.094Z","etag":null,"topics":["kubernetes","kubernetes-deployment","libra","libra-statefulset","statefulset"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awootton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-07T07:29:19.000Z","updated_at":"2023-02-06T21:35:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"97cc6d2a-1fd8-47ab-b765-a575e3fa057b","html_url":"https://github.com/awootton/libra-statefulset","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/awootton/libra-statefulset","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awootton%2Flibra-statefulset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awootton%2Flibra-statefulset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awootton%2Flibra-statefulset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awootton%2Flibra-statefulset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awootton","download_url":"https://codeload.github.com/awootton/libra-statefulset/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awootton%2Flibra-statefulset/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32460781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kubernetes","kubernetes-deployment","libra","libra-statefulset","statefulset"],"created_at":"2024-12-26T23:11:44.255Z","updated_at":"2026-04-30T10:01:48.843Z","avatar_url":"https://github.com/awootton.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libra-statefulset\nA ~~rust~~ go utility to create a set of Libra validator nodes in a kubernetes namespace. \n\nPrerequisites: kubectl must be set up to access the target cluster. eg. ```kubectl get nodes``` should return something. Go will be required and rustc and cargo are needed to work with Libra.\n\nTL;DR Just run the Apply function here and it does everything and then you have your own Libra test net. \n\nSee: https://developers.libra.org/docs/run-local-network\n\nSee:  https://developers.libra.org/blog/2019/10/29/a-guide-to-running-libra-validators  \n\nSee:  https://github.com/libra/libra  ( and do a ```git clone https://github.com/libra/libra.git```)\n\nStep two is to git clone the libra project and cd to the libra directory and run ```docker/validator/build.sh``` and then ```docker/mint/build.sh```\nThis takes a ~20 minutes each and I had to give docker more cpu and memory to not fail. We'll try to avoid repeating that too much.\n\nThen I label and push them:\n```\n\tdocker tag e0e17d4611e0 gcr.io/fair-theater-238820/libra_e2e\n\tdocker tag ec5a821668c4 gcr.io/fair-theater-238820/libra_mint\n\n\tdocker push gcr.io/fair-theater-238820/libra_e2e\n\tdocker push gcr.io/fair-theater-238820/libra_mint\n```\nLater they should have version numbers.\n\nOr, you could skip this step use the ones at my gcr which are public. \n\nNext run the ```Apply()``` function in apply.go. The way I do it is that I run the test (```TestApply```) since I have to do this over and over and over.  The way I brought it up is to first get the stateful set running and keeping libra from running by uncommenting:\n```\n\t\tcommand: [\"/bin/sh\"]\n        args: [\"-c\", \"while true; do sleep 10000; done\"]\n```\nin libra-validator and running. Then we can ```kubectl exec -it libra-0 -- bash``` and have a look around. We can check that the volume is mounted at ```/opt/libra/data``` and that the binary is at  ```/opt/libra/bin/libra-node```. Note that we can also see a binary at ```/opt/libra/bin/config-builder``` which claims to be able to generate config for us.\n\nAt the root there is a file ```/docker-run.sh``` whose contents are:\n```\n#!/bin/sh\n# Copyright (c) The Libra Core Contributors\n# SPDX-License-Identifier: Apache-2.0\nset -ex\n\ncd /opt/libra/etc\necho \"$NODE_CONFIG\" \u003e node.config.toml\necho \"$SEED_PEERS\" \u003e seed_peers.config.toml\necho \"$NETWORK_KEYPAIRS\" \u003e network_keypairs.config.toml\necho \"$CONSENSUS_KEYPAIR\" \u003e consensus_keypair.config.toml\necho \"$FULLNODE_KEYPAIRS\" \u003e fullnode_keypairs.config.toml\nexec /opt/libra/bin/libra-node -f node.config.toml\n```\n\nSee:  https://github.com/libra/libra/tree/master/config \"Generating a new TestNet\"\n\nThe config-builder will make the config we need. One wrinkle is that we don't know the IP address of the pods at this time, libra will NOT take a name instead of a dotted quad, so I'll use 100.100.100.100 and 101.101.101.101 etc as addresses. We create the secret key and then all the configs for every node in a folder and then copy them all into a k8s ConfigMap which we can mount as a directory in the pod. Then write some bash to replace the addresses with the real addresses and then call ```/opt/libra/bin/libra-node -f node.config.toml ```\n\n```kubeclt get po ```  will show:\n\n```\nNAME      READY   STATUS    RESTARTS   AGE\nlibra-0   1/1     Running   0          12m\nlibra-1   1/1     Running   0          11m\nlibra-2   1/1     Running   0          11m\n```\nwhich looks good.  \n\n### To test\n\nPort forward a pod: ```kubectl port-forward libra-0 8000:8000 ```\n\nand then, in a different terminal window, cd to the libra project and\n\n ```cargo run --bin cli -- -a localhost -p 8000 -m \"/Users/awootton/Documents/workspace/libra-statefulset/tmp/mint.key\"```\n\nand change the path to the mint. When you get the ```libra%``` prompt type\n\n ```query tr 0 1 false```\n\nwhich will confirm the zeroth transaction (see https://github.com/mikeholenderski/libra-docker)\n\nAlso, try this: https://developers.libra.org/docs/my-first-transaction which also works. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawootton%2Flibra-statefulset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawootton%2Flibra-statefulset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawootton%2Flibra-statefulset/lists"}