Issue
I am trying to run Appsmith on a Pi4 with a custom MongoDB 5 instance but it fails to connect. The appsmithctl check-replica-set command tries to connect to 127.0.0.1 instead of the MongoDB container, and there seems to be a timing issue. Setting the APPSMITH_MONGODB_URI directly in the docker-compose.yml file doesn't work, and depends_on doesn't help. Adding a healthcheck to the MongoDB container didn't solve the issue either.
Resolution
The issue was with running Appsmith on a Pi4 and not being able to connect to an external MongoDB 5. The problem was caused by a core dumping mongo5 binary in the appsmithctl check-replica-set and the timing of the command.
One solution was to patch the official appsmith-ce image by modifying the entrypoint.sh script. However, the issue was actually caused by the fact that the appsmithctl commands don't pick values from the environment directly.
To solve the problem, the APPSMITH_MONGODB_URI should be set in stacks/configuration/docker.env instead of directly in the docker-compose.yml file. Additionally, a healthcheck should be added to the MongoDB container.
The final solution involved setting the MongoDB URI in docker.env, adding a healthcheck to the MongoDB container, and fixing the timing issue by starting MongoDB separately before starting Appsmith.