Twitter auth not working (nginx bad gateway)

(AstonJ) #1

I’m fairly sure this was going to Twitter for log in properly before - not sure what’s going on now - I keep getting this when trying to log in with Twitter:

My Twitter settings are as follows:

Any ideas what’s going on here? (I ‘reset’ the key and secret in the admin control panel then put it back in but that hasn’t made any difference). I read something about port 443 needing to be opened - I’m running the site in http not https (and HAProxy is only forwarding port 80 to Docker).

Edit: Seems github auth isn’t working either (also saying bad gateway) :confused:

Edit 2: Ok it seems like it’s an issue with docker as doing this makes it work ok:

Any idea why I’m having to restart Docker tho (I did this yesterday as the app wasn’t rebuilding and troubleshooting led to the above post)

(Tenzan) #2

Just a side note…

I think your Callback URL should point to, if that’s where you want user to be redirected upon successful authentication.

I have installed Discourse on DigitalOcean and everything works fine for me.

PS. I’m using a standalone version of install.

(AstonJ) #3

I just followed the official instructions in the install thread (think it’s ok tho).

However I just tried to go through with a registration and there’s another error… will post a thread about it now.

(Sam Saffron) #4

is there anything in /logs are you using any plugins?

(AstonJ) #5

Hi @sam, ignore my comment about the other error (I was trying to sign up via github via a private safari window and it kept saying “password can’t be blank” - same thing happens here, so I guess you’re aware of it).

With regards to plugins, I am using the tags plugin and thinking about it, maybe the issue started after I had to rebuild the app (after installing the plugin).

The issue is almost certainly due to Docker not being able to access the internet as one of the things I tried earlier was to rebuild the app - and on rebuilding the app I got the same failure message (can’t connect to github) that I got yesterday and which led me to that particular fix (the one in ‘Edit 2’ above) - just something caused it to break again.

I’ve posted a thread on the Docker forums too, as it sounds like a Docker/CentOS issue to me - would you agree? DNS configuration for CentOS - DockerEngine - Docker Forums

Regarding logs, which ones? I haven’t got a logs directory inside my discourse directory :confused:

(Sam Saffron) #6 :slight_smile:

(AstonJ) #7

Haha - should’ve guessed you would have made it that easy!

Ok, seem to be quite a few from sidekiq, and funnily enough, after I rebooted Docker earlier (and so when it started working again) people who registered said that’s when they got their emails.

(Sam Saffron) #8

The socket errors downloading stuff are not good, its indicating we are unable to reach the outside.

Recommend you reboot, upgrade docker to latest, set the DNS. Do ./launcher enter app see if you can ping external hosts by IP. Check firewall to see if you are shutting traffic down from your container. etc.

(AstonJ) #9

K thanks @sam Sam, all done - everything seems to be working fine atm. I might install another plugin and rebuild the app as that’s the only thing I can think of that caused it to stop working. Maybe tomorrow tho …it’s way past my bedtime, haha.

Thanks again for your help and for being so thorough :slight_smile:

Btw I would be so chuffed if you joined MetaRuby …but no worries if you don’t, I bet you’ve been asked to a few thousand times now!! :discourse:

(AstonJ) #10

Unfortunately intermittent loss of internet to the Docker container is still continuing : - (

I posted a GH issue but they have pretty much washed their hands saying my kernel is not supported with my OS, this is frustrating because the issue doesn’t seem to be kernel related since it is affecting lots of other people with various kernels.

@sam have you got any other ideas please? Should I downgrade my kernel?

(Jeff Atwood) #11

Why don’t you just use the current CentOS version 7? Or Ubuntu 14.04 LTS as we recommend?

(AstonJ) #12

I’ve had the server for over a year now (it’s running a number of sites, some Rails, some PHP). At the time 6.5 was the recommended version - it’s now at 6.6 (it’s been pretty solid with no downtime).

I looked into upgrading to CentOS 7 but it is not recommended:

Also, in the Docker issue he now seems to think it is my custom firewall - but I am not sure that’s the case as the issue seems to be fairly common. I’ve posted a thread in the firewall’s forum just to see what they say.

(Joel P) #13

I was having this problem too and I think I may have figured it out. In my case, it seemed to be that the csf firewall we installed was still in test mode so it was resetting itself every 5 minutes which I believe was undoing some changes made by docker. Here’s what I did to fix the issue:

  1. In /etc/csf/csf.conf set TESTING="0"
  2. Restart csf: csf -r
  3. Restart docker service: service docker restart (may not be necessary)
  4. Rebuild the discourse container: cd /var/discourse then ./launcher rebuild app

I hope I’m not jumping the gun here but it’s been about 45 minutes and my twitter auth and Sidekiq are still working, which is much longer than they’ve lasted before.

Through this debugging, this post was helpful:

Hope this helps!

(AstonJ) #14

Hey @jpoiron thanks for the post but unfortunately that is not going to work, because every time CSF auto-updates, or restarts, it will remove the iptables rules that Docker adds - so you’ll need to restart docker.

I ended up moving to CentOS 7 and now use FirewallD which I really like :slight_smile: