WordPress hosting
Snapshots

Snapshots

Manage state of your website with snapshots

Snapshot refers to a copy of the state of a website at a particular point in time. Snapshots can be likened to a "photograph", they capture the exact state of a website, both in terms of data and configuration, at a specific moment.

Snapshots definition

A snapshot is essentially a backup, a reference to the precise state of your website, representing environment components like the git commit, the database, and the media library.

Environment components

  • Codebase – Instead of saving the entire code, SiteBox uses the git commit reference for the codebase. This approach ensures a reference to the version of the code at the time of the snapshot without redundantly storing the actual files.
  • Database – The website's database is captured in its entirety as an SQL dump. This blueprint can be loaded in both local or online environments, ensuring seamless transfer and restoration of database content.
  • Media Library – For media assets, the snapshot secures a comprehensive copy of the uploads directory, safeguarding all media files like images, videos, documents, and more.

Snapshot types

Benefits of using Snapshots

  • Data Management – Snapshots facilitate efficient data transmission between various environments, including local and online platforms. This capability proves invaluable for developers and teams seeking consistent data across dierent setups.
  • Error Reversion – In instances where updates introduce unexpected issues, snapshots offer a mechanism to revert to a prior, stable state, minimising potential downtime and disruptions.
  • Recovery – In scenarios of inadvertent data deletions or undesirable modications, snapshots act as a recovery mechanism, enabling restoration to a previous state of the website.
  • Migration – Snapshots streamline the process of migration from and to other hosting providers, ensuring migration with all essential data intact.

Structure of a Snapshot

Each snapshot is wrapped in a single directory. While users can choose any name for this directory, we strongly recommend either snapshot, backup, or root. For the purposes of this explanation, we'll refer to it as the "root directory".

This root directory must be packaged into a ZIP archive. Crucially, the ZIP package should only contain this one directory. Inside the root directory, there might be one or more dynamic environment components: Git Commit Reference, Database, and Media Library.

Database

The database component is provided as a MySQL dump le, which can be exported from MySQL management tools like PhpMyAdmin, MySQL Workbench, or TablePlus. Dump files should follow the rules listed below:

  • The database dump MUST be named dump.sql.
  • The database dump MUST reside in the root directory.
  • The database dump MUST NOT be encrypted nor zipped.
  • The database dump MUST NOT contain the USE or CREATE_TABLE commands.
  • The database dump SHOULD utilise the wp_ prefix. While custom prefixing is applied dynamically, it's essential to retain the wp_ prefix during transit.
  • Until the release of SiteBox Dashboard v3, the database dump MUST reflect the domain of the target environment (search and replace operations may be necessary).

When database dump is present in the snapshot, restoring it will cause environment database to be overridden by a snapshot.

Media library

The Media Library is packaged as the uploads directory located within the root directory of the snapshot. This mirrors the structure of the uploads directory generated by WordPress.

When media library directory is present in the snapshot, restoring it will cause all environment media to be overridden by a snapshot.

Example structure

snapshot.zip
└── snapshot/
    ├── dump.sql
    └── uploads/
        ├── 2023/
        ├── 2022/
        └── ...