Category: How do I do X?

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How do I connect to external MongoDB with tlsCAFile parameter in connection URL?


I am having trouble connecting an external MongoDB with my self-hosted Appsmith instance. The database requires the tlsCAFile parameter in the connection URL, but the backend does not support it. I have tried importing my certificate to the keystore, but with no success. After several hours of debugging, I discovered that a node-js script runs on deploy and also uses APPSMITH_MONGODB_URI, so I need both the tlsCAFile parameter in APPSMITH_MONGODB_URI and also an imported cert.


To connect an external MongoDB with a custom certificate to a self-hosted Appsmith instance, the following steps can be followed:

  1. Copy the custom certificate file to the stacks folder in Appsmith instance and rename it for easy access.

  2. Modify the APPSMITH_MONGODB_URI variable in the stacks/configuration/docker.env file to include the tlsCAFile parameter with the path to the custom certificate file. The variable should be enclosed with double quotes.

  3. Restart the Appsmith instance with the command docker-compose restart appsmith.

  4. If the connection to the external MongoDB still does not work, import the custom certificate into the trustStore using the following command:
    docker-compose exec appsmith keytool -import -noprompt -trustcacerts -alias customProxy -file /appsmith-stacks/myRootCert.cer -keystore /usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/security/cacerts -storepass changeit

  5. Restart the Appsmith instance again with docker-compose restart appsmith.

  6. If the Appsmith instance is running a check_replica_set.js script during deployment, ensure that the APPSMITH_MONGODB_URI variable in that script also includes the tlsCAFile parameter and import the custom certificate into the trustStore using the same command in step 4.

These steps should enable the connection between the external MongoDB with custom certificate and the Appsmith instance.