Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best way to reload nginx.conf #291

Closed
Epigene opened this issue Mar 19, 2015 · 2 comments
Closed

Best way to reload nginx.conf #291

Epigene opened this issue Mar 19, 2015 · 2 comments

Comments

@Epigene
Copy link

Epigene commented Mar 19, 2015

Hi, not a bug report, just wondering how to best do things.

I am deploying a rails app running on puma behind nginx.

So far I have a task for linking the app's nginx.conf into sites-enabled like so:

desc "Takes care of nginx conf"
task :nginx_link => :environment do
  queue! %[ln -nfs /home/deployer/apps/#{app_name}/current/config/deploy/nginx.conf /etc/nginx/sites-enabled/#{app_name}]
  queue! %[ln -nfs /home/deployer/apps/#{app_name}/current/config/deploy/nginx.conf /etc/nginx/sites-available/#{app_name}]
  #queue! %[sudo nginx -s reload]
end

My problem is that the nginx configuration does not seem to reload to take the latest changes into account so I need to run sudo nginx -s reload which requires me to enter the sudo password.

I am looking into setting up this command for the deployer user to run without password following http://askubuntu.com/questions/73864/how-to-modify-a-invalid-etc-sudoers-file-it-throws-out-an-error-and-not-allowi

Am I on the right track or perhaps there is a way to pass sudo password to mina in deploy.rb and have it pass automagically?

Thanks!

@d4be4st
Copy link
Member

d4be4st commented Mar 19, 2015

We have for our servers created a few lines in sudoer file that allow deploy user to reload nginx.

deploy ALL=(ALL) NOPASSWD: /etc/init.d/nginx reload

and added an alias to .bashrc file

alias nginx-reload='sudo /etc/init.d/nginx reload'

now our deploy users can reload nginx without sudo privileges

@Epigene
Copy link
Author

Epigene commented Mar 19, 2015

Yup, ended up doing it like that.

Note to others, use sudo visudo -f /etc/sudoers.d/deployer to enter the line adding interface correctly.

@Epigene Epigene closed this as completed Mar 19, 2015
@mina-deploy mina-deploy deleted a comment from Abbas Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants