How to restore deleted app?

I have…

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [ x] Documentation issue or request

Current behavior

We started having duplicate apps in our deployed squidex after upgrading to 6.3.0. We noticed that there’s a new patch so we upgraded to 6.4.0 and started deleting the duplicated apps. However the apps that remain are old versions and there’s a lot of missing records on it. We wanted to restore the latest app and just want to ask how we can achieve it?

Environment

App Name: n/a

  • [X ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: 6.4.0

Browser:

  • [ ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [x ] Edge

Others:

Hi,

it is possible, but it is little bit of manual work.

If you have a backup of your mongodb, I recommend to restore this backup. If not, you have to execute the following steps. Before you continue you need a way to connect to you mongo instance. I recommend a graphical management tool for that. I recommend this tool: https://studio3t.com/

1. Make a backup

Make a backup of your database using mongo restore: https://docs.mongodb.com/database-tools/mongorestore/

You can also do it with studio3t.

2. Delete the deletion event

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

  1. Go to the Events collection.
  2. Find the deletion event with the following filter: { "Events.Type": "AppDeletedEvent" }
  3. Delete this document.

3. Update the apps

Variation 1:

You have to update the document for the app in the database:

  1. Go to the States_Apps collection.
  2. Set the deleted flag to false (there are 2 fields for that).
  3. Decrement the version field (there are 2 fields for that).
  4. Save the document.

Variation 2

In this situation it is easy to make the update manually, so Variation 1 is faster. But in other case the following process can be useful.

  1. Stop your Squidex instance.
  2. Turn on the rebuilder: https://github.com/Squidex/squidex/blob/master/backend/src/Squidex/appsettings.json#L553, e.g. set REBUILDER__APPS=true as environment variable (important, it is a double underscore).
  3. Start your Squidex instance and wait until the rebuild is over and your Squidex instance is available again.
  4. Stop the instance.
  5. Unset the rebuilder, e.g. by removing the environment variable.
  6. Restart your instance.

I have added this to the docs: https://docs.squidex.io/01-getting-started/installation/troubleshooting-and-support/restore-deleted-apps

1 Like

Hi Sebastian,

Thanks for the guide, we were able to restore the app. One thing I noticed is the validation to check if there’s an app with the same name doesn’t work when you are doing a restore this causes a duplication of the app on the system.

This is confusing. I will have to check it again.

We are using version 6.4.0 anyway and its deployed in Azure Kubernetes Service.

1 Like

Can you create a bug report for this?