aws / opsworks-cookbooks

Chef Cookbooks for the AWS OpsWorks Service
Other
1.06k stars 1.23k forks source link

How to stop and start unicorn from cli without breaking the unix:socket #365

Open alexissavin opened 8 years ago

alexissavin commented 8 years ago

Hi,

I'm trying to find a way to stop and start unicorn from the cli on the deployed rails-app servers.

Unfortunately, each time I do so, nginx loose access to the socket (/srv/www//shared/sockets/unicorn.sock).

Apparently SeLinux is preventing nginx to access the socket. But running restorecon doesn't fix the issue. Each time I have to remove the "sockets" directory and run once again the deploy cookbook.

ls -Z display the following result : Before Stop Unicorn : srwxrwxrwx. deploy nginx system_u:object_r:httpd_var_run_t:s0 unicorn.sock After Stop and Start : srwxrwxrwx. deploy nginx unconfined_u:object_r:httpd_var_run_t:s0 unicorn.sock After Restorecon -rv : srwxrwxrwx. deploy nginx unconfined_u:object_r:httpd_var_run_t:s0 unicorn.sock After Restorecon -F -rv : srwxrwxrwx. deploy nginx system_u:object_r:httpd_var_run_t:s0 unicorn.sock

To start/stop unicorn I use the following command : "cd /srv/www//current && ../../shared/scripts/unicorn clean-restart" as user deploy.

Is there a proper way to stop and then restart unicorn that I'm missing ?

Thanks for your feedback.