Databases¶
Database backups are not enabled by default. You will need to configure a database backup.
Listing Databases¶
Fru.io list can list different types of objects including backups, databases, execs, files, restores, and sites.
The following command returns the databases assets. In this example, there is one database named mysite for the mysite site.
➜ Fru.io list databases
DATABASES
NAME SITE SERVER SERVERREADY AGE
mysite mysite default-9482b True 10d
Listing Database Backups¶
Fru.io list can list different types of objects including backups, databases, execs, files, restores, and sites.
The following command returns the database backups. In this example, there is one database named mysite for the mysite site. The output is restricted to database backups with the --db flag. Omitting the --db flag will list both database and file backups.
➜ Fru.io list backups --db
DATABASE BACKUPS
NAME DATABASE AGE COMPLETE BYTES
mysite-jtsg8 mysite 14m true 31556
Database Backups¶
Database backups can be created on demand or run on a schedule. Once a backup has been generated it can be restored to a site or downloaded.
The following command initiates a backup of the databases assets for the mysite site.
➜ Fru.io backup database mysite
Initiated database backup: Fru-demo/mysite-h9fqh
This command returns a reference to a database backup. The reference can be used to query the state of a backups with the following command:
➜ Fru.io describe backup database Fru-demo/mysite-h9fqh
Configuring Database Backups¶
To configure a backup schedule, use Fru.io config backups. One argument is required: a reference to a site. Backups are initiated daily at a randomly assigned time, and seven automated backups are retained by default.
➜ Fru.io config backups enable Fru-demo/mysite
Enabled database backups for site: Fru-demo/mysite
The Fru.io config backups retention command sets the number of automated backups to be retained.
This command accepts two arguments: a reference to a site and the number of backups to be retained. By default, 7 backups will be retained, equating to one week's worth of daily backups. The count can be configured to values between 1 and 365.
➜ Fru.io config backups retention Fru-demo/mysite 5
Set database backup retention count to 5 for site: Fru-demo/mysite
Pushing Databases¶
Fru.io push can move files and databases from your local environment to a site. Uploading files or a database will trigger a job that performs the task on Fru-Live.
Use Fru.io push database to import a database to your site. Two arguments are required: a reference to a site and the path to a database backup asset. Database backups must be gzip-ed SQL files. When the database backup has been uploaded, a backup restore operation is initiated using the uploaded asset.
The following command pushes a database named foo.sql.gz from local to live and initiates a backup restore.
➜ Fru.io push database mysite ./foo.sql.gz
Uploaded: ./foo.sql.gz
Initiated backup restore: Fru-demo/mysite-gxsrd
Fru.io describe will give you the job's status.
➜ Fru.io describe restore database Fru-demo/mysite-gxsrd
Name: mysite-gxsrd
Org: Fru-demo
Created: 5m ago (2020-04-23 18:12:22 -0400 EDT)
Database: mysite
Export:
Status: ImportOpFinished
Pulling Databases¶
Fru.io pull can move files and databases from a site to your local environment.
This command downloads a database backup asset. One argument is required: a reference to a database backup. The backup is downloaded into the current directory.
➜ Fru.io pull database Fru-demo-h9fqh
Downloaded: Fru-demo-h9fqh.gz
Restoring Databases¶
Fru.io restore can apply a database backup to a site.
This command restores a database backup named mysite-jtsg8 to the mysite site.
➜ Fru.io restore database mysite mysite-jtsg8
Initiated database restore Fru-demo/mysite-wd4kq
Fru.io describe will give you information about the restore job.➜ Fru.io describe restore database mysite-wd4kq
Name: mysite-wd4kq
Org: Fru-demo
Created: 23s ago (2020-04-29 09:51:27 -0400 EDT)
Database: mysite
Export: mysite-jtsg8
Status: ImportOpFinished
Example¶
Creating a database backup:
Pushing a local database to Fru-live:
Pulling a database from Fru.io to your local: