MongoDB Auto Backup

Overview

This chapter introduces how to set up auto backup for GROWI data using weseek/mongodb-awesome-backup.

Requirements

  • Docker
  • AWS S3 bucket to upload backup files
    • Access key and secret key for a user authorized to access S3 bucket.

TIP

See MongoDB Backup & Restore before you start.

Manage with a Container

  1. Start a container with CRONMODE true.
    docker run --rm \
      -e MONGODB_HOST=<Target MongoDB Host> \
      -e AWS_ACCESS_KEY_ID=<Your IAM Access Key ID> \
      -e AWS_SECRET_ACCESS_KEY=<Your IAM Secret Access Key> \
      -e S3_TARGET_BUCKET_URL=<Target S3 Bucket URL (s3://...)> \
      -e CRONMODE=true \
      -e "CRON_EXPRESSION=0 4 * * *" \
      weseek/mongodb-awesome-backup
    
  2. The container backs up all databases in the target MongoDB server at 4:00 AM everyday.

Backup Version Control

  • (TBD: Looking for a contributor)

TIP

See weseek/mongodb-awesome-backup for more options.

Manage with docker-compose

TIP

If GROWI is installed with growi-docker-compose, preparing a backup container is even easier.

  • Refer to weseek/growi-docker-compose Example, and follow the steps below.
  1. clone
    git clone https://github.com/weseek/growi-docker-compose.git growi
    cd growi
    
  2. Copy docker-compose.override.yml to the root directory.
    cp -p examples/backup-mongodb-data/docker-compose.override.yml .
    
  3. Edit docker-compose.override.yml and enter an appropriate value for CRON_EXPRESSION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and S3_TARGET_BUCKET_URL.
    ...
    environment:
      - CRONMODE=true
      - CRON_EXPRESSION=0 4 * * *
      - AWS_ACCESS_KEY_ID=${Your IAM Access Key ID}
      - AWS_SECRET_ACCESS_KEY=${Your IAM Secret Access Key}
      - S3_TARGET_BUCKET_URL=s3://${Your Bucket Name}/
    ...
    
  4. docker-compose up
    

Manage with Google Cloud Platform

  • (TBD: Looking for a contributor)
Last Updated: 5/31/2019, 6:07:01 AM