{"id":31658441,"url":"https://github.com/couchbase/cbbootstrap","last_synced_at":"2025-10-07T15:22:52.250Z","repository":{"id":57610896,"uuid":"83591582","full_name":"couchbase/cbbootstrap","owner":"couchbase","description":"REST API to help bootstrap Couchbase Server clusters","archived":false,"fork":false,"pushed_at":"2017-06-04T20:51:19.000Z","size":456,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-06-20T12:33:48.669Z","etag":null,"topics":["api","aws","couchbase","golang","lambda"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/couchbase.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}},"created_at":"2017-03-01T19:16:57.000Z","updated_at":"2019-09-22T11:18:59.000Z","dependencies_parsed_at":"2022-09-10T06:51:34.159Z","dependency_job_id":null,"html_url":"https://github.com/couchbase/cbbootstrap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/couchbase/cbbootstrap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcbbootstrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcbbootstrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcbbootstrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcbbootstrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/couchbase","download_url":"https://codeload.github.com/couchbase/cbbootstrap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcbbootstrap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278796562,"owners_count":26047458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"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":["api","aws","couchbase","golang","lambda"],"created_at":"2025-10-07T15:22:48.665Z","updated_at":"2025-10-07T15:22:52.242Z","avatar_url":"https://github.com/couchbase.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"A REST API intendended to be run as a public service to help bootstrap Couchbase distributed database clusters, in other words, to make it easy to stand up a Couchbase cluster from scratch by providing an API for Couchbase nodes to:\n\n- Discover whether they are the first node in the cluster, and need to run cluster-init so other nodes can join them\n- If the cluster is already initialized, discover the IP address / hostname of the node they should join.\n\n## Sequence diagram\n\nHere's how the interaction between [bootstrap scripts](https://github.com/couchbase/sync-gateway-ami/blob/master/src/cbbootstrap.py) running on the Couchbase nodes would interact with cbbootstrap running externally:\n\n![diagram](https://github.com/couchbase/cbbootstrap/raw/master/docs/cbbootstrap-diagram.png)\n\n## Deployment Architecture\n\n![architecture](docs/aws-deployment-architecture.png)\n\n## Sample Use\n\nSee [cbbootstrap.py](https://github.com/couchbase/sync-gateway-ami/blob/master/src/cbbootstrap.py) -- this is intended to be called from a `user-data.sh` script on EC2 instance launch, but can be used in other scenarios.\n\n## Backstory\n\nNeeded for the dynamic and automated [sync-gateway-ami](https://github.com/couchbase/sync-gateway-ami) project to be able to start a CloudFormation and have the Couchbase Server cluster initialize itself based on parameters.\n\nThis could also be useful when trying to run Couchbase in container orchestration platforms like Kubernetes or Docker Swarm.\n\n## REST API Definition\n\nSee [hosted swaggerhub API docs](https://swaggerhub.com/apis/tleyden/CBBootstrap/1.0.0) or raw [swagger.yaml](goa/swagger/swagger.yaml) \n\n## Create DynamoDB database\n\nCreate a table named `cb-bootstrap`\n\n## Deploy to AWS Lambda\n\nGet the code:\n\n```\n$ go get github.com/couchbase/cbbootstrap\n```\n\nPackage the lambda function \n\n```\n$ cd $GOPATH/src/github.com/couchbase/cbbootstrap\n$ wget -O Makefile https://github.com/eawsy/aws-lambda-go-shim/raw/master/src/Makefile.example\n$ make\n```\n\nDeploy cloudformation with lambda function\n\n```\n$ aws cloudformation package \\\n  --template-file aws_serverless_application_model.yaml  \\\n  --output-template-file aws_serverless_application_model.out.yaml \\\n  --s3-bucket cf-templates-1m70kn8ou9eql-us-east-1\n$ aws cloudformation deploy \\\n  --template-file aws_serverless_application_model.out.yaml \\\n  --capabilities CAPABILITY_IAM \\\n  --stack-name CBBootstrapExperiment \\\n  --region us-east-1\n```\n\nGet REST API endpoint\n\n```\n$ aws cloudformation describe-stacks \\\n  --stack-name CBBootstrapExperiment \\\n  --region us-east-1 \\\n  --output text \\\n  --query Stacks[0].Outputs[0]\n\n\"https://5e61vqxs5f.execute-api.us-east-1.amazonaws.com/Prod\"\n```\n\nTest endpoint\n\n```\n$ curl https://5e61vqxs5f.execute-api.us-east-1.amazonaws.com/Prod\n```\n\n\nCall API\n\n```\n$ curl -X POST \\\n    -d '{\"cluster_id\": \"mycluster\", \"node_ip_addr_or_hostname\": \"mynode_ip\"}' \\\n    https://5e61vqxs5f.execute-api.us-east-1.amazonaws.com/Prod/cluster\n```\n\n## Related work\n\n* [Using DNS SRV records for discovering Couchbase nodes](https://developer.couchbase.com/documentation/server/current/sdk/java/managing-connections.html#story-h2-6) + [related blog post](http://nitschinger.at/Bootstrapping-from-DNS-SRV-records-in-Java/)\n\n## References\n\n* [Deploy a Goa REST API on AWS Lambda](https://github.com/tleyden/goa-lambda-api) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase%2Fcbbootstrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcouchbase%2Fcbbootstrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase%2Fcbbootstrap/lists"}