View Source Litestream (Litestream v0.3.0)

This GenServer module allows you to run Litestream via a port in the background so that you can easily backup your SQLite database to an object store.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

The start_link/1 function is used to start the Litestream GenServer. After starting the GenServer, the process will download the Litestream binary and start it up to begin database replication. The Litestream GenServer expects a Keyword list with the following options

This function will start the Litestream process, if it is not currently running. If it is already running, then this operation is effectively a no-op.

This function will return the status of the Litestream port with either a :down or :running atom.

This function will cleanly stop the Litestream process, but the GenServer will still be running.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

The start_link/1 function is used to start the Litestream GenServer. After starting the GenServer, the process will download the Litestream binary and start it up to begin database replication. The Litestream GenServer expects a Keyword list with the following options:

  • :repo - The Ecto Repo that manages the SQLite database. REQUIRED
  • :replica_url - The URL to which the SQLite database should be backed up. REQUIRED
  • :access_key_id - The access key ID to the provided :replica_url. REQUIRED
  • :secret_access_key - The secret access key to the provided :replica_url. REQUIRED
  • :name - The name of the GenServer process. By default it is Litestream. OPTIONAL
  • :bin_path - If you already have access to the Litestream binary, provide the path via this
              option so that you can skip the download step. OPTIONAL
Link to this function

start_litestream(name \\ __MODULE__)

View Source

This function will start the Litestream process, if it is not currently running. If it is already running, then this operation is effectively a no-op.

Link to this function

status(name \\ __MODULE__)

View Source

This function will return the status of the Litestream port with either a :down or :running atom.

Link to this function

stop_litestream(name \\ __MODULE__)

View Source

This function will cleanly stop the Litestream process, but the GenServer will still be running.