Comments (14)
It looks like the debian family will ultimately switch to systemd as well.
from apache2.
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.
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.
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.
@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.
@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.
@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.
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.
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.
Perhaps we could look into adopting something like this?
from apache2.
@drpebcak possibly, but that should be new issue.
from apache2.
I just mentioned it because it relates. Also with #335.
from apache2.
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.
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)
- Amazon 2018 install broken with PR#688 HOT 1
- PIDFILE is not rendered in /etc/sysconfig/httpd HOT 2
- Enable template_cookbook property in default apache2_install
- ServerName directive absent from apache2.conf.erb HOT 2
- Allow passing arbitrary variables to conf templates via apache2_conf
- problem with apache2 HOT 2
- Infinite loop from apache2_mod_auth_cas and apache2_module 'auth_cas' resources HOT 28
- chef_version constraint is not accurate. HOT 2
- apache2 Chef-17 compatability HOT 1
- The default_site resource does not support custom variables
- The default_site resource property site_action does not work
- Unable to override options for security and charset configurations with install resource
- Package mod_ldap not installed on Centos if you enable mod_ldap
- Option to config using different instance name HOT 1
- Apache
- apache2_module breaks authz_svn module loading HOT 3
- Apache
- apache_mod_php_filename and apache_mod_php_modulename incompatible with Ubuntu 22.04 HOT 2
- pkg.apache2
- Dependency Dashboard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apache2.