Twenty behind NGINX reverse proxy

Im trying to self host Twenty using docker compose and NGINX. I just followed the tutorial in the page, and altered SERVER_URL at .env to be my domain. I can access the page and use the entire system with no problems. When i try to use the API, however, it times out every time. If i change SERVER_URL back to localhost, the API works, but i can no longer access the web part using my domain (expected). What im a missing? I tried changing FRONT_BASE_URL, but no effect.
47 Replies
charles
charles4mo ago
Hi @Marcelo Granzotto, sorry for the slow answer. So Twenty is working fine but you cannot access the API on your_server_url/graphql? could you share you network tab (browser developer console) while browsing twenty?
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
i cannot access the /rest API. In the browser everything works, but in a console it only works if i have twenty configured to be on localhost. My work around was to have two instances connected to the same DB in the browser there is nothing weird. The API just does not work in the custom domain for me the setup: -NGINX for reverse proxy -Twenty running with custom https domain -The web UI works, the API does not (on any device, even local)
charles
charles4mo ago
Can you browse: https://api.twenty.com/graphql ? (replacing api.twenty.com with your domain)
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
it opens
charles
charles4mo ago
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
No description
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
here it just loads forever
charles
charles4mo ago
Select "Other" and put your url
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
i will show you, just a sec
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
the only request that works is this first one /open-api. All the rest load forever, unless i use twenty at localhost
charles
charles4mo ago
Ok! I think I know where this come from Right now the Rest API is leveraging the GraphqlAPI (we plan to change it later this year)... over HTTP this means that when you make a /rest query, it is parsing it, making graphql and sending an http request to the /graphql endpoint
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
oh i see
charles
charles4mo ago
From the REST point of view, here is the graphql domain: const baseUrl = getServerUrl( request, this.environmentService.get('SERVER_URL'), ); It's there: https://github.com/twentyhq/twenty/blob/0f75e14ab25f2893d288024db1ff7c616a6966d7/packages/twenty-server/src/engine/api/rest/rest-api.service.ts#L30
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
is there something i can do? Or just run two instances for now
charles
charles4mo ago
it should work, could you ssh into your container and tell me what SERVER_URL is ? env | grep SERVER_URL
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
its the https domain
charles
charles4mo ago
does it include the protocol?
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
yes
charles
charles4mo ago
could you do a curl on this domain from your container?
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
No description
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
the domain points to a private ip, but the server and the clients have access
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
here is the .env
No description
charles
charles4mo ago
are you containerized?
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
its a ubuntu server running the docker image of twenty
charles
charles4mo ago
ok, could you curl from the docker image?
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
oh, maybe docker is the problem
charles
charles4mo ago
yes, I think your docker container cannot reach itself on this url
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
you have any idea how i can configure that? im using the default docker compose file
charles
charles4mo ago
docker ps
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
No description
charles
charles4mo ago
could you do docker ps?
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
No description
charles
charles4mo ago
docker exec -it 39234c511f6df sh then try to curl from there
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
ok, it loads forever so how can i give docker access to this?
charles
charles4mo ago
I think that's the issue, why is your container not having access to the internet?
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
i have no idea, new to docker
charles
charles4mo ago
can you curl other urls from your docker?
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
no google.com fails now thats interesting hahaha well, then i just need to solve this connection i think i got it from here
charles
charles4mo ago
Stack Overflow
My docker container has no internet
I had it working allright but now it stopped. I tried the following commands with no avail: docker run -dns 8.8.8.8 base ping google.com docker run base ping google.com sysctl -w net.ipv4.ip_for...
charles
charles4mo ago
yep, good luck 🙂
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
thank you so so much
charles
charles4mo ago
you are welcome
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
hey, just another question the OPEN_AI keys at .envm do they do anything? or they are just for the future
charles
charles4mo ago
not yet! we are exploring it to: - make summaries for email conversations, query data with SQL, etc... It's still ongoing exploration to see the potential and we will likely release something in 2025 (unless someone from the community is faster than us!)
Marcelo Granzotto
Marcelo GranzottoOP4mo ago
nice have a nice day and thank you again
charles
charles4mo ago
you too no wo!
Want results from more Discord servers?
Add your server