Giter Site home page Giter Site logo

Comments (14)

svanzoest avatar svanzoest commented on June 11, 2024

It looks like the debian family will ultimately switch to systemd as well.

from apache2.

martinb3 avatar martinb3 commented on June 11, 2024

This also appears to be broken if the initial service resource defined by apache2 fails its only_if:

service 'apache2' do
service_name node['apache']['package']
case node['platform_family']
when 'rhel'
reload_command '/sbin/service httpd graceful'
when 'debian'
provider Chef::Provider::Service::Debian
when 'arch'
service_name 'httpd'
end
supports [:start, :restart, :reload, :status]
action [:enable, :start]
only_if "#{node['apache']['binary']} -t", :environment => { 'APACHE_LOG_DIR' => node['apache']['log_dir'] }, :timeout => 10
end

If that only_if fails/is false, then only notifications to reload will hit the service later (and reload won't start apache if it isn't already started). So apache is never started in that particular case.

from apache2.

gondoi avatar gondoi commented on June 11, 2024

Here is what I get on Ubuntu 14.04 after simply installing apache2 and then running the only_if:

https://gist.github.com/gondoi/4533a3cb13b9fbc4a86d

from apache2.

gondoi avatar gondoi commented on June 11, 2024

It looks like init script is sourcing /etc/apache2/envvars for those variables. Perhaps we just need to source that for the only_if?

from apache2.

svanzoest avatar svanzoest commented on June 11, 2024

@martinb3 @gondoi the real issue here is that there is a syntax error.

AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}

The config dropped by the cookbook does not reference ${APACHE_LOCK_DIR}, so that suggests that config was dropped there some other way, maybe via the package?

If there is a syntax error, the only_if will prevent the :enable, :start from executing to avoid a deadlock where a chef run will fail before it has the chance to fix the syntax errors. So @martinb3 the behavior you are stating, is by design and the solution is to determine why the only_if failed and resolve that.

from apache2.

martinb3 avatar martinb3 commented on June 11, 2024

@svanzoest It would be a syntax error if you don't source /etc/apache2/envvars. If you do source that file, like the init script does, Apache actually does start correctly.

So the only_if isn't really verifying that Apache could start -- the only_if returns false, but Apache (via init script) can start just fine.

from apache2.

svanzoest avatar svanzoest commented on June 11, 2024

@martinb3 we could add loading of /etc/sysconfig/httpd and /etc/apachd2/envvars to the syntax check, or we could add APACHE_LOCK_DIR similar to how we added APACHE_LOG_DIR, as that is more cross platform. Regardless, the cookbook did not write the apache2.conf template, so that easier some chicken-versus-egg issue or some other problem.

from apache2.

martinb3 avatar martinb3 commented on June 11, 2024

I think if you end up loading /etc/sysconfig/httpd and /etc/apache2/envvars, you basically end up with apachectl -t -- the whole point in life of that command is to source the right environment files and then run apache2 -t. Maybe we should just do that?

-  only_if "#{node['apache']['binary']} -t", :environment => { 'APACHE_LOG_DIR' => node['apache']['log_dir'] }, :timeout => 10
+  only_if "#{node['apache']['apachectl']} -t", :timeout => 10

This change, combined with commenting out the forced choice of the Debian service provider Chef::Provider::Service::Debian fixes everything for me on the initial converge on Ubuntu 14.04.

from apache2.

svanzoest avatar svanzoest commented on June 11, 2024

I tempted to remove the provider section in the service block and just let chef-client handle this, however we had #151 which added d42349d So, we will need to test if this is still an issue with chef 12 client or determine when this got fixed and require a chef version newer then that bug fix.

See also chef-boneyard/chef-rfc#44

from apache2.

drpebcak avatar drpebcak commented on June 11, 2024

Perhaps we could look into adopting something like this?

from apache2.

svanzoest avatar svanzoest commented on June 11, 2024

@drpebcak possibly, but that should be new issue.

from apache2.

drpebcak avatar drpebcak commented on June 11, 2024

I just mentioned it because it relates. Also with #335.

from apache2.

svanzoest avatar svanzoest commented on June 11, 2024

I am going to close this, as we have cleaned the provider a lot based on other issues and ultimately, chef-client should manage this for us.

from apache2.

lock avatar lock commented on June 11, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from apache2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.