# Backing Up and Restoring an Entando Application
# Prerequisites
Java 11
Docker installed locally (https://docs.docker.com/docker-for-windows/install/ (opens new window))
maven
Access to a docker repository (docker.io or other)
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.
Log into App Builder
Go to Configuration → Database
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.
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 |
- 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.
Clone the application at: https://github.com/entando/entando-de-app (opens new window) using
git clone https://github.com/entando/entando-de-app
On a command line, cd into the entando-de-app you just cloned:
cd entando-de-app
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
Move the resources and protected folders from your Entando backup into your
entando-de-app
application undersrc/main/webapp
replacing any content that is already there.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 imagemvn clean package docker build . -f Dockerfile.wildfly -t <YOUR-USER>/<YOUR-REPO-NAME>:<YOUR-VERSION>
Push the Image to your Repository
docker push <YOUR-USER>/<YOUR-REPO-NAME>:<YOUR-VERSION>
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
Re-run the helm command for your environment
Open the output yaml file from the helm command in the text editor of your choice
- For example:
vi training-alpha.yaml
- For example:
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
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
Change the version to match the version you used for your image
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.
Save the file
Follow the deployment steps you went through when you originally deployed your Entando application to your Kubernetes instance
Once deployed go to the App Builder in your app
Click Go To Homepage and you should see your restored application.