egregors/teamcity-docker-compose

502 Bad Gateway on certain TeamCity actions

UsAndRufus opened this issue · 7 comments

Hello, thanks for the great project! Have forked it and has been very easy to customise and setup our TeamCity server with.

However, on certain actions (automated ID fill-in in VCS root add, changing whether settings are stored in a versioned repo), I get a 502 Bad Gateway from nginx, either as a pop-up or appearing in the text field. It doesn't happen all the time. I restarted the docker containers and the issue persisted. I have changed some things in my fork (e.g. agent) but haven't touched the nginx stuff at all (apart from adding the correct environment variables).

I'm using TeamCity 2019, but I've compared the docs and the nginx config in this repo and the recommended config hasn't changed. I thought the issue might be WebSockets due to the asynchronous nature of the errors, but I'm not really sure now.

Any thoughts?

Oh if you want to have a look at my fork, you can see it here, although I haven't touched the nginx config so I don't think the issue lies in the fork.

I also encountered 502 Bad Gateway when trying to log into the server via the plugin for IntelliJ-based IDEs. Supplying the URL of the server without protocol or port stopped the error from happening, as well as disabling the "default proxy rules" option. However, using the TeamCity integration functionality is quite inconsistent.

HI, @UsAndRufus! Thank you for your appreciation. Yep, I got the same behavior after some update of TeamCity. But I've decided it is because of some of our network issues. Additionary we did find kind the similar ticket on jetbrains bug tracker: https://youtrack.jetbrains.com/issue/TW-49839
So, probably it is the TeamCity bug. Anyway, I gonna check log details at this weekend and will try to fix it ASAP. If you find a solution before me, please feel free to make a Pull Request

Thanks @egregors! Yeah I saw that same bug on YouTrack. I'm using TeamCity 2019 if that helps, although I think it happened when I was testing with 2018 too (can't confirm), but that bug is from 2 years ago. My colleague said he had a similar issue with Docker and ngnx a while ago, and it was to do with request sizes - Docker only allowing a certain request size. I can see that you've set the client max body size though, so it may not be that. Thanks again, really appreciate you taking a look into it.

@UsAndRufus so, after some research, I have decided to move from nginx to traefik. It's looking pretty cool and easy to maintain. Could you check it out? To run traefik version you just should to set up your domain and email in the traefik/traefik.toml and make make proxy and make uplog. All this stuff you may find in the traefik branch. I already have this version on one of my production server. I don't like some parts (like needing to set up a domain in the config) but It's work and I didn't get any 502 errors.

If you have some ideas about how to make it more pretty, feel free to PR or share your thoughts in #21 issue

@UsAndRufus I solved the problem by moving to traefik. Feel free to check the master branch and README

Hey @egregors - sorry I didn't get back to you! I was intending to test out the branch but the sprint got full of other tasks. I'm going to update my installation with the master branch now. Thanks so much for sorting this! This repo has been a real blessing