Hi I'm having issues with using growthbook on AWS ...
# ask-questions
t
Hi I'm having issues with using growthbook on AWS EC2, I setup the docker compose and I've changed the apihost and origin to the private IP of the EC2 (it needs to remain private) but its unable to fetch the api from myprivateip:3100.
f
Hi Decklyn
are you able to access the myprivateip:3100 directly?
it should load a json file
t
This is the Json file?
I removed the IP and the sha
showing
This is connecting to privateip:3100 not localhost
f
cool, thats good - what did you set for the APP_ORIGIN and API_HOST?
t
APP_ORIGIN=localhost:3000 API_HOST=http://privateip:3100
The reason why Origin is localhost is because I cannot access the api json without it
f
are you running the app from localhost?
t
is this correct?
Or should I change both to the private ip
f
it can work that way - try adding the http://
you may have cookie errors on authentication with the mis-matched domains - but you can try
t
Ah ok its still having errors with fetching since it sees it as a custom domain
If I change the host to the private IP it just comes up with the error cannot fetch and then I cannot access the json file
I'm allowing all traffic from the ec2 security group so the networking shouldn't be an isue
f
but the API hasn’t changed?
first step is to get the json working - second would be to verify the correct env variables - and then check the console when you get the error, it should tell you a bit more
t
The api hasnt changed
f
if you haven’t changed it, why are no not able to see the json if you access it directly?
t
I changed it just there because I'm getting the error about not setting the env for custom domains
I can only access the json if i set localhost as the api_host but when I do that
the login brings up an error telling me to use those environmentals
Does that make sense?
Ok, i managed to fix it
It looks like I needed a JWT_Secret and env key
I looked at the docker container logs
and figured it out
back-end | /usr/local/src/app/packages/back-end/dist/util/secrets.js:49 | 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.js4911) | at Module._compile (nodeinternal/modules/cjs/loader1155:14) | at Object.Module._extensions..js (nodeinternal/modules/cjs/loader1209:10) | at Module.load (nodeinternal/modules/cjs/loader1033:32) | at Function.Module._load (nodeinternal/modules/cjs/loader868:12) | at Module.require (nodeinternal/modules/cjs/loader1057:19) | at require (nodeinternal/modules/cjs/helpers103:18) | at Object.<anonymous> (/usr/local/src/app/packages/back-end/dist/init/config.js1119) | at Module._compile (nodeinternal/modules/cjs/loader1155:14) | at Object.Module._extensions..js (nodeinternal/modules/cjs/loader1209: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
Is the error that popped up
It should be ok now, thank you for your help
f
okay great
201 Views