Google Drive Backup

This plugin will automatically upload a backup upon completion to your authorized Google Drive. In order for the plugin to work properly you will have to create a Google OAuth App to authorize access. To create your own Google OAuth app please follow the directions outlined in the Prerequisites section below.

Prerequisites

OctoPrint 1.5.0

If you are using a version of OctoPrint older than version 1.5.0, this plugin will not work.

Dependencies

Due to upstream dependencies this plugin has been updated to only work in Python 3. You can either flash OctoPi 0.18 which ships with Python 3 standard or use the upgrade instructions here to upgrade your instance.

You may also need to install some system dependencies, specifically if you manually installed OctoPrint and didn't use the OctoPi image. Known dependencies that have been reported are Rust and libssl-dev. Use the commands to below to install them.

sudo apt install rustc
sudo apt install libssl-dev

Create a Google OAuth App

  1. Login to the Google Developers Console
    screenshot
  2. Create a new project giving it a name of your choice.
    screenshot
  3. In the sidebar on the left (via screenshot), select APIs and Services > Dashboard then at the top of the page click the button to Enable APIS and Services.
    screenshot
  4. Enter drive in the search box at the top of the page and click Google Drive API.
    screenshot
  5. Click the Enable button to allow our app to use the Google Drive API.
    screenshot
  6. In the sidebar on the left, select APIS and Services > Credentials
    screenshot
  7. Click CONFIGURE CONSENT SCREEN button at the top of the page.
    screenshot
  8. Select the External user type if you do not use Google G Suite, otherwise you can select Internal and click Create.
    screenshot
  9. Add a user support email and developer contact email, then press Save and Continue.
    screenshot
  10. No scopes are necessary. Click Save and Continue.
    screenshot
  11. If you don't publish your app you need to add the user email that you will be using to access Google Drive as a Test User. After doing so, press Save and Continue.
    screenshot
  12. Confirm all the information then click Back to Dashboard.
    screenshot
  13. In the sidebar on the left (via screenshot), select APIs and Services > Credentials again.
    screenshot
  14. Click on Create credentials and select OAuth client ID.
    screenshot
  15. Select Web application for application type and then enter a name (can be anything and does not really matter). Fill in the Authorized redirect URIs as https://jneilliii.github.io/OctoPrint-GoogleDriveBackup/ and then click Create.
    screenshot
  16. In the dialog box that appears, click the download button screenshot to save your client_secrets#####.json file then press OK.
    screenshot
  17. Use the downloaded client_secrets#####.json file to upload into the plugin’s settings to authorize its access to your Google Drive as described in the Configuration section below.

Setup

Install via the bundled Plugin Manager or manually using this URL:

https://github.com/jneilliii/OctoPrint-GoogleDriveBackup/archive/master.zip

Configuration

Once the Prerequisite steps above have been completed and you have downloaded your client_secrets.json file follow these steps to authorize the plugin to your newly created app.

  1. Open OctoPrint's settings from the System menu at the top of the page and select Google Drive Backup in the left-hand navigation menu.
    screenshot
  2. Use the Browse button to select your downloaded client_secrets#####.json file and press the Upload button.
    screenshot
  3. An authentication URL will be generated and presented to you. Click that new URL to open a new window and authorize your custom Google app.
    screenshot
  4. Log in to your Google account you want to give Drive access to. You will get a warning that the App isn't verified. This is normal as you have not submitted your custom app for verification by Google. You can choose to do that if you want but is not necessary for the operation of the plugin. Click the Advanced link at the bottom of the page and the click Go to <app name>.
    screenshot
  5. Click the Allow button to retrieve your authentication code to enter in the plugin's settings in the next step.
    screenshot
  6. Copy the code from step 5 and paste it into the Auth Code field and click Authorize.
    screenshot
  7. If everything went well then you will be presented with a successful message.
    screenshot

To-Do

  • Improve documentation.
  • Add custom upload folder.
  • Add route hook to allow for local redirect URIs during authentication.
  • Delete certs instead of just clearing flags to start over.
  • Improve error handling, display messages in UI.

Get Help

If you experience issues with this plugin or need assistance please use the issue tracker by clicking issues above.

Additional Plugins

Check out my other plugins here

Sponsors

Support My Efforts

I, jneilliii, programmed this plugin for fun and do my best effort to support those that have issues with it, please return the favor and leave me a tip or become a Patron if you find this plugin helpful and want me to continue future development.

Patreon paypal

No paypal.me? Send funds via PayPal to jneilliii@gmail.com

You can use this link too. But the normal PayPal fee will be deducted.