Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions cfe_internal/enterprise/mission_portal.cf
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,10 @@ bundle agent mission_portal_apache_from_stage(config, staged_config)
string => "Configure apache based on successfully staged config";

classes:
"systemd_supervised"
expression => returnszero("$(paths.systemctl) -q is-active cf-apache > /dev/null 2>&1", "useshell"),
if => fileexists( $(paths.systemctl) );
"systemd_supervised" -> { "ENT-11189" }
expression => returnszero("$(paths.systemctl) cat cf-apache > /dev/null 2>&1", "useshell"),
if => fileexists( $(paths.systemctl) ),
comment => "Set when cf-apache.service is a unit known to systemd";

"httpd_config_validated"
expression => strcmp("$(validate_result[exit_code])", "0");
Expand Down Expand Up @@ -367,6 +368,13 @@ bundle agent mission_portal_apache_from_stage(config, staged_config)
contain => in_shell,
comment => "We restart apache after the new valid config is in place";

methods:
systemd_supervised::
"Reset cf-apache failed state" -> { "ENT-11189" }
usebundle => cf_apache_reset_failed_state,
if => "mission_portal_apache_config_repaired",
comment => "Clear any latched failed state before restarting cf-apache";

services:
systemd_supervised::
"cf-apache"
Expand Down Expand Up @@ -540,3 +548,15 @@ bundle agent cfe_enterprise_selfsigned_cert
"DEBUG $(this.bundle): No Certificate Generation Requested"
if => "!_cfe_enterprise_selfsigned_cert_regenerate_certificate";
}

bundle agent cf_apache_reset_failed_state
# @brief Clear any latched 'failed' state on cf-apache.service so subsequent
# service operations are not refused by systemd's start rate limiter
# (StartLimitBurst). Safe no-op when the unit is not in a failed state.
{
commands:
"$(paths.systemctl) reset-failed cf-apache" -> { "ENT-11189" }
contain => in_shell,
handle => "cf_apache_systemctl_reset_failed",
comment => "Reset latched failed state on cf-apache.service";
}
5 changes: 5 additions & 0 deletions templates/cf-apache.service.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ ExecStart={{{vars.sys.workdir}}}/httpd/bin/apachectl start
ExecStop={{{vars.sys.workdir}}}/httpd/bin/apachectl stop
ExecReload={{{vars.sys.workdir}}}/httpd/bin/apachectl graceful
PIDFile={{{vars.sys.workdir}}}/httpd/httpd.pid
# ENT-11189: apachectl writes the PID file shortly after fork. On a busy host
# (e.g. mid-upgrade with SELinux relabel, cf-postgres and cf-php-fpm churning)
# the default 90s start timeout has been observed to fire while apache is still
# coming up, leaving worker children bound to :80 and the unit in a restart loop.
TimeoutStartSec=300
Restart=always
RestartSec=10
UMask=0177
Expand Down
Loading