As part of my GrowthBook POC, we set it up growthb...
# ask-questions
s
As part of my GrowthBook POC, we set it up growthbook instance on a EC2 instance, with little to no modification of the
docker-compose.yml
that came with the git repo. And we defined data sources and metrics using the web UI forms. I am guessing that all the meta data is being stored in mongoDB. However, when we restarted the docker container using the following commands , I lost all the metrics, exposure and other definitions. I also lost users who registered. I am sure there is a better way to stand it up so as to persist across restarts? Any suggestion is appreciated
Copy code
docker compose down 
docker compose up
f
You want to mount a persistent volume for the MongoDB container. Or, switch to using a hosted service like MongoDB Atlas instead.
s
got it. can i use s3 as a persistent volume? will this work?
Copy code
depends_on:
      - mongo
    environment:
      - MONGODB_URI=<mongodb://root:password@mongo:27017/>
      - APP_ORIGIN=${APP_ORIGIN}
      - API_HOST=${API_HOST}
    volumes:
      # - uploads:/usr/local/src/app/packages/back-end/uploads
      - uploads:
          S3_BUCKET:${S3_BUCKET}
          S3_REGION:${S3_REGION}
volumes:
  uploads:
f
You can use that for file uploads, but not for MongoDB.
s
Okay. Thanks.
Followed your suggestion: a. Now mounted a EBS block to an EC2 instance (/data), b . Changed the docker yaml to
Copy code
volumes:
      - uploads:/data/growthbook/uploads # ebs volume that is mounted for persistent storage
However, when I restart it is not storing user/role information
We are asked to sign up again
f
There are 2 directories to persist. uploads is only for file uploads (e.g. adding screenshots of experiments). The other directory you need is on the
mongo
container and not the growthbook one. In the mongo container, data is stored at
/data/db
so that needs to be persisted
s
Thanks for your help.