This playbook installs a weekly cron backup.
| Variables | Default | Example |
|---|---|---|
| matrix_backup_enabled | false | True |
| matrix_backup_bucket | "” | “s3//bucketname/prefix/” |
| matrix_backup_bucket_endpoint | "” | “https://nyc3.digitaloceanspaces.com” |
| matrix_backup_bucket_awscli_docker_image_latest | “amazon/aws-cli:2.0.10” | “amazon/aws-cli:latest” |
| matrix_backup_bucket_key_id | "” | “AKIAQIOAVK3Q4HMXL272” |
| matrix_backup_bucket_key_secret | "” | “OI2fHQpwZZQnKyl126QF8VTEaOt7tH57j8ARzOE9” |
| matrix_backup_rsync_target | "” | ?? |
| matrix_backup_cron_day | “*/7” (Weekly) | “*/2” Biweekly |
??
Setup: S3 compatible buckets
Select a S3 compatible provider. Create S3 Bucket Create a specialized IAM users with the permissions recorded below. For users who deployed their postgres instance on an AWS EC2, you can create attachable IAM roles instead for password less S3 access.
Backup-acl.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::<your-bucket>",
"Condition": {
"ForAnyValue:IpAddress": {
"aws:SourceIp": [
"<Restrict-IP>"
]
}
}
},
{
"Sid": "VisualEditor3",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:AbortMultipartUpload"
],
"Resource": [
"arn:aws:s3:::<your-bucket>/matrix/*",
"arn:aws:s3:::<your-bucket>/matrix"
],
"Condition": {
"IpAddress": {
"aws:SourceIp": "<Restrict-IP>"
}
}
}
]
}
Restore-acl.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::<your-bucket>",
"Condition": {
"ForAnyValue:IpAddress": {
"aws:SourceIp": [
"<Restrict-IP>"
]
}
}
},
{
"Sid": "VisualEditor3",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:AbortMultipartUpload"
],
"Resource": [
"arn:aws:s3:::<your-bucket>/matrix/*",
"arn:aws:s3:::<your-bucket>/matrix"
],
"Condition": {
"IpAddress": {
"aws:SourceIp": "<Restrict-IP>"
}
}
}
]
}
Set matrix_backup_enabled and matrix_backup_bucket.
Set matrix_backup_enabled, matrix_backup_bucket, matrix_backup_bucket_key_id, and matrix_backup_bucket_key_secret
Set matrix_backup_enabled, matrix_backup_bucket, matrix_backup_bucket_key_id, matrix_backup_bucket_key_secret, and matrix_backup_bucket_endpoint
ansible-playbook -i inventory/hosts setup.yml --tags=setup-matrix-backup,start