It is fundamental to back up your application and its data to recover from breaches or errors resulting from upgrades. Before you upgrade your MDriven Server and Turnkey or upload your updated Model to the MDriven Server, it is crucial to create a restore point in case updates don't behave as expected and cause data loss.
MDriven's Data Architecture
The Admin Database (DatabaseVistaDB.vdb6 or DatabaseCompact.sdf )
- The admin database stores the application data, which includes: the Model and its metadata, user accounts, roles, and access rights.
The User Database
- Stores the actual business data entered by users.
- Embedded Database: this is the default file-based storage used when no external storage is specified. User data is stored either in an SQL Compact or VistaDB database.
- External Database: this is a dedicated database server, like MySQL, Microsoft SQL Server, or PostgreSQL, and is the standard for production and enterprise environments.
Backing Up Your Data
Open the MDriven Designer.
Click on the Cloud Connection Icon
to open the Cloud Connection Dialog.
Within the Cloud Connection dialog, go to the Active MDriven Server tab.
Enter the required credentials for connecting to your MDriven Server in the fields: Name (User Name), Password, and Server (MDriven Server URL).

Back Up Admin DB
In the Cloud Connection dialog, go to the Admin DB Access and Swap tab.
1. Start by creating a snapshot of the Admin db.
An error message reading "502 Bad Gateway expected due to server forced restart" will be displayed in the MDriven Server status section. This is normal.
2. Check Server Status to make sure MDriven Server is up and running. If the MDriven Server does not start running after some seconds, then restart the MDriven Server.
3. Download the created snapshot of the Admin db.

Back Up Current Running Model
Prepare a copy of the version of the Model currently running on the MDriven Server.
If you are not sure, download the Model on the MDriven Server using the MDriven Designer Cloud Connection Dialog.

Back Up Model Data
1. Within the MDriven Designer, click on the System Prototype Icon
.
2. Go to the MDriven Server tab.
3. Click on Start System. If the connection to the MDriven Server is successful, the Migrate button will be enabled.
4. Click on the Migrate button to open the Migrate window.
5. Click the download button to download all of the Model data into an xml file. The button will show progress until the download is done.

Restoring App
Upload the previously backed-up model.
Restore Model Data
1. Within the MDriven Designer, click on the System Prototype Icon
.
2. Go to the MDriven Server tab.
3. Click on Start System. If the connection to the MDriven Server is successful, the Migrate button will be enabled.
4. Click on the Migrate button to open the Migrate window.
5. Click the button that reads the xml data file.
6. Click on the Chunk Save button to upload the data to the MDriven Server.
7. Click on save in the system prototyper window to persist the loaded data permanently into the database.

NOTE: If the Model version on the MDriven Server is not the same as that for the data backup, then restoring user data will not be allowed.
Upload Admin DB Backup
1. Open the Cloud connection dialog and go to the Admin DB Access and Swap tab.
2. Browse for the backed-up admin db.
3. Upload the admin db to the MDriven Server.
An error message reading "502 Bad Gateway expected due to server forced restart" will be displayed in the MDriven Server status section. This is normal.
4. Check Server Status to make sure MDriven Server is up and running. If the MDriven Server does not start running after some seconds, then restart the MDriven Server.

NOTE: After uploading the admin db backup, make sure the previous credentials for connecting to MDriven Server from the old app are used in the MDrivenServerOverride file. Otherwise, the Turnkey app will be blocked from connecting to the MDrivenServer.
In case Turnkey is blocked from connecting, use PwdReset to set a new password for user a.
