Helm chart install Terraform module to backup and restore a Mongo database.
mongodb_backup_minimal
:
module mongodb_backup_minimal {
source = "dasmeta/mongodb-backup/aws"
mongodb_host = "localhost"
mongodb_username = "root"
mongodb_password = "password"
cron_schedule = "0 3 * * *" # “every day at 03:00 am”
run_as_daemon = "false"
init_backup = "false"
backup_user_name = "aws-iam-user"
s3_bucket = "aws-s3-bucket-name" # it suppose this bucket already creaated
}
mongodb_backup_connection_url
:
module mongodb_backup_connection_url {
source = "dasmeta/mongodb-backup/aws"
app_name = "test"
mongodb_host = "localhost"
mongodb_uri = "mongodb+srv://..."
cron_schedule = "*/5 * * * *"
run_as_daemon = "false"
init_backup = "false"
backup_user_name = "backup_user"
s3_bucket = "mongoatlas-dev-backup"
}
mongodb_backup_advanced
:
module mongodb_backup_advanced {
source = "dasmeta/mongodb-backup/aws"
# MongoDB config
mongodb_host = ""
mongodb_username = ""
mongodb_password = ""
mongodb_port = ""
mongodb_database = ""
mongodb_exclude-collections = ""
# Helm backup config
cron_schedule = ""
max_backups = ""
run_as_daemon = ""
init_backup = ""
init_restore = ""
# AWS S3 bucket config
backup_user_name = ""
s3_bucket = ""
aws_default_region = ""
}
Environment Variables | Description |
---|---|
mongodb_host |
(required) This is gonna be Mongo database Host name |
mongodb_port |
(Optional) Mongo database host Port |
mongodb_uri |
(Optional) Mongo connection uri |
mongodb_username |
(required) Mongo database username |
mongodb_password |
(required) Mongo database password |
aws_default_region |
(required) Set aws default region. See Amazon Web Services |
backup_user_name |
(required) this is the aws user name to create and provide accesses for pushing backup to S3 |
s3_bucket |
(Optional) If bucket variable is set the backups will be shipped/restored to/from Amazon S3 Bucket. Otherwise It will be saved locally. |
max_backups |
(Optional) Count of maximum backups on local machine. Necessary if S3_BUCKET variable is not set. Default value is 30 |
cron_schedule |
Please visit CRON SCHEDULE to choose your specific schedule time. |
run_as_daemon |
in case this prop value is "true" the an "Deployment" kind (k8s object type) will be created else wise the kind will be "CronJob". |
init_backup |
(Optional) To make mongo backup on container startup mark value true . Default is: 'false' . If S3_BUCKET is set, the latest backup will be shipped to bucket. Otherwise, database will be saved on local volume. |
init_restore |
(Optional) To make mongo restore on container startup mark value true . Default is: 'false' . If S3_BUCKET is set, the latest backup will be downloaded from bucket. Otherwise, database will be restored from the local volume. |
No requirements.
No providers.
Name | Source | Version |
---|---|---|
mongodb_backup_s3_storage_user | dasmeta/modules/aws//modules/aws-iam-user | 0.36.8 |
release | terraform-module/release/helm | 2.7.0 |
No resources.
Name | Description | Type | Default | Required |
---|---|---|---|---|
app_name | Helm app/release name | string |
"mongodb-backup-aws" |
no |
app_version | Helm app/release version | string |
"0.1.0" |
no |
aws_default_region | aws-default-region. | string |
"eu-central-1" |
no |
backup_user_name | Backup user name for s3 bucket | string |
"mongodb-backup-s3-bucket" |
no |
create_user | Create User for S3 | bool |
true |
no |
cron_schedule | Backup schedule, in crojob format. E.g. '3 0 * * *' | string |
"3 0 * * *" |
no |
init_backup | If enabled scripts will do backup right on the start and then according to the schedule. | string |
false |
no |
init_restore | If enabled scripts will do restore right on the start and then according to the schedule. | string |
false |
no |
max_backups | Max backups' | string |
"30" |
no |
mongodb_database | Mongodb database to be backed up. All databases will be backed up if not specified. | string |
"" |
no |
mongodb_exclude_collections | Mongodb collections to be excluded from the backup. All collections will be backed up if not specified. | string |
"" |
no |
mongodb_host | Mongodb host name backup script will be taking data from. | string |
"localhost" |
no |
mongodb_password | Mongodb user password script will need to pull data from mongodb. | string |
"" |
no |
mongodb_port | Mongodb user password script will need to pull data from mongodb. | string |
"27017" |
no |
mongodb_uri | --uri param from mongodump docs | string |
"" |
no |
mongodb_username | Mongodb user name script will need to pull data from mongodb. | string |
"" |
no |
namespace | Helm app/release namespace | string |
"default" |
no |
resources | Allows to set cpu/memory resources Limits/Requests for deployment/cronjob | object({ |
{ |
no |
run_as_daemon | in case of true deployment will be created (as daemon) elwise kube cronJob will be created | string |
"false" |
no |
s3_bucket | The bucket backups will be stored. | string |
n/a | yes |
volume_size | Size of the backup volume storage. Should be enough big to fit backup files. | string |
"10Gi" |
no |
volume_storageClass | Volume strage class AWS will be claimed for. No need for fast storage as this will be used once during backup. | string |
"gp2" |
no |
No outputs.