Difference between revisions of "Extensions:Automatic Backups"

From Lorekeeper Wiki
Jump to navigation Jump to search
Tag: 2017 source edit
Tag: 2017 source edit
Line 9: Line 9:
 
{{Composer}}
 
{{Composer}}
  
Add the following to your .env:
+
Add the following to your .env as desired:
 
<pre>
 
<pre>
 
BACKUP_NOTIFICATION_ADDRESS=(email address. can leave out and specify directly in config file if desired)
 
BACKUP_NOTIFICATION_ADDRESS=(email address. can leave out and specify directly in config file if desired)
Line 15: Line 15:
 
DROPBOX_TOKEN=(only required for Dropbox support. See below for how to obtain this.)  
 
DROPBOX_TOKEN=(only required for Dropbox support. See below for how to obtain this.)  
 
</pre>
 
</pre>
 +
===Dropbox Setup===
 +
To get an access token, you'll need to create a Dropbox app [https://www.dropbox.com/developers/apps here]. Once you've logged in and clicked the "Create App" button:
 +
# Choose "Scoped Access"
 +
# Choose "App Folder"
 +
# Give it a unique and descriptive name; you can use this one app for multiple sites/backups if you wish, so you may want this to be fairly general
 +
# Create the app
 +
This will make an app "in development" of which you are the sole user. You can leave this as-is in perpetuity.
 +
Once the app itself is created, navigate to the "permissions" tab, and check:
 +
* files.metadata.write
 +
* files.metadata.read
 +
* files.content.write
 +
* files.content.read
 +
and save these permissions. This is necessary for the app to read and write backups in its folder.
 +
Next, navigate back to the settings tab.
 +
# Under "Access Token Expiration", select "No expiration"
 +
# Click "Generate" under "Generated access token"
 +
This access token is what you'll use to connect your site to Dropbox.
 
== Configuration ==
 
== Configuration ==
 
<!-- Is any configuration necessary? Describe it here! -->
 
<!-- Is any configuration necessary? Describe it here! -->

Revision as of 07:37, 8 October 2021

Automatic Backups
Description Sets up in-app automated backups.
Author(s) Mercury
Status Testing
Github extensions/auto-backups
LK Version 2.0.0
Uses a Package


Facilitates automatic/scheduled backups of a site's /public directory-- under the assumption that all else (source code) is already backed up by virtue of originating from a different machine in the first place, thus including more would just waste space-- and database. While by default backups are saved to storage/app, it is HIGHLY RECOMMENDED that you configure either an off-server storage location for them or have a solution to move the backups off the server regularly, preferably automatically. To this end, optional Dropbox support is included.

This is more or less just a for-convenience implementation of existing tools, ready to go give or take configuration as desired. Implements spatie/laravel-backup with some pre-configuration as well as support for Dropbox via benjamincrozat/laravel-dropbox-driver. Those wishing to customize the configuration in-depth are recommended to peruse the laravel-backup documentation.

Installation

Pull the branch and update packages like so:

Installing packages with Composer:
Commands are given as composer [command]; if you have not installed composer globally, they will be php composer.phar [command] instead.
You may need to run composer self-update (assuming you have not recently) before installing package(s). If possible, update to composer v2.x; you may need to use the command composer self-update --2.
If feasible, run composer update.
If you encounter memory issues: Locally, run composer update. Copy the composer.lock file to your site's server.
Run composer install.

Add the following to your .env as desired:

BACKUP_NOTIFICATION_ADDRESS=(email address. can leave out and specify directly in config file if desired)
BACKUP_ARCHIVE_PASSWORD=(optional, but recommended; a strong password (careful of special symbols that may cause issues!) that enables encryption of backups. some server environments may not support encryption effectively (i.e. worked in local testing but not on DH) however)
DROPBOX_TOKEN=(only required for Dropbox support. See below for how to obtain this.) 

Dropbox Setup

To get an access token, you'll need to create a Dropbox app here. Once you've logged in and clicked the "Create App" button:

  1. Choose "Scoped Access"
  2. Choose "App Folder"
  3. Give it a unique and descriptive name; you can use this one app for multiple sites/backups if you wish, so you may want this to be fairly general
  4. Create the app

This will make an app "in development" of which you are the sole user. You can leave this as-is in perpetuity. Once the app itself is created, navigate to the "permissions" tab, and check:

  • files.metadata.write
  • files.metadata.read
  • files.content.write
  • files.content.read

and save these permissions. This is necessary for the app to read and write backups in its folder. Next, navigate back to the settings tab.

  1. Under "Access Token Expiration", select "No expiration"
  2. Click "Generate" under "Generated access token"

This access token is what you'll use to connect your site to Dropbox.

Configuration

Usage

Troubleshooting

Images

See Also