# Backing Up and Restoring an Entando Application

# Prerequisites

This tutorial will show you how you can use an Entando application that you have built as a launching point for creating new applications.

# Create a Backup

This step requires using a running Entando environment to take an application backup. The output of this step is a local directory with the files (database and static assets) you can use to restore the application later.

  1. Log into App Builder

  2. Go to Configuration → Database

  3. Click on Create A Backup and wait for the process to complete. All of the static assets and database backups are persisted to a PVC in /entando-data on the server pod.

  4. Transfer the files from the server-container. The details will vary depending on your kubernetes environment.

kubectl OpenShift
kubectl cp <pod>:<path> <local-path> oc rsync <pod>:<path> <localPath>
e.g.kubectl cp quickstart-server-deployment-7b8c699599-f84zq:/entando-data backup e.g.oc rsync app-entando-server-deployment-67fd5b9954-s72mb:/entando-data
  1. You should see 3 directories - databases, protected, and resources. The protected directory contains the timestamped backup you triggered from the App Builder.

# Restore a Backup

In this tutorial you’ll create a custom copy of an Entando Application, install the backup files, build a Docker image from the updated app, and deploy it as a new application. Steps 3 and 4 can be skipped if you simply want to create a custom application.

  1. Clone the application at: https://github.com/entando/entando-de-app (opens new window) using

    git clone https://github.com/entando/entando-de-app
  2. On a command line, cd into the entando-de-app you just cloned:

    cd entando-de-app
  3. Take the backup file and unzip it in a location of your choice.

    • This zip contains all of the assets, content, and metadata needed to launch an Entando application. We are going to package the static assets and database backup into a Docker image.

    • Entando will automatically instantiate and populate the app from the most recent backup

  4. Move the resources and protected folders from your Entando backup into your entando-de-app application under src/main/webapp replacing any content that is already there.

  5. Build a docker image from the core app replacing the value of the tag in the -t argument with the tag you want to use for your image

    mvn clean package
    docker build . -f Dockerfile.wildfly -t <YOUR-USER>/<YOUR-REPO-NAME>:<YOUR-VERSION>
  6. Push the Image to your Repository

  7. Now we need to generate a new application for deployment to Kubernetes using the helm chart

    • If you have an output from helm from before you can re-use it and just apply the changes to the config map. In this case skip to step 12.

    • Or you can re-run helm and change the output

  8. Re-run the helm command for your environment

  9. Open the output yaml file from the helm command in the text editor of your choice

    • For example: vi training-alpha.yaml
  10. In that file look for the ConfigMap

    • The config map defines all of the images that are available as part of the deployment. They aren’t all used concurrently.

    • You can also view this config map in kubernetes/OpenShift

  11. Now you need to update the deployment to use your customized Wildfly image. Find entando-de-app-wildfly in the config map

    • Note that we are changing the de-app but you could create a custom version of any of the included images
  12. Change the version to match the version you used for your image

  13. Change the "organization" to the name of your main image repository organization and if you aren’t using docker.io (DockerHub) then change the registry as well.

  14. Save the file

  15. Follow the deployment steps you went through when you originally deployed your Entando application to your Kubernetes instance

  16. Once deployed go to the App Builder in your app

  17. Click Go To Homepage and you should see your restored application.