How do I migrate Appsmith installation from one VM to another?

There are times when a user would like to migrate the Appsmith installation from 1 VM to another. This could be from their local machine to a server or between 2 servers.

On the old VM:

  1. Dump the mongo data from the old VM via the command:
    mongodump --uri "mongodb://<rootUsername>:<rootPassword>@localhost:27017/appsmith" --out=/tmp/appsmith-mongo-dump
  2. Copy the dump file to the new VM
  3. Open the file encryption.env and note the values in this file. The values here are important for Appsmith to be able to read sensitive information in the new installation.

On the new VM:

  1. Install Appsmith via the install.sh script.
  2. Restore the dump on the newly created mongo container via the command:
    mongorestore /tmp/appsmith-mongo-dump -d appsmith --uri=mongodb://<rootUsername>:<rootPassword>@localhost/appsmith
  3. Open the file encryption.env and change the variables APPSMITH_ENCRYPTION_PASSWORD & APPSMITH_ENCRYPTION_SALT to the same ones as the old VM. This is important because sensitive data in Mongo is encrypted using these credentials. Without this, you risk corrupting any passwords you’ve saved.
  4. Restart the Appsmith system using the command: sudo docker-compose down && sudo docker-compose up -d

A note on this, the first step tries to connect to MongoDB at localhost:27017 , however, the docker-compose.yml file generated by install.sh doesn’t expose the MongoDB service to the host machine. To do this, please make the following change in your docker-compose.yml file:

Under the following lines:

expose: - “27017”

Add the following two lines, with the same indentation:

ports: - “27017:27017”

Then run docker-compose up -d from you Appsmith installation folder and then MongoDB should be reachable at localhost:27017 and so the first step in the above detail should work fine.

Hello!

If the installation is on a cloud provider, wont taking a snapshot/AMI and launching new Instance with the AMI be a simpler process to migrate the installation?

After verifying the installation on newer instance, shut-down/terminate the older instance.

The custom installation/setup scripts can be incorporated as user-data scripts.

Thanks & Regards,

Omkar Kadam