Squidex
  • Welcome to Squidex
  • Getting Started
    • Squidex Cloud
    • Installation Instructions
      • Platforms
        • Install on Kubernetes
        • Install on AWS (Deprecated)
        • Install on AWS EC2 using Docker
        • Install on Azure
        • Install on Azure using ARM
        • Install on Google Cloud Platform (GCP)
        • Install on Docker
        • Install on Heroku
        • Install on IIS
        • Install on Render
        • Install on Vultr
      • Configuration
        • Deploying the Image Resizer Service
      • Troubleshooting and Support
        • Diagnose Runtime Issues
        • Restoring Deleted Apps
      • Install Identity (Deprecated)
      • External Identity Providers
        • Azure AD (OAuth) with Squidex
    • Contributing and Developing
      • Building
      • Developing
      • Extensions
        • Custom Rule Action
      • Contributing
      • Architecture
      • Translating
      • Squidex Docs Program
    • Roadmap
    • Quick Start Guides
      • Vue.js Blog with Squidex
      • React.js Blog with Squidex
      • Angular Blog with Squidex
  • Documentation
    • Introduction and Use Case
    • Concepts
      • Apps
      • Teams
      • Schemas
        • Field Rules
      • Content
        • Scheduled Publishing
      • Assets
        • Querying Assets
      • Localization
      • Migrations
      • Roles & Permissions
      • Rules
        • Publish an Event to Azure Queues using Rules
        • Populate Elasticsearch Index
      • Backups
      • Subscriptions
        • App Subscriptions v/s Team Subscriptions
      • Notifications
      • Dashboard
      • Workflows
    • Software Development Kits
      • TypeScript
      • .NET
        • Version v14 (and Earlier)
        • Version v15 (and Later)
      • PHP
      • Java
    • Developer Guides
      • API
        • Authentication
        • Postman
        • Queries
        • Assets
      • Automation Tools (CLI)
      • Scripting
        • Scripting Helper Methods
      • Embed Content
      • Custom Workflows
      • Custom Editors
      • Custom Sidebars
      • Preview Content
      • Rule Formatting
        • Simple
        • Script
        • Liquid
      • Tutorials
        • Building a Blog with Squidex and Next.js
  • Next
    • Squidex 3.0: API Compatibility
Powered by GitBook
On this page
  • When Can I Restore An App?
  • Use a Backup
  • Restore Process
  • Step 0: Prepare a Backup
  • Step 1: Delete the Deletion Event
  • Step 2: Update the App Document

Was this helpful?

  1. Getting Started
  2. Installation Instructions
  3. Troubleshooting and Support

Restoring Deleted Apps

This Guide Details How to Restore an App or Other Object That Might Have Been Accidentally Deleted

PreviousDiagnose Runtime IssuesNextInstall Identity (Deprecated)

Last updated 2 years ago

Was this helpful?

When Can I Restore An App?

Squidex uses event sourcing to store the state of an object (an App, content, asset and so on). When an object is deleted, a new deletion event is added to the system and the object is marked as deleted. Therefore, most objects can be restored.

However, with Squidex 6.0 a new flag has been introduced: apps:deletePermanent. When this flag is set to true, a deletion process deletes all app data in the background. Therefore, it is not possible to restore the data.

Use a Backup

If a backup of the data is available, it is best to restore that backup, but this process requires taking the system offline. If this is not possible, proceed with the following guide.

Read more about backups in the following article:

Restore Process

Before continuing, you need a way to connect to the MongoDB instance. A graphical management tool, such as , is recommended. If the database is not accessible from outside, login to the server directly, or use port forwarding.

If MongoDB is running in Kubernetes, use kubectl port-forward command to forward the port.

kubectl port-forward mongo-0 27018:27017

Then the MongoDB server will be accessible under mongodb://localhost:27018.

Step 0: Prepare a Backup

Before continuing, backup the database. If you don't have an existing process in place, create a backup using studio3t:

Step 1: Delete the Deletion Event

The main data source in Squidex is a list of events. Most other states are derived from that list, so you can easily restore the other states from the events.

  1. Go to the Events (1) collection.

  2. Find the deletion event with the following filter: { "Events.Type": "AppDeletedEvent" }(2).

  3. Delete this document (3).

Step 2: Update the App Document

For this, there are two options. Variation 1 is faster, but does not work well if you have to undo a lot of changes.

Variation 1:

In this variation, changes are made in the database manually. It is faster, but there is the possibility of making mistakes. It is also time consuming if there are lots of changes.

To update the document for the App in the database, follow the procedure below:

  1. Go to the States_Apps (1) collection.

  2. Set the isDeleted (2) and _dl (3) fields to false. Ensure that you update both fields.

  3. Decrement the version (4) & Version (5) fields. There are two entries, ensure that you update both of them.

  4. Save the document.

Variation 2

In the second variation you can use the rebuild process. This part of Squidex runs before startup and uses the events to rebuild all documents of a given type, for example, all Apps or all assets.

  1. Stop your Squidex instance.

  2. Start your Squidex instance and wait until the rebuild is over and your Squidex instance is available again. If you use multiple instances, set the instance count to 1 to ensure that the rebuild is not running multiple times or in parallel.

  3. Stop the instance.

  4. Turn off the rebuild process, for example, by removing the environment variable or by setting the value to false.

  5. Restart your instance. If you use multiple instances, remember to set the instance count to your previous value to gain high availability once more.

Turn on the rebuild process: , for example set REBUILDER__APPS=true as environment variable (IMPORTANT: this it is a double underscore).

Backups
https://studio3t.com/
https://studio3t.com/knowledge-base/articles/mongodb-export-csv-json-sql-bson/#export-mongodb-to-bson-or-mongodump
https://github.com/Squidex/squidex/blob/master/backend/src/Squidex/appsettings.json#L553
Deleting an AppDeletedEvent document from database
Updating the App document from database