0.0
The project is in a healthy, maintained state
Solid Backup makes it easy to backup SQLite databases using VACUUM INTO or the backup API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 13.4
~> 1.56

Runtime

>= 7.2, < 8.2
>= 7.2, < 8.2
>= 1.4
 Project Readme

Solid Backup

Solid Backup provides simple backups for SQLite databases in Ruby on Rails apps.

Installation

In order to install Solid Backup run:

  1. bundle add solid_backup.
  2. bin/rails generate solid_backup:install.

The generator will go over all production SQLite databases and ask you whether you want to back up each one of them. By default, it uses the API mode. It'll also create storage/backups and install the Puma plugin.

That's it! Read the following section to learn how to customize the backup process.

Configuration

Solid Backup REQUIRES each SQLite production database to have a backup mode set, with the goal of ensuring all databases were taken into consideration and none will lack backups due to omission. There are three database backup modes:

Modes other than SolidBackup::Backup::None take the following parameters:

  • destination - a strftime template used to generate backup file names; the directory under which the files are placed must already exist and be writeable.
  • interval_in_minutes - the number of minutes to the beginning of the next backup after the previous one finished.

Additionally, SolidBackup::Backup::API takes the following parameters:

  • step - the number of database pages to back up in one step.
  • wait - how many seconds to wait in case the backup process run into a lock.

The following example configuration file demonstrates how to use each backup mode in practice:

SolidBackup.configure do |config|
	# Back up the primary database using the SQLite backup API.
  config.backup "primary",
                SolidBackup::Backup::API,
                destination: "storage/backups/primary_%Y%m%dT%H%M%S.sqlite3",
                interval_in_minutes: 15, # Start the next backup 15 minutes after the previous one.
                step: 100,               # Back up in 100-page increments.
                wait: 0.1                # Wait 0.1 seconds if a lock interrupts a backup step.

	# Don't back up the cache database.
  config.backup "cache", SolidBackup::Backup::None

  # Back up the queue database using VACUUM INTO.
  config.backup "queue",
                SolidBackup::Backup::VacuumInto,
                destination: "storage/backups/queue_%Y%m%dT%H%M%S.sqlite3",
                interval_in_minutes: 60 # Start the next backup 60 minutes after the previous one.
end

Puma plugin

Solid Backup ships with a Puma plugin that runs the backup process in the background on schedule. The install generator installs it automatically, but if you need to install it manually you can add the following line to puma.rb:

plugin "solid_backup"

Ruby and Rails Compatibility Policy

Solid Backup supports Rails versions supported by the Rails Core Team and Ruby versions supported by all supported Rails versions.

Author

This gem was created and is maintained by Greg Navis.