Git Product home page Git Product logo

pg-s3-backup's Introduction

pg backup with s3 (minio demo)

fork from https://github.com/Remigius2011/pg-dump && do some change

how to running

  • start pg && minio server
docker-compose up -d postgres  s3
  • add some table && datas
the way you like
  • test pg backup
docker-compose up backup

with k8s cronjob

you can use k8s cronjob for scheduler auto

  • cronjob yaml content
{
    "kind": "CronJob",
    "apiVersion": "batch/v1beta1",
    "metadata": {
      "name": "gitlab-backup-job"
    },
    "spec": {
      "schedule": "0 0 1 * *",
      "concurrencyPolicy": "Replace",
      "suspend": false,
      "jobTemplate": {
        "metadata": {
          "creationTimestamp": null
        },
        "spec": {
          "template": {
            "metadata": {
              "creationTimestamp": null,
              "labels": {
                "apprepositories.kubeapps.com/repo-name": "gitlab-backup-job"
              }
            },
            "spec": {
              "containers": [
                {
                  "name": "gitlab-pg-backup",
                  "image": "dalongrong/pg-dump-gzip",
                  "env": [
                    {
                        "name": "PG_DB",
                        "value": "postgres"
                    },
                    {
                        "name": "PG_HOST",
                        "value": "postgres"
                    },
                    {
                        "name": "PG_PASSWORD",
                        "value": "dalong"
                    },
                    {
                        "name": "PG_PORT",
                        "value": "5432"
                    },
                    {
                        "name": "S3_ACCESS_KEY",
                        "value": "dalongdemo"
                    },
                    {
                        "name": "S3_HOST",
                        "value": "s3:9000"
                    },
                    {
                        "name": "S3_PROTOCOL",
                        "value": "http"
                    },
                    {
                        "name": "S3_SECRET_KEY",
                        "value": "dalongdemo"
                    }
                ],
                  "imagePullPolicy": "IfNotPresent"
                }
              ],
              "restartPolicy": "OnFailure"
            }
          }
        }
      },
      "successfulJobsHistoryLimit": 3,
      "failedJobsHistoryLimit": 1
    }
  }

pg-s3-backup's People

Contributors

rongfengliang avatar

Watchers

 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.