sous-chefs / nginx

Development repository for the nginx cookbook
https://supermarket.chef.io/cookbooks/nginx
Apache License 2.0
553 stars 806 forks source link

nginx pid file not in /var/run or /run when running with non-root account #452

Closed simonneto closed 5 years ago

simonneto commented 6 years ago

Cookbook version

[Version of the cookbook where you are encountering the issue] 7.0.2

Chef-client version

[Version of chef-client in your environment] 12.18.31

Platform Details

[Operating system distribution and release version. Cloud provider if running in the cloud] OEL 6

Scenario:

[What you are trying to achieve and you can't?] I cannot customize the location of my pid file. I am running as non-root user and I need to customize my nginx.conf file to write in a different location

Steps to Reproduce:

[If you are filing an issue what are the things we need to do in order to repro your problem? How are you using this cookbook or any resources it includes?] try to customize the location of nginx pid file

Expected Result:

[What are you expecting to happen as the consequence of above reproduction steps?] be able to put the file outside /var/run or /run (depending on the distro)

Actual Result:

[What actually happens after the reproduction steps? Include the error output or a link to a gist if possible.] file is being created pointing to /var/run and my service account does not have access to write on system directory.

Thanks in advance,

simonneto commented 6 years ago

I know its not ideal, but for now I did the following in my local copy:

def pidfile_location if (node['nginx']['repo_source'].nil? || %w(distro passenger).include?(node['nginx']['repo_source'])) && (node['init_package'] == 'systemd' || node['platform_version'].to_f == 14.04) '/run/nginx.pid' elsif (node['nginx']['dir'] != '/etc/nginx') "#{node['nginx']['dir']}/nginx.pid"

'/oracle/3rdparty/nginx/nginx.pid'

else
  '/var/run/nginx.pid'
end

end

damacus commented 5 years ago

As per #460 we're not looking at supporting the customization of the PID in the near term.