Giter Site home page Giter Site logo

mikejk8s / cockroachdb-backup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kminehart/cockroachdb-backup

0.0 0.0 0.0 7 KB

A docker image, a few scripts, and a kubernetes definition for backing up a Cockroach DB database

License: MIT License

Shell 100.00%

cockroachdb-backup's Introduction

cockroachdb-backup-dockerfiles

Dockerfiles that have the cockroach binary and gcloud.

Usage

Kubernetes

The example cronjob provided runs every night at midnight and runs cockroach dump, followed by curl to send it to an S3 bucket or a Google storage bucket.

NOTE The CronJob resource requires kubernetes version >= 1.8.

vim kubernetes/cronjob.yaml

Modify the job to match your credentials.

Configuration

Environment Variable Default Value
COCKROACH_URL
COCKROACH_DATABASE database
CLOUD_PROVIDER gcp "gcp" or "aws
AWS_S3_BUCKET my-bucket
AWS_S3_KEY my-s3-key
AWS_S3_SECRET my-s3-secret
GCP_BUCKET_NAME my-gcp-bucket
GCP_SA_USER [email protected] The username of the SeriveAccount assigned to the provided key file (see blow)

Google Cloud Storage

Usage with Google Cloud Storage is fairly simple.

Create a ServiceAccount

This service account will have access to the Storage services in your project

gcloud iam service-accounts create cockroach-backup-sa --display-name "CockroachDB Backup Account"

Create the key for this service account

This key will be given to the Kubernetes job to authenticate to your gcloud account.

gcloud iam service-accounts keys create \
  key.json \
  --iam-account [email protected]

Grant the proper roles (roles/storage.objectCreator)

Now grant the backup service account the ability to add items to Storage

gcloud projects add-iam-policy-binding my-project-123 \
  --member serviceAccount:[email protected] \
  --role roles/storage.objectCreator

Now turn it into a Kubernetes secret

kubectl create secret generic cockroach-backup-sa --from-file=./key.json

AWS

Currently untested.

cockroachdb-backup's People

Contributors

kminehart avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.