Einar Egilsson

MyLife: Backup to Dropbox

Posted: Last updated:

A new feature

A couple of weeks ago I released an open source project called MyLife. It was a replacement for the personal journal website OhLife which had recently shut down. The project didn't get much attention, but it did get a couple of users using it, and one of them posted an issue on Github asking for better export options, and suggested that an export to Dropbox would be useful. I liked the idea, mostly because I'm a Dropbox user myself and this was a good opportunity to play around with the Dropbox API so I went ahead and added the feature.

The way to integrate with Dropbox is to create a Dropbox App. Each app gets its own app key and app secret. This immediately posed a problem, since MyLife is only released as source code. Should I release something called an app secret with the code? That seems wrong, so the way this works is that if you want to use the backup to Dropbox feature you must create your own Dropbox app and get your own app key and secret and can generate your own access code. It's not complicated, below are instructions for doing just that.

Like always, the following applies: This software is provides AS-IS, I take no responsibility for any issues you might run into when following these instructions or trying to get this set up. This worked for me in this way. Use at your own risk!

Setting up your own Dropbox app

  1. Go to https://www.dropbox.com/developers and sign in with the Dropbox account you want to use for your backups.
  2. Go to the App Console page and click the Create App button in the upper right corner.
  3. Choose the following options:
    • What type of app do you want to create? Dropbox API app
    • What type of data does your app need to store on Dropbox? Files and Datastores
    • Can your app be limited to its own folder? Yes, my app only needs access to files it creates.
    • App name: You'll need to find your own name here. The name is unique across all Dropbox apps, so you can't just use MyLife, just use MyLife-1234567 or something like that.
  4. Press the "Create App" button to create your app.
  5. You are now on the Settings page for your app. Go down to the OAuth 2 section and under "Generated access token" press the Generate button. The button will disappear and instead a long random access token will be shown. Copy this token. Don't worry about any of the other OAuth 2 settings, we don't need anything else there, no urls or anything.
  6. You can optionally change some more things in the settings for your Dropbox app, e.g. change the App folder name to "MyLife Backup" or whatever you want it to be. The status of the app will be "Development" and that's fine, you never have to press the "Apply for Production" button, since you are the only user of this app and we don't really want it listed anywhere. Development status is fine for backups for one user.

Setting up the backup in MyLife

  1. Make sure you have downloaded and published the latest version of MyLife.
  2. Log into MyLife and go to the Settings page. Paste the token you got in your Dropbox app into the "Dropbox Access Token" field and press the "Save Settings" button.

That's it! Now every day at midnight MyLife should backup all your posts into a MyLife.txt file in your Dropbox app folder (App folders are in Dropbox/Apps/YourChosenFolderName) and your images should be there as well.

Like always with a free App Engine account you might run into quota limitations, especially if you have a lot of photos (which I don't). If your MyLife instance runs out of quota during the nightly backup then the next nightly backup will just continue where the last one left off, so it might take a couple of attempts before all your photos are backed up in Dropbox. After a couple of days, when all your old photos are backed up there shouldn't be any more problems because every day you're just backing up the photos from that day. Let me know if you have any problems with this, or if you have ideas for improvement!

If you read this far you should probably follow me on Twitter or check out my other blog posts. I no longer have comments on this blog, but you can send me an email if you have some comments about this page.