Giter VIP home page Giter VIP logo

docker-cloud-backup's Introduction

Docker Cloud Bacukp

This container is meant to run as a sidecar to a database container which periodically takes a mysqldump and pushes it to google cloud storage.

It can be configured using the environment variables:

  • MYSQL_HOST - defaults to localhost
  • MYSQL_PORT - defaults to 3306
  • MYSQL_DATABASE
  • MYSQL_USER
  • MYSQL_PASSWORD
  • MYSQL_DUMP_OPTS - additional options for the mysqldump command
  • BUCKET - Bucket to save dumps to. Must be writable with given credentials
  • EVERY_N_DAYS - defaults to 1 (i.e., every day)
  • AT_TIME - defaults to 00:00 (midnight)
  • KEEP - Number of backups to keep. Defaults to 5

Google cloud storage authentication

The Google cloud storage api expects a service account credentials file to exist at /etc/creds.json. This can be customised by setting the GOOGLE_APPLICATION_CREDENTIALS enviroment variable to point to wherever the creds file is.

Example kubernetes yaml

# ===========================================
# Database deployment, service, and storage
# ===========================================
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: db
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: db
    spec:
      containers:
        - name: db
          image: mysql:5.7
          env:
            - name: MYSQL_RANDOM_ROOT_PASSWORD
              value: "yes"
            - name: MYSQL_DATABASE
              value: test
            - name: MYSQL_USER
              value: test
            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: secrets
                  key: mysql-password
        - name: backup
          image: cloud-backup:0.1.0
          volumeMounts:
            - name: sa-keys
              mountPath: /etc/sa-keys
          env:
            - name: MYSQL_DATABASE
              value: test
            - name: MYSQL_USER
              value: test
            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: secrets
                  key: mysql-password
            - name: BUCKET
              value: db-backups
            - name: GOOGLE_APPLICATION_CREDENTIALS
              value: /etc/sa-keys/backup-creds.json
        volumes:
          - name: sa-keys
            secret:
              secretName: sa-keys

docker-cloud-backup's People

Contributors

bowlingx avatar jiacona avatar

Watchers

 avatar  avatar  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.