Hello Team, I'm following the self hosting docume...
# ask-questions
f
Hello Team, I'm following the self hosting documentation [1] using docker compose on localhost. When I try to access the same, I'm getting: Error connecting to the GrowthBook API at http://xyz:3100. Received the following error message: Load Failed Anyone can help me? Thanks in advance [docker-compose.yml] version: "3" services: mongo: image: "mongo:latest" environment: - MONGO_INITDB_ROOT_USERNAME=root - MONGO_INITDB_ROOT_PASSWORD=password volumes: - mongodata:/data/db growthbook: image: "growthbook/growthbook:latest" ports: - "3000:3000" - "3100:3100" depends_on: - mongo environment: - MONGODB_URI=mongodb://root:password@mongo:27017/growthbook?authSource=admin - APP_ORIGIN=http://xyz:3000 - API_HOST=http://xyz:3100 volumes: - uploads:/usr/local/src/app/packages/back-end/uploads volumes: uploads: mongodata:
r
Our official support hours are 6:30am - 5pm Pacific Time, Monday through Friday. You may occasionally hear from us outside of these hours. Your support request has been logged in our system. Our support team will get back to you very soon!
f
do you have caddy, nginx or similar services?
f
It is hosted on Public IP
f
docker logs growhbook ?
f
yarn run v1.22.19 $ wsrun -p 'back-end' -p 'front-end' --no-prefix -c start $ node dist/server.js $ next start ready - started server on 0.0.0.0:3000, url: http://localhost:3000 /usr/local/src/app/packages/back-end/dist/util/secrets.js:79 throw new Error("Cannot use JWT_SECRET=dev in production. Please set to a long random string."); ^ Error: Cannot use JWT_SECRET=dev in production. Please set to a long random string. at Object.<anonymous> (/usr/local/src/app/packages/back-end/dist/util/secrets.js7911) at Module._compile (nodeinternal/modules/cjs/loader1198:14) at Object.Module._extensions..js (nodeinternal/modules/cjs/loader1252:10) at Module.load (nodeinternal/modules/cjs/loader1076:32) at Function.Module._load (nodeinternal/modules/cjs/loader911:12) at Module.require (nodeinternal/modules/cjs/loader1100:19) at require (nodeinternal/modules/cjs/helpers119:18) at Object.<anonymous> (/usr/local/src/app/packages/back-end/dist/init/config.js1119) at Module._compile (nodeinternal/modules/cjs/loader1198:14) at Object.Module._extensions..js (nodeinternal/modules/cjs/loader1252:10) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn start
failed with exit code 1
f
add - SECRET_API_KEY= - NODE_ENV=production - JWT_SECRET=
f
But this is not a production env.. I just want to test this on ec2
f
answer in your logs
f
Is it not possible to setup this as we do on local without these env variables?
r
Yes, when self-hosting GrowthBook locally, you still need to set environment variables to customize the behavior of your instance. The default configuration is optimized for trying things out quickly on a local dev machine, but beyond that, you may want to set environment variables for various purposes, such as changing domains and ports, configuring a database, or setting up email.
For example, if you need to run GrowthBook on a different host than ​`localhost`​ or change the default ports, you would need to set the ​`APP­_ORIGIN`​ and ​`API­_HOST`​ environment variables in your ​`docker-compose.yml`​ file. Here's an example snippet showing how to set these variables:
Copy code
yaml
growthbook:  
 ...  
 environment:  
 - APP­_ORIGIN=http://<my ip>:3000  
 - API­_HOST=http://<my ip>:3100
Remember to replace ​`<my ip>`​ with your actual IP address or domain, and adjust the ports as needed.
For more detailed information on the environment variables available for self-hosting GrowthBook, you can refer to the Self-hosting Environment Variables section of the GrowthBook documentation.