Backup Database
When you create a backup of your Appsmith instance, it includes the database, configuration, and Git data. To back up your entire Appsmith instance, refer to the Backup Instance guide. You may also choose to back up only the Appsmith data. This page explains how to back up Appsmith data specifically for your self-hosted Appsmith instance using the appsmithctl
utility.
Prerequisites
Before starting, ensure the following:
- Your self-hosted Appsmith instance is running. If you haven’t already installed Appsmith, refer to the Installation guides. This guide assumes you are working with an existing installation.
- Ensure you have at least 2 GB of free storage available to perform backup tasks.
- Ensure you have the appropriate access to execute
docker-compose
orkubectl
commands, depending on your deployment setup.
Create database backup
Follow these steps to back up your Appsmith internal database:
- Docker
- Kubernetes
-
Go to the directory that has the
docker-compose.yml
file. -
Get your encryption details with:
docker-compose exec -it appsmith cat /appsmith-stacks/configuration/docker.env | grep ENCRYPTION
Store the encryption details securely, as you need them for restoring the Appsmith database.
-
Create a backup archive with:
docker-compose exec -it appsmith appsmithctl export_db
- Ensure that the name of the backup archive (
appsmith-data.archive
) isn't changed. - The backup archive file is stored in the
/appsmith-stacks/data/backup/
folder in your container directory. You can access it at./stacks/data/backup/
on your local machine.
- Ensure that the name of the backup archive (
-
If you can't access or have a different volume configuration, copy the archive file to your host disk with:
docker cp appsmith:/appsmith-stacks/data/backup/appsmith-data.archive .
This command copies the backup archive into your current directory.
-
To recreate the same environment elsewhere, copy the
docker.env
file with:docker cp appsmith:/appsmith-stacks/configuration/docker.env .
This command copies the
docker.env
file into your current directory.
-
Get the name of the Appsmith pod with:
kubectl get pods
-
Get your encryption details with:
kubectl exec ANY_APPSMITH_POD_NAME -- cat /appsmith-stacks/configuration/docker.env | grep ENCRYPTION
- Replace
ANY_APPSMITH_POD_NAME
with the pod name. - Store the encryption details securely, as you need them for restoring the Appsmith database.
- Replace
-
Create a database backup with:
kubectl exec -it ANY_APPSMITH_POD_NAME appsmithctl export_db
- Replace
ANY_APPSMITH_POD_NAME
with the pod name. - Ensure that the name of the backup archive (
appsmith-data.archive
) isn't changed. - The archive file is stored in the container directory
/appsmith-stacks/data/backup/
.
- Replace
-
Copy the archive file with:
kubectl cp ANY_APPSMITH_POD_NAME:/appsmith-stacks/data/backup/appsmith-data.archive appsmith-data.archive
Replace
ANY_APPSMITH_POD_NAME
with the pod name.
Troubleshooting
If you encounter any issues during the restore process, consider the following:
- Verify that you have the required permissions to execute
docker-compose
orkubectl
commands.
If you continue to face issues, contact support using the chat widget available in the bottom-right corner of this page.