Good morning (well, for me it is :wink:). I have a...
# ask-questions
w
Good morning (well, for me it is 😉). I have a question for self-hosting GrowthBook. We are using CloudFormation for all our infrastructure and create test deployments of Stacks whenever we do changes. That means that, additionally to our production instance of GrowthBook we regularly boot up fresh instances. They come up with an empty database and as such the UI is presenting the “Set up your first account” dialog on first access. I want to avoid this by automatically creating a well-known admin user on the first start. I tried simply using the
SECRET_API_KEY
that we do set for the API - Proxy connection and checked if I can simply send it is Bearer token to use the API, but that didn’t seem to work (that is not a documented use case but a guess on my part that it might work). Am I doing it wrong or is that simply not going to work? If that is not an option, maybe there are other ways. Ideally I would use the API to create users (makes scripting it really easy) but I would also open to just write something into MongoDB to create the user. Or maybe there is a CLI command I can run on the instance to create a user? And as a bonus question: Once I have that use, can I also create an API key that I can use to e.g. automatically setup other things in the empty instances?
f
GrowthBook is stateless if you have a mongo/document db setup
(aside from a few env variables)
we usually build API endpoints as they are requested - so feel free to open a github issue requesting any
probably the easiest thing is to have a dump/import of mongo that can reset things
w
Good idea - it is a bit of a chicken and egg problem. Can you give me a rough pointer where those basic settings (e.g. users and API keys) are stored in Mongo so I can dump/import them?
f
most critical would be the organization collection
the users are in 'users'
api keys are in.... 'apikeys'
w
thankyou