Home:ALL Converter>Rails/Unicorn deploy: what creating the Unix socket?

Rails/Unicorn deploy: what creating the Unix socket?

Ask Time:2012-11-15T15:49:20         Author:westonplatter

Json Formatter

I am deploying a Rails 2.3 // Spree app with Capistrano/Unicorn/Foreman/Upstart.

The part that I cannot figure out is how to have the /myapp/shared/sockets/unicorn.sock be automatically created by the foreman/upstart process management (at least that I think the unix socket should come from them).

What's responsible for creating the unix socket?

Author:westonplatter,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/13393343/rails-unicorn-deploy-what-creating-the-unix-socket
R Milushev :

Let's say your configuration is nginx + unicorn . As you probably know , in the config dir you should create a file named unicorn.rb . In this file there is a description how to handle non-static requests , something like this :\n\nupstream unicapd {\n server unix:/tmp/capd.sock fail_timeout=0;\n}\n\n\nI've named the upstream differently than stated in tutorials , this gives me ability to host a number different applications on the same host . \n\nThen , in your vhosts dir on the Nginx configuration you put something like this (let's say your host file is 'vhosts/myconf.conf':\n\nlocation @unicorn1 {\nproxy_pass http://unicapd;\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\nproxy_set_header Host $http_host;\nproxy_redirect off;\n }\n\n\nHere you see the instruction to nginx to serve non-static requests from the place , named \"http://unicapd\" , which is related to your unicorn.rb config file . This configuration is triggered by a file , which is in your init.d (in case you're running Debian) directory . \n\nSummary : When you say bundle exec unicorn --restart , the script in your init.d triggers the code , forming a \"special\" file /tmp/capd.sock , which serves the dynamic content from you Rails app. ",
2012-11-15T08:21:56
yy