I have used Ansible to set up a hosted flask app on EC2 as described here. However, I’m getting errors like
2014/02/18 19:14:56 [error] 31891#0: *8 connect() to unix:/tmp/pile.sock failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: localhost, request: “GET /HTTP/1.1”, upstream: “uwsgi ://unix:/tmp/pile.sock:”, host: “ec2-xx-xxx-xx-xxx.compute-1.amazonaws.com”
Or
2014/02/18 19:07:20 [error] 31891#0: *1 connect() to unix:/tmp/pile.sock failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: localhost, request: “GET / HTTP/1.1”, upstream: “uwsgi ://unix:/tmp/pile.sock:”, host: “ec2-xx-xxx-xx-xxx.compute-1.amazonaws.com”
I’m guessing it’s an issue with uwsgi, but there are no configuration files for it. I really want to keep ansible fully and let it do it’s thing. Is anyone familiar with this issue?
A few questions…
So do you have a template step in your playbook that lays down a file?
Is something deleting your uwsgi files?
In any case, there’s nothing uwsgi specific about Ansible anywhere.
Seems like you just have a configuration issue to figure out.
So the particular tutorial you used doesn’t actually use config files for uwsgi directly - it passes all the parameters to uwsgi in the supervisord configuration. See this template file from the repo for that tut: https://github.com/mattupstate/ansible-tutorial/blob/master/devops/templates/supervisor.ini
Judging from your log snippet, to see what configuration uwsgi is actually being started with, you should be able to look at /etc/supervisor/pile.ini
~Justin
2014/02/18 19:07:20 [error] 31891#0: *1 connect() to unix:/tmp/pile.sock failed (111: Connection refused) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: localhost, request: “GET / HTTP/1.1”, upstream: “uwsgi ://unix:/tmp/pile.sock:”, host: “ec2-xx-xxx-xx-xxx.compute-1.amazonaws.com”
I’m guessing it’s an issue with uwsgi, but there are no configuration files for it. I really want to keep ansible fully and let it do it’s thing. Is anyone familiar with this issue?
This error ussually means that uwsgi is not running. How uwsgi is started can be seen here
https://github.com/mattupstate/ansible-tutorial/blob/master/devops/templates/supervisor.ini
I don’t like this particular approach. It’s better to use the uwsgi emperor instead of supervisor, and an .ini file for the uwsgi “vassal” (the application serving process).