Dependency Snapshot

Most built-in dependency services in the Crafting system — such as databases — persist their data to files. A dependency snapshot captures these files and can be used to quickly restore a dependency service to a known state when a sandbox is created, or to revert data at any point during development.

For a conceptual overview, see Snapshot.

Creating a Snapshot

Create a dependency snapshot using the snapshot button in the Web UI, or using the CLI:

cs snapshot create -W SANDBOX/DEPENDENCY NAME

Where:

When a snapshot is created from a running dependency service, the service is temporarily stopped to ensure data consistency, then resumed when the snapshot is complete.

Dependency snapshots are shared across the org and can be used by any template or sandbox.

Using a Snapshot

In a Template

Reference a dependency snapshot in a template definition so new sandboxes have the data ready when they start:

dependencies:
- name: mysql
  service_type: mysql
  snapshot: NAME

Restoring to an Existing Sandbox

A snapshot can be restored to a running dependency service at any time using the restore button in the Web UI, or using the CLI:

cs snapshot restore -W SANDBOX/DEPENDENCY NAME

Where SANDBOX/DEPENDENCY and NAME follow the same convention as the create command.

When restoring, the service is temporarily stopped and resumed after restoration is complete.

Service Type and Version Compatibility

A snapshot can generally only be restored to a dependency service of the same service_type. Crafting checks the service_type and blocks restoration if it does not match.

For version, compatibility is service-type specific and Crafting does not check or block based on version. However, restoring a snapshot to a mismatched version may cause the service to fail to start for certain service types. Check the service logs if this occurs.

See Also