This module provides a database backup solution, which can be exported to the AWS S3 storage system. This module also allows to export to the local file system or can be downloaded remotely via Drupal admin.

The primary focus and key component is around the AWS S3 storage system. There are other modules like "Backup & Migrate" which provide similar functionality, but bloated with excessive features. The focus here is to provide a simple database backup module that can easily export backups to the AWS S3 storage system.

Project link

https://www.drupal.org/project/s3_db_backup

Git instructions

git clone --branch '1.x' https://git.drupalcode.org/project/s3_db_backup.git

Comments

geoanders created an issue. See original summary.

geoanders’s picture

Issue summary: View changes
geoanders’s picture

Title: [D8] S3 Database Backup » [D9] S3 Database Backup
geoanders’s picture

Issue summary: View changes
geoanders’s picture

Issue summary: View changes
avpaderno’s picture

Issue summary: View changes
geoanders’s picture

Status: Active » Needs review
geoanders’s picture

Status: Needs review » Active
geoanders’s picture

Status: Active » Needs review
geoanders’s picture

Issue summary: View changes
geoanders’s picture

Is there anyone available to review? No response or action for quite some time now...

avpaderno’s picture

Status: Needs review » Needs work
  • This is a quick review that doesn't mean to be complete
  • Each point describes what needs to be changed to have secure code that correctly uses the Drupal API and that follows the Drupal coding standards
  • The review points are listed in order of importance as much as possible: first the points about security issues, then the points about code that doesn't correctly use the Drupal API; the points about code that doesn't follow the Drupal coding standards are listed for last
$logger->info(t('S3 database backup cron enabled.'));

The strings passed to the logger methods don't need to be translated.

            $result = $s3->putObject([
              'Bucket' => $config->get('s3.bucket'),
              'Key' => $objectFolder . $objectKey,
              'Body' => fopen($file->getFileUri(), 'r'),
            ]);

Why isn't the code using the file_system service?

Why aren't the adapter classes used to implement services?

  /**
   * Adapter export routine.
   *
   * @inherit
   */

For inherited methods, including methods defined in an interface, the documentation comment should be the following one.

  /**
   * {@inheritdoc}
   */
geoanders’s picture

Thanks for the review!

$logger->info(t('S3 database backup cron enabled.'));

Fair point and good catch! Will get those fixed up.

            $result = $s3->putObject([
              'Bucket' => $config->get('s3.bucket'),
              'Key' => $objectFolder . $objectKey,
              'Body' => fopen($file->getFileUri(), 'r'),
            ]);

@apaderno
Are you able to elaborate more on this? Are you referring to the fopen line? S3DatabaseBackupFileHandler class implements file_system.

For the adapter classes, I was going to use the Plugin API, but I don't think I will as I don't foresee there being anymore adapters. I will just make them services like you mentioned, since other services are being passed into the adapter constructor anyways.

Agreed, that would be the correct phpdoc comment. Will get that adjusted in the adapters.

Thanks again for your time.

geoanders’s picture

Status: Needs work » Needs review

All issues now fixed.

In regards to the following:

            $result = $s3->putObject([
              'Bucket' => $config->get('s3.bucket'),
              'Key' => $objectFolder . $objectKey,
              'Body' => fopen($file->getFileUri(), 'r'),
            ]);

It is now changed to:

            $result = $s3->putObject([
              'Bucket' => $config->get('s3.bucket'),
              'Key' => $objectFolder . $objectKey,
              'SourceFile' => $file->getFileUri(),
            ]);

Don't need fopen and just passing in the Uri to the source file is enough.

Let me know if there is anything else. Thanks!

avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Needs review » Fixed

Thank you for your contribution! I am going to update your account.

These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

geoanders’s picture

Thank you for the links and for your time!

Cheers,
George

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.