Hi, I have deployed my web application in pantaris. I am using mongo db as database and it is running as container. I have configured my front end, backend and mongo db as services in docker compose file. I have sandbox running in pantaris. I have named volume for mongo db and pushing the code in same branch. So mongo collections are retaining. Recently I have made few changes in docker compose file to enable external ports for mongo db. So that I can connect to database from my local mongo compass application. Since I have made this change, I am facing an issue, mongo collection are automatically getting deleted every day. I think its 24 hrs once. Yesterday I have added few records in table, and today its not present. The entire database and its collections are deleted.
I am adding docker compose file for reference.
version: '3.6' services: mongodb: image: mongo labels: "com.calponia.networking.0.port": 27017 "com.calponia.networking.0.type": tcp "com.calponia.networking.0.external": "true" volumes: - mongorelation:/data/db ports: - 27017:27017 app: build: context: ./sg-tool-chain dockerfile: Dockerfile ports: - 3000:3000 labels: - "com.calponia.networking.0.host=backend" - "com.calponia.networking.0.port=8080" - "com.calponia.networking.0.match.0.uri.prefix=/api/" - "com.calponia.networking.0.match.0.ignoreUriCase=true" - "com.calponia.networking.0.rewrite.uri=/" - "com.calponia.networking.1.port=3000" depends_on: - mongodb - backend backend: build: context: ./safety-guard-scode-designer dockerfile: Dockerfile ports: - 8080:8080 labels: - "com.calponia.networking.0.port=8080" - "com.calponia.networking.0.expose=backend" volumes: - my-volume:/mnt/project-files depends_on: - mongodb volumes: mongorelation: my-volume: labels: com.calponia.storage.type: project
These are the 3 lines I have added for enabling external ports to access the db in my local machine.
labels: "com.calponia.networking.0.port": 27017 "com.calponia.networking.0.type": tcp "com.calponia.networking.0.external": "true"
Well, you are exposing a database to the internet without any authentication as far as I can see? In that case, I don’t wonder that your data is gone as anyone has access to it.
In general, sandboxes keep their data as long as you start the same version / git branch in the same project.
Ok. Let me try setting credentials to database.