hagsteel / swampdragon

swampdragon
Other
556 stars 73 forks source link

ConnectionError: [Errno 111] Connection refused #179

Closed tpaljor closed 4 years ago

tpaljor commented 9 years ago

Firstly, I wanted to say thank you for creating Swampdragon. It's really cool and I was able to get the chat example working in my dev environment.

When I tried uploading my Django project (which uses SSL) to my staging server (DigitalOcean), I found that Swampdragon's server.py is throwing a "Connection refused" error:

(Note that I've redacted my actual domain with 'mydomain.com' and my IP with 'x.x.x.x')

(mydomain_env)tpaljor@dev-1:/opt/mydomain_env$ tail -f swampdragon_supervisor.log

ERROR:tornado.application:Uncaught exception GET /data/322/zvlj9fry/websocket (127.0.0.1)
HTTPServerRequest(protocol='http', host='dev.mydomain.com:8080', method='GET', uri='/data/322/zvlj9fry/websocket', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'Origin': 'https://dev.mydomain.com', 'Upgrade': 'websocket', 'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch', 'Sec-Websocket-Version': '13', 'X-Scheme': 'https', 'Host': 'dev.mydomain.com:8080', 'Sec-Websocket-Key': 'Fh3xyS3MGhEdeUE5dj/YrA==', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36', 'Connection': 'upgrade', 'Cookie': '_ga=GA1.2.895032342.1446780109; sessionid=mr9rq25jqdxatg6s9k6xpsjzcf2v32n2; csrftoken=qSSuXY3NiiM9anfyFefv4p8x8guQiSKa; sdso=05ca9ad02fdc4a49ac2657e58209b0fc', 'Pragma': 'no-cache', 'Cache-Control': 'no-cache', 'X-Real-Ip': 'x.x.x.x', 'Sec-Websocket-Extensions': 'permessage-deflate; client_max_window_bits'})
Traceback (most recent call last):
  File "/opt/mydomain_env/local/lib/python2.7/site-packages/tornado/web.py", line 1401, in _stack_context_handle_exception
    raise_exc_info((type, value, traceback))
  File "/opt/mydomain_env/local/lib/python2.7/site-packages/tornado/stack_context.py", line 314, in wrapped
    ret = fn(*args, **kwargs)
  File "/opt/mydomain_env/local/lib/python2.7/site-packages/tornado/gen.py", line 196, in final_callback
    if future.result() is not None:
  File "/opt/mydomain_env/local/lib/python2.7/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "/opt/mydomain_env/local/lib/python2.7/site-packages/tornado/gen.py", line 282, in wrapper
    yielded = next(result)
  File "/opt/mydomain_env/local/lib/python2.7/site-packages/tornadoredis/client.py", line 407, in execute_command
    self.connection.connect()
  File "/opt/mydomain_env/local/lib/python2.7/site-packages/tornadoredis/connection.py", line 79, in connect
    raise ConnectionError(str(e))
ConnectionError: [Errno 111] Connection refused

Here are the Swampdragon settings in settings.py:

# SwampDragon settings
SWAMP_DRAGON_CONNECTION = ('swampdragon.connections.sockjs_connection.DjangoSubscriberConnection', '/data')
DRAGON_URL = 'https://dev.mydomain.com:8080/'

Here is my Nginx config:

upstream swampdragon {
    server 127.0.0.1:9999;
}

server {
    listen 8080 ssl;

    server_name dev.mydomain.com;

    ssl_certificate /etc/nginx/ssl/nginx.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.key;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header Host $http_host;
        proxy_pass http://swampdragon;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Do you have any ideas on what I'm doing wrong?

chokosabe commented 8 years ago

This is a redis connection issue. Do you have a redis server running locally? Swampdragon uses redis...

tpaljor commented 8 years ago

Ah, that must be it. I somehow forgot that dependency when setting up my staging server. I will try again this weekend with redis installed. Thank you.