LiteFS Cloud CLI

We’ve had UI-based tooling for LiteFS Cloud since we released, however, many folks have been asking for CLI-based tooling as well. We just released flyctl litefs-cloud commands so you can manage your LiteFS Cloud clusters with the command line tool you know and love. These can also be accessed with the alias flyctl lfsc.

$ fly litefs-cloud
Commands for managing LiteFS Cloud databases

  flyctl litefs-cloud [command]

  litefs-cloud, lfsc

Available Commands:
  clusters    Manage LiteFS Cloud clusters
  export      Export LiteFS Cloud database
  import      Import SQLite database into LiteFS Cloud
  regions     List LiteFS Cloud regions
  restore     Restore LiteFS Cloud database
  status      Show LiteFS Cloud cluster status

Commands will automatically detect your organization when run from a directory containing a fly.toml file. If you are running outside of an app directory, you’ll need to specify the —org flag.

Please let us know how these are working for you and any improvements we can make!

Cluster Management

Create a new cluster

There are several subcommands that let you create, list, & delete LiteFS Cloud clusters. To create a new cluster, specify the name of the cluster and the region where you want the cluster data to be stored.

$ fly lfsc clusters create --region iad mycluster
Cluster "mycluster" successfully created in iad.

Run the following to set the auth token on your application:

fly secrets set LFSC_AUTH_TOKEN="FlyV1 ..."

You can then run the fly secrets set command on your target application to set the LiteFS Cloud auth token.

You can find a list of available LiteFS Cloud regions by running: fly lfsc regions

List your clusters

You can see a list of your available LiteFS Cloud clusters:

$ flyctl lfsc clusters list
NAME       	REGION	CREATED              
mycluster  	iad   	3m47s ago           	
test123    	fra   	2023-10-11T21:40:14Z	

Delete a cluster

Finally, you can remove your cluster by running:

$ fly lfsc clusters destroy -c mycluster
Cluster "mycluster" successfully deleted.

Please be careful with cluster deletion. It is a hard delete and we do not retain your data after a cluster is destroyed!

Data Management

Importing a database

You can import a local SQLite database file into your LiteFS Cloud cluster by using the following command:

$ fly lfsc import \
  --cluster mycluster \
  --database my.db \
  --input /path/to/local.db

Database imported to my.db in 3.549s

After import, your LiteFS nodes should detect the new database within a few seconds and it will be available to your whole cluster.

Exporting a database

You can export the current state of a database in LiteFS Cloud to your local machine for inspection by running:

$ flyctl lfsc export \
  --cluster mycluster \
  --database my.db \
  --output /path/to/output.db

Database exported to /path/to/output.db in 1.82s

Point-in-time restore

You can revert the state of a LiteFS Cloud database to a specific time by running:

$ flyctl lfsc restore \
  --cluster mycluster \
  --database my.db \
  --timestamp 2023-10-20T12:00:00Z

LiteFS Cloud retains every version of your database with 5-minute granularity over the past 30 days. The restore command will find the closest version to the timestamp.

Status information

You can see the current transaction ID and checksum of your databases by running:

$ flyctl lfsc status -c mycluster
NAME      	TXID            	CHECKSUM         
my.db     	0000000000000001	fa2b0b411ee82d89	
test.db   	00000000009a07c1	f0345489f23bb02c