Needs work
Project:
Backup and Migrate
Version:
5.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Jan 2019 at 15:42 UTC
Updated:
21 Jan 2022 at 17:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
gisleI second this!
Since May 2018, I've used AWS S3 as for offline backups along with Backup and Migrate.
My setup is external to Backup and Migrate and do not rely on other Drupal modules. Basically I do this:
cron-job that run a script built upons3cmdto sync the local private filesystem with AWS S3 just after Backup and Migrate have created a scheduled backup.This works well enough for me to rely on it for all the production sites I am in charge of. However, I would welcome an option to set AWS S3 as a backup destination as part of Backup and Migrate.
Comment #3
alangallery commentedWe do this too but use the aws cli, https://aws.amazon.com/cli/, for syncing a folder to S3.
Alternatively there is rclone, https://rclone.org/, which apart from supporting many cloud storage providers, also supports FTP/SFTP.
I don't use this for our production but at home and it works well.
Comment #4
snehalgaikwad commentedComment #5
rodmarasi commentedhi snehalgaikwad, any news on the patch for this feature?
Comment #6
snehalgaikwad commentedAdded new destination Amazon AWS S3 for backup.
Comment #7
snehalgaikwad commentedUpdating patch with few changes.
Comment #8
snehalgaikwad commentedComment #9
muaz7731Hi,
I've tested out the patch
1) Even though I've added $settings[backup_migrate_aws_access_key] and $settings[backup_migrate_aws_key_id] in my settings.php, the notification for "Please store access key id an secret key id" does not disappeared.
2) When trying out quick backup to my s3 the error appeared as below:
edit:
now I am using the latest development for backup and migrate module updated 13 Apr 2019 at 01:38 UTC
I've now received the following error when quick backup to amazon s3
the notification for "Please store access key id an secret key id" still does not disappeared as stated before.
Comment #10
muaz7731Comment #11
snehalgaikwad commentedHere is updated patch with few more changes.
Comment #12
snehalgaikwad commentedHi @muaz91,
1. I have uploaded a new patch which will fix issue of notification for "Please store access key id an secret key id".
2. For the second point, I guess it is issue with Bucket Policy for the S3 bucket you provided. Will you please confirm once if access key you have provided have permission to PutObject in the bucket?
Thanks.
Comment #13
muaz7731Hi @snehalgaikwad,
The patch works, however there are problems that I have found:
1. The region field is not required, you can save without putting any region. When leave blank and try to backup, will get notification as below:
2. The main problem is that, the $settings['backup_migrate_aws_key_id'] and $settings['backup_migrate_aws_access_key'] is getting the wrong information. This means that when i put my access key in $settings['backup_migrate_aws_access_key'] and my secret key in $settings['backup_migrate_aws_key_id'], I will get error as below:
However, if I put:
$settings['backup_migrate_aws_key_id'] = 'my-access-key';
$settings['backup_migrate_aws_access_key'] = 'my-secret-key';
the backup process works. the information put in is in the wrong fields. Thank you.
Comment #14
muaz7731Comment #15
snehalgaikwad commentedMade Region field required and changed variable names of secret key and access key to avoid confusion. Here is updated patch.
Comment #16
WillenLeal commentedHello @snehalgaikwad,
I tested your patch it works perfectly, the region is now required and the access_key and secret access_key are better labeled. The last item on my S3 is the default Drupal database backup
Comment #17
snehalgaikwad commentedUpdated notice for storing secret and access key in settings.php.
Comment #18
muaz7731Tested the patch on #17. It works flawlessly
Comment #19
dinesh18 commented#17 patch looks good to me. +1 to RTBC
Comment #20
damienmckennaFirst off, I really appreciate the great work put into this, thank you all.
That said, it need a bit more work.
These lines should follow markdown syntax to create a numbered list rather than code syntax.
This module cannot add a dependency on an AWS library. If this dependency needs to be added in order for S3 to work, it might be worth splitting the S3 functionality into a (bundled) submodule that's only available when enabled.
Could this class please be renamed to "AmazonS3Destination" rather than just "S3Destination"?
There are a bunch of line removals that need to be reverted.
The BackupMigrate\Core\Main\BackupMigrate class should not have a constant that assumes both a specific path and specific service, this should be overridden in a subclass if needed.
There are a bunch of line removals that need to be reverted.
The BackupController class should not have special handling for S3 hardcoded into it, instead the APIs need to be expanded so that the S3 subclass can handle the extra use cases.
This BackupController class also has a bunch of indentation changes that were not necessary.
Namespaced class files don't need a @file comment.
Comment #21
hussainwebI agree it is not a good idea to require on the main module level; however, I'm not sure if the submodule approach would work. I don't know if a composer.json inside a submodule is read to build the dependencies. I broadly see two approaches:
Thoughts?
Comment #22
snehalgaikwad commentedThanks @DamienMcKenna and @hussainweb for your suggestions. I'll make appropriate changes in code and will put it in Backup and Migrate S3 as a D8 porting.
Comment #23
erwindeclerck commentedHi
I manage to upload backup files to my S3 bucket with the backup_migrate_aws_s3 module but only to the root folder of my bucket.
When I use bucketname/subfolder I get error because the slash in the folder is rewritten to bucketname%2Fsubfolder.
Slash is url encoded...
Any suggestions how I could solve this problem?
Error executing "PutObject" on "https://s3.eu-west-3.amazonaws.com/bucket.XXXXX.be%2Fikbenpro/backup-202..."; AWS HTTP error: Client error: `PUT https://s3.eu-west-3.amazonaws.com/bucket.XXXXX.be%2Fikbenpro/backup-202...` resulted in a `403 Forbidden` response: .....
Kind regards.
Comment #24
alexgreyhead commentedHi @ErwinDeClerck (and anyone else looking to save backups into a sub-folder of their S3 bucket) - I've filed issue #3189043 with a patch which may help you?
:)
Best wishes,
Alex
Comment #25
damienmckennaMoving 8.x-4.x issues to 5.0.x because the older branch is no longer supported.
Comment #26
yago elias commentedHi folks, i have a question that might sound crazy,
Why are we need create this solution for B&M and not just configure https://www.drupal.org/project/s3fs to work as your private system (or public)?
Comment #27
damienmckennaI think it'd be worth just going with Backup Migrate Flysystem as the official solution for "not on this server" - I just tested it and it was able to create backups correctly.