maxisam / mgob

MongoDB dockerized backup agent. Runs schedule backups with retention, S3 & SFTP upload, notifications, instrumentation with Prometheus and more.
https://maxisam.github.io/mgob/
MIT License
123 stars 16 forks source link

how does the validation step work? #108

Closed fragolinux closed 2 months ago

fragolinux commented 2 months ago

how does the validation step work? needs to be enabled someway?

i just triggered a plan, no mention of any test of validation

time="2024-04-16T12:12:39Z" level=info msg="mgob 2.0.20"
time="2024-04-16T12:12:39Z" level=info msg="starting with config: &{LogLevel:info JSONLog:false Host: Port:8090 ConfigPath:/config StoragePath:/storage TmpPath:/tmp DataPath:/data Version:2.0.20 UseAwsCli:false Has
Gpg:false}"
time="2024-04-16T12:12:39Z" level=info msg="mongodump version: 100.8.0 git version: 732ddfaa6b467ffcd5bfa69a455953320eed85f4 Go version: go1.21.1    os: linux    arch: amd64    compiler: gc "
time="2024-04-16T12:12:39Z" level=info msg="NAME:   mc version - manage bucket versioning  USAGE:   mc version COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]  COMMANDS:   enable   enable bucket versioning   suspend  s
uspend bucket versioning   info     show bucket versioning status    FLAGS:   --config-dir value, -C value  path to configuration folder (default: \"/root/.mc\") [$MC_CONFIG_DIR]   --quiet, -q                   dis
able progress bar display [$MC_QUIET]   --no-color                    disable color theme [$MC_NO_COLOR]   --json                        enable JSON lines formatted output [$MC_JSON]   --debug
 enable debug output [$MC_DEBUG]   --insecure                    disable SSL certificate verification [$MC_INSECURE]   --limit-upload value          limits uploads to a maximum rate in KiB/s, MiB/s, GiB/s. (default
: unlimited) [$MC_LIMIT_UPLOAD]   --limit-download value        limits downloads to a maximum rate in KiB/s, MiB/s, GiB/s. (default: unlimited) [$MC_LIMIT_DOWNLOAD]   --help, -h                    show help    "
time="2024-04-16T12:12:40Z" level=info msg="aws-cli/1.29.44 Python/3.11.6 Linux/4.18.0-477.15.1.el8_8.x86_64 botocore/1.31.44 "
time="2024-04-16T12:12:40Z" level=warning msg="gpg failed /bin/sh: gpg: not found : exit status 127"
time="2024-04-16T12:12:41Z" level=info msg="Google Cloud SDK 445.0.0 bq 2.0.97 bundled-python3-unix 3.9.16 core 2023.09.01 gcloud-crc32c 1.0.0 gsutil 5.25 "
time="2024-04-16T12:12:43Z" level=info msg="WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade' azure-cli                         2.52.0 * "
time="2024-04-16T12:12:43Z" level=info msg="rclone v1.65.0 "
time="2024-04-16T12:12:43Z" level=info msg="Next tmp cleanup run at 2024-04-16 13:00:00 +0000 UTC"
time="2024-04-16T12:12:43Z" level=info msg="Next run at 2024-04-16 13:00:00 +0000 UTC" plan=hourly
time="2024-04-16T12:12:43Z" level=info msg="New job found, saving to store" plan=daily
time="2024-04-16T12:12:43Z" level=info msg="Next run at 2024-04-17 00:00:00 +0000 UTC" plan=daily
time="2024-04-16T12:12:43Z" level=info msg="New job found, saving to store" plan=weekly
time="2024-04-16T12:12:43Z" level=info msg="Next run at 2024-04-21 00:00:00 +0000 UTC" plan=weekly
time="2024-04-16T12:12:43Z" level=info msg="Starting HTTP server on port 8090"
time="2024-04-16T12:15:13Z" level=info msg="On demand backup started" plan=hourly
time="2024-04-16T12:15:13Z" level=info msg="new dump" archive=/tmp/hourly-1713269713.gz err="<nil>" mlog=/tmp/hourly-1713269713.log plan=hourly
time="2024-04-16T12:15:13Z" level=info msg="Local backup finished filename:`/tmp/hourly-1713269713.gz`, filepath:`/storage/hourly/hourly-1713269713.gz`, Duration: 13.39091ms" plan=hourly
time="2024-04-16T12:15:13Z" level=info msg="Clean up temp finished Temp folder cleanup finished, `/tmp/hourly-1713269713.gz` is removed." plan=hourly
time="2024-04-16T12:15:13Z" level=info msg="On demand backup finished in 324.669122ms archive hourly-1713269713.gz size 465 kB" plan=hourly

this my full flux helmrelease:

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: common-mgob
  namespace: ${namespace}
spec:
  interval: 1m
  timeout: 10m
  releaseName: common-mgob
  test:
    enable: true
    timeout: 10m
  chart:
    spec:
      # see https://github.com/maxisam/mgob/tree/main/charts/mgob
      chart: mgob
      version: "2.1.0"
      sourceRef:
        kind: HelmRepository
        name: mgob
      interval: 24h
  valuesFrom:
  - kind: Secret
    name: ha-base-hr
    valuesKey: mongodbAuthUsername
    targetPath: config.hourly\.yml.target.username
    optional: false
  - kind: Secret
    name: ha-base-hr
    valuesKey: mongodbAuthPassword
    targetPath: config.hourly\.yml.target.password
    optional: false
  - kind: Secret
    name: ha-base-hr
    valuesKey: mongodbAuthUsername
    targetPath: config.daily\.yml.target.username
    optional: false
  - kind: Secret
    name: ha-base-hr
    valuesKey: mongodbAuthPassword
    targetPath: config.daily\.yml.target.password
    optional: false
  - kind: Secret
    name: ha-base-hr
    valuesKey: mongodbAuthUsername
    targetPath: config.weekly\.yml.target.username
    optional: false
  - kind: Secret
    name: ha-base-hr
    valuesKey: mongodbAuthPassword
    targetPath: config.weekly\.yml.target.password
    optional: false

  values:
    image:
      tag: "2.0.20-all"
    config:
      # Add each plan as per below.
      hourly.yml:
        # run every day at 6:00 and 18:00 UTC
        scheduler:
          cron: "@hourly"
          # number of backups to keep locally
          retention: 4
          # backup operation timeout in minutes
          timeout: 60
        target:
          # mongod IP or host name
          host: common-mongodb-headless.${namespace}.svc.cluster.local
          # mongodb port
          port: 27017
          # mongodb database name, leave blank to backup all databases
          database: "e4t-lab-ha"
          # add custom params to mongodump (eg. Auth or SSL support), leave blank if not needed
          params: ""
      daily.yml:
        # run every day at 6:00 and 18:00 UTC
        scheduler:
          cron: "@daily"
          # number of backups to keep locally
          retention: 7
          # backup operation timeout in minutes
          timeout: 60
        target:
          # mongod IP or host name
          host: common-mongodb-headless.${namespace}.svc.cluster.local
          # mongodb port
          port: 27017
          # mongodb database name, leave blank to backup all databases
          database: "e4t-lab-ha"
          # add custom params to mongodump (eg. Auth or SSL support), leave blank if not needed
          params: ""
      weekly.yml:
        # run every day at 6:00 and 18:00 UTC
        scheduler:
          cron: "@weekly"
          # number of backups to keep locally
          retention: 30
          # backup operation timeout in minutes
          timeout: 60
        target:
          # mongod IP or host name
          host: common-mongodb-headless.${namespace}.svc.cluster.local
          # mongodb port
          port: 27017
          # mongodb database name, leave blank to backup all databases
          database: "e4t-lab-ha"
          # add custom params to mongodump (eg. Auth or SSL support), leave blank if not needed
          params: ""

    storage:
      # -- Persistent volume for backups, see `config.retention`
      longTerm:
        name: "mgob-storage"
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 10Gi
          storageClassName: ${envName}-nfs-csi-test
      # -- Persistent volume for temporary files
      tmp:
        name: "mgob-tmp"
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 1Gi
          storageClassName: ${envName}-nfs-csi-test
      restoreTmp:
        name: "mgob-restore-tmp"
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 10Gi
          storageClassName: ${envName}-nfs-csi-test

    #  mongodb as sidecars to validate backup
    mongodb:
      image:
        tag: 5.0.10
fragolinux commented 2 months ago

found this and implemented it: https://github.com/maxisam/mgob/blob/main/.document/BACKUP_PLAN.md only thing, i created an "ondemand" backup plan, but it complains about missing scheduler, i had to add a "pseudofake" one (it will occur on every 29 february if it's monday, next in 2044)

      ondemand.yml:
        scheduler:
          cron: "0 0 29 2 1" # fake schedule, next will run in 2044, 1st 29/2 on monday
          retention: 25
          timeout: 60
maxisam commented 2 months ago

I think you all figured out. should I close this?

fragolinux commented 2 months ago

Yes please, thanks!