This article is outdated

Due to privilieges restriction (Openshift free Plan), you’ll certainly find difficulties to backup your database using the well known gems, plugins available in Github such as Backup Gem. Since majoriy of these tools require write/read permissions to create and load configuration files.

This tutorial is generic and applies for any kind of Web app (Ruby on Rails, Django, Laravel …)

My Stack

  • Rails 4.1.4
  • Ruby 2.0
  • PostgreSQL 9.2
  • Cron 1.4 (Make sure to add this cartridge to your app)


1 - Create new Dropbox App and get the token
  • Create A new Dropbox App Through Dropbox Developers
  • Select Dropbox API -> App Folder then name your app
  • Once created, Go to Generated access token section and click generate
  • Now you got the token !

2 - Setup Dropbox Shell Uploader

SSH into your Openshift Application then run the following commands.

# It goes to App data folder then downloads the dropbox uploader shell
cd $OPENSHIFT_DATA_DIR && curl "" -o
# It makes the script executable
chmod +x
# it creates new file containing:
3 - Run first test
# Create a test file to upload
echo "Hello World !" > demo.txt

# Upload file to dropbox
./ demo.txt hello.txt

If you receive like this message:

Uploading “/var/lib/openshift/ID/app-root/data/demo.txt” to “/hello.txt”… DONE

Everything is Okay, if not recheck your access token.

3 - Automate the backup & Upload

In your local enviroment, open your app folder then locate the .openshift folder, go to cron folder and at that point, select the most suitable scheduling time for your cron task. For my case, I select daily, I do backups each day.

create a new file file with the following content, so the Openshift cron module can schedule its execution.

Don’t forget to push the changes to your app

👍 Backup successfully uploaded to Dropbox :)

That’s it :)

For Mysql Database (Not Tested, source: