D
Dokployโ€ข2mo ago
lutfifadlan

Badgateway on Nestjs app

Hi all, I've deployed my nestjs app using Dockerfile and I'm getting bad gateway error. Need help on this This is my repo https://github.com/lutfifadlan/bookmark. Also i have set the PORT to 8081
18 Replies
fredkisss (with 3 s') ๐Ÿ˜˜
You need to either add a PORT variable of 8081 in your Dockerfile (or add it in dokploy), or instead use the default 3333 you defined here : https://github.com/lutfifadlan/bookmark/blob/707622795cfd874e8386ca92c9bb2ce4753093bb/src/main.ts#L19
GitHub
bookmark/src/main.ts at 707622795cfd874e8386ca92c9bb2ce4753093bb ยท...
Contribute to lutfifadlan/bookmark development by creating an account on GitHub.
lutfifadlan
lutfifadlanOPโ€ข2mo ago
done that but still getting bad gateway the dokploy and server logs looks fine
fredkisss (with 3 s') ๐Ÿ˜˜
Have you checked the logs of your builds ? the bad gateway is probably because your builds failed
No description
lutfifadlan
lutfifadlanOPโ€ข2mo ago
deployment looks fine to me
No description
No description
lutfifadlan
lutfifadlanOPโ€ข2mo ago
im getting these logs though on the dokploy. not sure whether its related
No description
lutfifadlan
lutfifadlanOPโ€ข2mo ago
damn after I shared those images above, suddenly i got burst brute force for accessing my DB ๐Ÿ˜… luckily its just a side project
lutfifadlan
lutfifadlanOPโ€ข2mo ago
tried to hit an API from the docker container, it looks good
No description
Henrik
Henrikโ€ข2mo ago
You're trying to get https certificate on traefik.me route. That usually ends poorly
lutfifadlan
lutfifadlanOPโ€ข2mo ago
yeah, but ive tried with just http too and still didnt work any recommendation to solve the bad gateway error? ive tried with stop, delete, and then re-create the server too but still didn't work
Henrik
Henrikโ€ข2mo ago
What does application log say?
lutfifadlan
lutfifadlanOPโ€ข2mo ago
no error, looks good to me
No description
Henrik
Henrikโ€ข2mo ago
Are you deploying it as a docker compose or application?
lutfifadlan
lutfifadlanOPโ€ข2mo ago
I'm using Dockerfile, deploying it as application
No description
lutfifadlan
lutfifadlanOPโ€ข2mo ago
No description
lutfifadlan
lutfifadlanOPโ€ข2mo ago
i have a docker compose file but its just for development purpose
No description
fredkisss (with 3 s') ๐Ÿ˜˜
@lutfifadlan I found the issue : Your app doesn't listen to 0.0.0.0 and listens only to localhost by default. I send a PR to your repository : https://github.com/lutfifadlan/bookmark/pull/4
GitHub
fix: Bad gateway by listening to 0.0.0.0 interface by Fredkiss3 ...
It seems the app listens only to localhost by default, but when using docker, you need to listen to 0.0.0.0, so I added that.
lutfifadlan
lutfifadlanOPโ€ข2mo ago
wow it works now! thank you so much
fredkisss (with 3 s') ๐Ÿ˜˜
no problem ๐Ÿซก

Did you find this page helpful?