Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error logging into admin for the first time #247

Closed
cdechery opened this issue May 31, 2016 · 9 comments
Closed

Error logging into admin for the first time #247

cdechery opened this issue May 31, 2016 · 9 comments
Milestone

Comments

@cdechery
Copy link

cdechery commented May 31, 2016

I followed the instructions and edited the api-umbrella.yml file correctly.
Then I accessed http://localhost/admin and created an account on Persona to log in. When Persona redirects back to the main page, I get

We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.

This is nginx log:
::1 - - [31/May/2016:16:18:12 -0300] "GET /admins/auth/persona/callback?assertion=XXXXX HTTP/1.1" 500 728 "https://localhost/admin/login" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36" al11047duk1o8aafgs60 https://localhost:443 15.005 MISS

Is there any other log file that could give more details?

@GUI
Copy link
Member

GUI commented Jun 1, 2016

Could you check the contents of /var/log/api-umbrella/web-puma/current? I believe this type of error should show up there.

@cdechery
Copy link
Author

cdechery commented Jun 1, 2016

Seems to be some kind of connection error. I'm behind a proxy. Maybe api-umbrella's user is not being able to use that proxy. Anywhere I could set that up?

2016-06-01T11:31:37.28656 Faraday::TimeoutError (execution expired): 2016-06-01T11:31:37.28656 /opt/api-umbrella/embedded/lib/ruby/2.2.0/net/http.rb:879:ininitialize'
2016-06-01T11:31:37.28657 /opt/api-umbrella/embedded/lib/ruby/2.2.0/net/http.rb:879:in open' 2016-06-01T11:31:37.28657 /opt/api-umbrella/embedded/lib/ruby/2.2.0/net/http.rb:879:inblock in connect'
2016-06-01T11:31:37.28657 /opt/api-umbrella/embedded/lib/ruby/2.2.0/timeout.rb:73:in timeout' 2016-06-01T11:31:37.28658 /opt/api-umbrella/embedded/lib/ruby/2.2.0/net/http.rb:878:inconnect'
2016-06-01T11:31:37.28658 /opt/api-umbrella/embedded/lib/ruby/2.2.0/net/http.rb:863:in do_start' 2016-06-01T11:31:37.28659 /opt/api-umbrella/embedded/lib/ruby/2.2.0/net/http.rb:852:instart'
2016-06-01T11:31:37.28659 /opt/api-umbrella/embedded/lib/ruby/2.2.0/net/http.rb:1375:in request'

@GUI
Copy link
Member

GUI commented Jun 1, 2016

Is there more to the error backtrace in that log file? That doesn't quite pinpoint where the error is coming from. If you tail -f /var/log/api-umbrella/web-puma/current, and then attempt to login again, the full error should be printed to the screen.

However, if your internet connection is behind a proxy, that could explain the issue. I don't have a proxy to test this behind, but you could try configuring the proxy by editing either /etc/sysconfig/api-umbrella (for CentOS/RPM based systems) or /etc/default/api-umbrella (for Ubuntu/Debian). In that file try adding your HTTP proxy environment variable settings, like:

export http_proxy="http://usrname:passwrd@host:port"
export https_proxy=$http_proxy

Then restart API Umbrella (sudo /etc/init.d/api-umbrella restart) and see if things work then. But if that doesn't work, can you supply more of the error backtrace?

@cdechery
Copy link
Author

cdechery commented Jun 1, 2016

There was no file named api-umbrella at /etc/sysconfig (CentOS 7 here). I created one and placed the enviornment proxy variables, although there are already global variables for the proxy which I need to access the network. I'm using CNTLM to make things easier. Here are my global settings.

httpd_proxy=http://127.0.0.1:3128
https_proxy=http://127.0.0.1:3128

This is the full log stacktrace: http://pastebin.com/minJZ84i

You'll notice that there is always an issue with a log file 'production.log'. There was no such directory 'log' under web-app. I created it and chmoded it 666. Still I get that error.

@GUI
Copy link
Member

GUI commented Jun 3, 2016

Thanks for the extra details. I think this is related to the proxy setup in your environment, since it appears to be timing out while trying to make a request to https://verifier.login.persona.org/verify. On the same server, are you able to run curl -v "https://verifier.login.persona.org/verify" (it should return a 404)?

Above you mentioned setting httpd_proxy. Just to double check, was that a typo, or do you also have http_proxy set (without the d)?

As far as I can tell, though, setting those variables in the /etc/sysconfig/api-umbrella file does lead to the the proxy settings being picked up by the Rails app, and the Faraday gem that makes this connection does explicitly look for the http_proxy environment variable. So while I don't have a proxy server to test against, theoretically it seems like it should work.

So I'm not exactly sure why the proxy would be causing these issues, but if you're able to try and run that curl command above, that will hopefully help us debug things.

@GUI
Copy link
Member

GUI commented Jun 3, 2016

Oh, and somewhat related to this issue, would you prefer the option of a local database for handling admin login credentials? Or would your prefer to use something like Persona/Google/GitHub/Twitter/Facebook/LDAP to login to the admin?

Persona will actually be shutting down later this year, so while there are other external login mechanisms to use, I am curious if you had any preferences for how you'd like to login. The idea of having a local admin user database has come up before (#45, #124), but that option would also eliminate any proxy issues.

@cdechery
Copy link
Author

cdechery commented Jun 3, 2016

Hi, thanks for all the attention on my issue.
Sorry on those proxy env variables. Actually I have them all set:

$ env | grep proxy
http_proxy=http://127.0.0.1:3128
ftp_proxy=http://127.0.0.1:3128
all_proxy=socks://127.0.0.1:3128/
httpd_proxy=http://127.0.0.1:3128
https_proxy=http://127.0.0.1:3128

The curl command suggested did return a 404, meaning I can access it. But somehow Rails can't. I even sudoed into api-umbrella user and try the curl call, same result, it connects OK and gets the 404.

As for your question regarding the credentials, I think it would be nice to have a completely standalone and offline way to login, other than the auth providers, because sometimes in your lab enviornments you won't have internet connectivity, or perhaps have proxy issues, as I do - and those can be a pain in the ass and delay testing of tools such as this one.

@astewart-twist
Copy link

Agree with @cdechery. Burning in best practices is absolutely a great thing to do, but it does make bootstrapping (either for development or just checking it out) a bit difficult.

@GUI
Copy link
Member

GUI commented Feb 23, 2017

v0.14.0 has been released with local admin accounts, which should make this setup easier.

@GUI GUI closed this as completed Feb 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants