I've got ubuntu 12.04 host and two DNS records pointing to it.
git.example.com and ci.example.com # well not that addresses but I use them here :)
gitlab runs well, but I can't authorize gitlab-ci.
After I press "login with gitlab" on gitlab-ci page. It tries to send me to ci.example.com for authorize. I get it and changed ci.example.com to git.example.com , but after I press authorize app It does nothing after timeout I see 502 error with address:
For client side nothing changed here is gitlab-ci production.log:
Started GET "/"for ip_addr at 2015-06-02 18:13:50 +0300Processing by ProjectsController#index as HTML Rendered projects/_public.html.haml (20.0ms) Rendered projects/index.html.haml within layouts/application (24.7ms) Rendered layouts/_head.html.haml (3.9ms) Rendered layouts/_nav.html.haml (6.5ms) Rendered layouts/_info.html.haml (2.5ms)Completed 200 OK in 48ms (Views: 37.8ms | ActiveRecord: 6.4ms)Started GET "/user_sessions/auth"for ip_addr at 2015-06-02 18:13:54 +0300Processing by UserSessionsController#auth as HTMLRedirected to https://git.example.com/oauth/authorize?client_id=00858124e9e9b4ffbe46b956af2adb7403cc1042ed7a2f6c417d16557924a297&redirect_uri=http%3A%2F%2Fci.example.com%2Fuser_sessions%2Fcallback&response_type=codeCompleted 403 Forbidden in 11ms (ActiveRecord: 0.7ms)Started GET "/user_sessions/auth"for ip_addr at 2015-06-02 18:13:54 +0300Processing by UserSessionsController#auth as HTMLRedirected to https://git.example.com/oauth/authorize?client_id=00858124e9e9b4ffbe46b956af2adb7403cc1042ed7a2f6c417d16557924a297&redirect_uri=http%3A%2F%2Fci.example.com%2Fuser_sessions%2Fcallback&response_type=codeCompleted 302 Found in 4ms (ActiveRecord: 0.7ms)Started GET "/user_sessions/callback?code=a0ea65b5bf8d034eac7da477a98dec53fff74afacca28b52dee80d0460ca90df"for ip_addr at 2015-06-02 18:13:58 +0300Processing by UserSessionsController#callback as HTML Parameters: {"code"=>"a0ea65b5bf8d034eac7da477a98dec53fff74afacca28b52dee80d0460ca90df"}
Considering that now you are getting 403 forbidden it seems that something did change. Can you remove the authorization from GitLab, create new app_id and app_secret, update gitlab.rb with new credentials and reconfigure?
Started GET "/"for IP_ADDR at 2015-06-03 14:19:10 +0300Processing by ProjectsController#index as HTML Rendered projects/_public.html.haml (3.3ms) Rendered projects/index.html.haml within layouts/application (3.8ms) Rendered layouts/_head.html.haml (0.9ms) Rendered layouts/_nav.html.haml (0.7ms) Rendered layouts/_info.html.haml (0.2ms)Completed 200 OK in 11ms (Views: 5.9ms | ActiveRecord: 2.0ms)Started GET "/user_sessions/auth"for IP_ADDR at 2015-06-03 14:19:16 +0300Processing by UserSessionsController#auth as HTMLRedirected to https://git.example.com/oauth/authorize?client_id=0c702af461fa3f2c9711779c25b9d25ad873b79e6869cf9b80621c9c25dcb857&redirect_uri=http%3A%2F%2Fci.example.com%2Fuser_sessions%2Fcallback&response_type=codeCompleted 403 Forbidden in 37ms (ActiveRecord: 11.4ms)Started GET "/user_sessions/auth"for IP_ADDR at 2015-06-03 14:19:16 +0300Processing by UserSessionsController#auth as HTMLRedirected to https://git.example.com/oauth/authorize?client_id=0c702af461fa3f2c9711779c25b9d25ad873b79e6869cf9b80621c9c25dcb857&redirect_uri=http%3A%2F%2Fci.example.com%2Fuser_sessions%2Fcallback&response_type=codeCompleted 302 Found in 31ms (ActiveRecord: 11.2ms)Started GET "/user_sessions/callback?code=f5bcb80e845e581cb48ffac681ff219abdb37ac0881c8dfcde87abdc9d6ed838"for IP_ADDR at 2015-06-03 14:19:23 +0300Processing by UserSessionsController#callback as HTML Parameters: {"code"=>"f5bcb80e845e581cb48ffac681ff219abdb37ac0881c8dfcde87abdc9d6ed838"}
I just see 502 error after pressing Authorise button in gitlab webui
The only way I can get something close to this behaviour is if I have a wrong callback url set in https://git.example.com/admin/applications/. What is the callback url you have set in GitLab for "GitLab CI" authorization?
That should be correct. Assuming that you have correct credentials in gitlab_ci['gitlab_server'] = { 'url' => 'https://git.example.com', 'app_id' => "XXX", 'app_secret' => 'XXX'} I am not sure what else could be going wrong. I am not sure what else to suggest (short of trying to restart with gitlab-ctl restart).
@vsizov Do you have any ideas why a user would keep getting 502 when trying to Authorise GitLab CI with GitLab?
@vsizov no I didn't change code in any way, just gitlab.rb so I use default omnibus packages, I also have good history of successful updates. From version 5.x to current.
What exactly logs do I need to provide?
You can see the full log from "Login with GitLab" to the Error 500.
==> /var/log/gitlab/gitlab-ci/production.log <==Started GET "/" for xx.xx.xx.xx at 2015-06-18 16:00:37 +0200Processing by ProjectsController#index as HTML Rendered projects/_public.html.haml (45.7ms) Rendered projects/index.html.haml within layouts/application (61.4ms) Rendered layouts/_head.html.haml (10.9ms) Rendered layouts/_nav.html.haml (17.3ms) Rendered layouts/_info.html.haml (6.7ms)Completed 200 OK in 137ms (Views: 108.5ms | ActiveRecord: 17.6ms)==> /var/log/gitlab/nginx/gitlab_ci_access.log <==127.0.0.1 - - [18/Jun/2015:16:00:37 +0200] "GET / HTTP/1.0" 200 860 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"xx.xx.xx.xx - - [18/Jun/2015:16:00:37 +0200] "GET / HTTP/1.1" 200 872 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"==> /var/log/gitlab/gitlab-ci/production.log <==Started GET "/user_sessions/auth" for xx.xx.xx.xx at 2015-06-18 16:00:40 +0200Processing by UserSessionsController#auth as HTMLRedirected to http://git.domain.com/oauth/authorize?client_id=b2f732c0d48720842a0306263a02028a31365f88eb0011d24837773016a11bfe&redirect_uri=http%3A%2F%2Fci.domain.com%2Fuser_sessions%2Fcallback&response_type=codeCompleted 403 Forbidden in 13ms (ActiveRecord: 1.5ms)==> /var/log/gitlab/nginx/gitlab_ci_access.log <==127.0.0.1 - - [18/Jun/2015:16:00:40 +0200] "GET /user_sessions/auth HTTP/1.0" 403 221 "http://ci.domain.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"xx.xx.xx.xx - - [18/Jun/2015:16:00:40 +0200] "GET /user_sessions/auth HTTP/1.1" 403 232 "http://ci.domain.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"==> /var/log/gitlab/gitlab-ci/production.log <==Started GET "/user_sessions/auth" for xx.xx.xx.xx at 2015-06-18 16:00:40 +0200Processing by UserSessionsController#auth as HTMLRedirected to http://git.domain.com/oauth/authorize?client_id=b2f732c0d48720842a0306263a02028a31365f88eb0011d24837773016a11bfe&redirect_uri=http%3A%2F%2Fci.domain.com%2Fuser_sessions%2Fcallback&response_type=codeCompleted 302 Found in 14ms (ActiveRecord: 5.5ms)==> /var/log/gitlab/nginx/gitlab_ci_access.log <==127.0.0.1 - - [18/Jun/2015:16:00:40 +0200] "GET /user_sessions/auth HTTP/1.0" 302 264 "http://ci.domain.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"xx.xx.xx.xx - - [18/Jun/2015:16:00:40 +0200] "GET /user_sessions/auth HTTP/1.1" 302 276 "http://ci.domain.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"==> /var/log/gitlab/gitlab-rails/production.log <==Started GET "/oauth/authorize?client_id=b2f732c0d48720842a0306263a02028a31365f88eb0011d24837773016a11bfe&redirect_uri=http%3A%2F%2Fci.domain.com%2Fuser_sessions%2Fcallback&response_type=code" for xx.xx.xx.xx at 2015-06-18 16:00:40 +0200Processing by Oauth::AuthorizationsController#new as HTML Parameters: {"client_id"=>"b2f732c0d48720842a0306263a02028a31365f88eb0011d24837773016a11bfe", "redirect_uri"=>"http://ci.domain.com/user_sessions/callback", "response_type"=>"code"}Completed 200 OK in 261ms (Views: 202.1ms | ActiveRecord: 41.4ms)==> /var/log/gitlab/nginx/gitlab_access.log <==127.0.0.1 - - [18/Jun/2015:16:00:40 +0200] "GET /oauth/authorize?client_id=b2f732c0d48720842a0306263a02028a31365f88eb0011d24837773016a11bfe&redirect_uri=http%3A%2F%2Fci.domain.com%2Fuser_sessions%2Fcallback&response_type=code HTTP/1.0" 200 2616 "http://ci.domain.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"xx.xx.xx.xx - - [18/Jun/2015:16:00:40 +0200] "GET /oauth/authorize?client_id=b2f732c0d48720842a0306263a02028a31365f88eb0011d24837773016a11bfe&redirect_uri=http%3A%2F%2Fci.domain.com%2Fuser_sessions%2Fcallback&response_type=code HTTP/1.1" 200 2628 "http://ci.domain.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"==> /var/log/gitlab/gitlab-rails/production.log <==Started POST "/oauth/authorize" for xx.xx.xx.xx at 2015-06-18 16:00:42 +0200Processing by Oauth::AuthorizationsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "client_id"=>"b2f732c0d48720842a0306263a02028a31365f88eb0011d24837773016a11bfe", "redirect_uri"=>"http://ci.domain.com/user_sessions/callback", "state"=>"", "response_type"=>"code", "scope"=>"api"}Redirected to http://ci.domain.com/user_sessions/callback?code=e1098e12e7920be9c175b4f11e8b6e4d54a447ff46b95bb87d1528b0a5878e10Completed 302 Found in 71ms (ActiveRecord: 42.7ms)==> /var/log/gitlab/nginx/gitlab_access.log <==127.0.0.1 - - [18/Jun/2015:16:00:42 +0200] "POST /oauth/authorize HTTP/1.0" 302 175 "http://git.domain.com/oauth/authorize?client_id=b2f732c0d48720842a0306263a02028a31365f88eb0011d24837773016a11bfe&redirect_uri=http%3A%2F%2Fci.domain.com%2Fuser_sessions%2Fcallback&response_type=code" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"xx.xx.xx.xx - - [18/Jun/2015:16:00:42 +0200] "POST /oauth/authorize HTTP/1.1" 302 186 "http://git.domain.com/oauth/authorize?client_id=b2f732c0d48720842a0306263a02028a31365f88eb0011d24837773016a11bfe&redirect_uri=http%3A%2F%2Fci.domain.com%2Fuser_sessions%2Fcallback&response_type=code" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"==> /var/log/gitlab/gitlab-ci/production.log <==Started GET "/user_sessions/callback?code=e1098e12e7920be9c175b4f11e8b6e4d54a447ff46b95bb87d1528b0a5878e10" for xx.xx.xx.xx at 2015-06-18 16:00:42 +0200Processing by UserSessionsController#callback as HTML Parameters: {"code"=>"e1098e12e7920be9c175b4f11e8b6e4d54a447ff46b95bb87d1528b0a5878e10"}Completed 500 Internal Server Error in 19msOAuth2::Error (<html><head><title>404 Not Found</title></head><body bgcolor="white"><center><h1>404 Not Found</h1></center><hr><center>nginx</center></body></html>): app/controllers/user_sessions_controller.rb:18:in `callback'==> /var/log/gitlab/nginx/gitlab_ci_access.log <==127.0.0.1 - - [18/Jun/2015:16:00:42 +0200] "GET /user_sessions/callback?code=e1098e12e7920be9c175b4f11e8b6e4d54a447ff46b95bb87d1528b0a5878e10 HTTP/1.0" 500 348 "http://git.domain.com/oauth/authorize?client_id=b2f732c0d48720842a0306263a02028a31365f88eb0011d24837773016a11bfe&redirect_uri=http%3A%2F%2Fci.domain.com%2Fuser_sessions%2Fcallback&response_type=code" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"xx.xx.xx.xx - - [18/Jun/2015:16:00:42 +0200] "GET /user_sessions/callback?code=e1098e12e7920be9c175b4f11e8b6e4d54a447ff46b95bb87d1528b0a5878e10 HTTP/1.1" 500 348 "http://git.domain.com/oauth/authorize?client_id=b2f732c0d48720842a0306263a02028a31365f88eb0011d24837773016a11bfe&redirect_uri=http%3A%2F%2Fci.domain.com%2Fuser_sessions%2Fcallback&response_type=code" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36"
cat /etc/gitlab/gitlab.rb | grep external_url# Check and change the external_url to the address your users will type in their browserexternal_url 'https://git.my_host.com'ci_external_url 'http://ci.my_host.com'root@bntu:/tmp# cat /etc/gitlab/gitlab-secrets.json {"gitlab_shell": {"secret_token": "123"},"gitlab_rails": {"secret_token": "123"},"gitlab_ci": {"secret_token": "123","gitlab_server": {"url": "https://git.my_host.com","app_id": "123","app_secret": "123"}}}
I replaced real host with my_host.com and all tokens with 123.
@ayufan thank you very much your point about curl...
Now I understand that gitlab instance itself can't get to itself by external url...
Corp network firewall rules and routing pretty strict. Again sorry. Bug may be closed.