Skip to content

Backup system

Nyo edited this page Apr 8, 2016 · 1 revision

Backup system

Ripple has a built-in backup system. You can use it to backup your database and replays and save them locally or upload them to an AWS S3 server or Backblaze account. Everything used by the backup system is inside the folder backup-system.


Configuration

The backup system uses config.ini (that must be inside the backup-system folder) as config file. To tell the backup-system what to do, you have to copy config.sample.ini as config.ini and edit it with a text editor.

[general] section

This section contains general settings

  • backup_database - true/false. If true, the system will dump the database.
  • backup_replays - true/false. If true, the system will backup also replays.
  • backup_avatars - true/false. If true, the system will backup also avatars.

[db] section

This section contains MySQL parameters.

  • db_username - MySQL username
  • db_password - MySQL plain password
  • db_name - Database name

[backblaze] section

This section contains backblaze parameters.

  • backblaze_enable - true/false. If true, the system will upload backups to backblaze
  • backblaze_bucket_name - Your backblaze bucket name
  • backblaze_account_id - Your backblaze account ID
  • backblaze_application_key - Your backblaze application key

[s3] section

This section contains AWS S3 parameters.

  • s3_enable - true/false. If true, the system will upload backups to AWS S3
  • s3_bucket_name - Your S3 bucket name preceded by s3:// (eg: s3://osuripple)

[local] section

This section contains parameters relative to local backup.

  • local_enable - true/false. If true, the system will copy the backup archive to a local folder.
  • local_folder - Path where your backup archives will be stored.

[email] section

This section contains email parameters.

  • email_enable - true/false. If true, the system will send an email when a backup has been made.
  • email_to - Recipients of the email. Can be a single email address or multiple ones (separated by a comma)
    The email system uses Ripple's Mailgun configuration, so if you want to use the email feature of the backup system, you must configure Mailgun inside osu.ppy.sh\inc\config.php

Cronjob configuration

Using crontab -e, add a cronjob that runs the following command every 12/24 hours:

cd /path/to/ripple/backup-system && sh backup.sh

If you are using AWS/Backblaze upload feature, make sure to set your cron path to the right value. Run

echo $PATH

and add this line on top of your crontab

PATH=path_returned_by_prevoius_command
...
...

Backblaze configuration

If you want to upload your backup archives to backblaze, you must install B2's CLI Tool with this command:

$ sudo pip install b2

More info about B2's CLI Tool here.
Then, make sure you have configured the [backblaze] section of your config.ini and you are ready to go!


AWS S3 configurations

If you want to upload your backup archives to an AWS S3 service, you must install AWS CLI with this command:

$ pip install awscli

More info about AWS CLI here.
Then, run this command on the user that will run the cronjob

$ aws configure

and enter your Access Key, Secret Key and region.
Finally, make sure you have configured the [s3] section of your config.ini.


Tips

  • Don't forget to configure Mailgun in osu.ppy.sh\inc\config.php if you want to send emails when a backup has been made
  • You can save your backups using mode than one method, for example you can save them locally, upload to Backblaze and AWS S3 at the same time.