Snapshot management
Backup of the environment at a new levelA snapshot refers to a copy of the state of a website at a specific point in time. Much like a photograph, snapshots capture the exact state of a website in terms of both data and configuration. A snapshot essentially serves as a backup, representing environment components such as the git commit, database, and media library.
See also:
Environments
Define environment and explain its components
Snapshots list
To view existing snapshots, navigate to Snapshots within the environment scope. On the "Snapshots" page, a table displays all the items within the environment:
- Manually Triggered Snapshots
- Imported Snapshots
- Auto Backups
Each snapshot lists the following attributes:
- Name
- Author – The individual who triggered or imported the snapshot.
- Date
- Status – The current status of a snapshot:
- Ready – The snapshot is ready to use.
- Processing – The snapshot was imported to the dashboard and incurrent being processed by the SiteBox Dashboard.
- Error – The snapshot couldn't be processed by the SiteBox Dashboard.
- Contents – The environment components stored in the snapshot: git commit, database, media library.
For each snapshot, the following actions are available in a dropdown:
- Download Snapshot – Downloads the snapshot as a ZIP package.
- Create a new environment from a snapshot – Initiates the process of creating new environment based on a snapshot.
How to create a Snapshots?
To manage snapshots, navigate to Snapshots within the environment scope. There are three methods to create a snapshot:
How to trigger a Snapshot?
Triggering a snapshot from an existing environment is an effective way to create a backup. It automatically stores all environment components at that specific point in time: git commit reference, database, and media library. To trigger a backup, hit the "Take a snapshot now" button, then select at least one of the available components:
- Codebase
- Database
- Media Library
You can also add a description to your snapshot.
Finally, use "Trigger backup" button to initiate the snapshot creating process.
How to import a Snapshot?
It is possible to import an external snapshot. This could either be a snapshot created by the SiteBox Dashboard and stored locally or a manually composed snapshot out of environment components. Either type can be uploaded using the import flow, initiated by clicking the "Import snapshot" button. The flow creates a new snapshot but does not restore it by default. To load its contents, run the "Restore a snapshot" procedure.
How to compose a Snapshot?
To compose a snapshot, it's essential to understand the structure of a snapshot as discussed in another article. Follow these steps to compose a snapshot out of environment components:
- Create a snapshot directory.
- If the snapshot should contain a database dump, place a
dump.sql
file in the snapshot directory, following the database dump guidelines. - To include a media library in the snapshot, add the
uploads
folder within the snapshot directory. - Zip the snapshot folder into
snapshot.zip
and proceed with the regular snapshot import flow.
It's vital to note that some operating systems might automatically include hidden files in the ZIP package. This could cause problems when uploading or restoring snapshots in the SiteBox Dashboard. To avoid this, we recommend creating ZIP packages via the CLI, ensuring hidden files are excluded.
MacOS example
zip -r snapshot.zip snapshot/ -x '**/.*' -x '**/__MACOSX'
How to restore a Snapshots?
To restore a snapshot, navigate to Snapshots within the environment scope and click the "Restore a snapshot" button. This action opens a modal with the following options:
Restoration strategy
- Single Snapshot Restore – allows selecting one or more environment components from a single snapshot.
- Multi Snapshot Restore (currently unavailable) – lets mix and match environment components from different snapshots.
Restoration process
- Source environment – specifies from which environment a snapshot will be selected to import into the current one environment.
- Snapshot to restore – specifies which snapshot to import into the current environment.
- Components to restore – identifies the components to import into the current environment (this list may be updated based on the snapshot's contents).
How to remove a Snapshot?
Snapshots are automatically deleted on a rolling basis. Once the maximum number of snapshots available per environment is reached, the oldest snapshots are automatically removed.