Commit df8edd35 authored by Alain Takoudjou's avatar Alain Takoudjou

monitor: bootstrap promise check wait for bootstrap to finish if it's running

parent a2c96eb4
...@@ -93,7 +93,7 @@ recipe = slapos.recipe.template:jinja2 ...@@ -93,7 +93,7 @@ recipe = slapos.recipe.template:jinja2
filename = template-monitor.cfg filename = template-monitor.cfg
template = ${:_profile_base_location_}/instance-monitor.cfg.jinja2.in template = ${:_profile_base_location_}/instance-monitor.cfg.jinja2.in
rendered = ${buildout:directory}/template-monitor.cfg rendered = ${buildout:directory}/template-monitor.cfg
md5sum = 84998b1ca3c29445dca70b495515c35b md5sum = c25e1c8206fb7c08924ae3d5c16521fc
context = context =
key apache_location apache:location key apache_location apache:location
key gzip_location gzip:location key gzip_location gzip:location
......
...@@ -115,7 +115,7 @@ ca-certs = ${ca-directory:certs} ...@@ -115,7 +115,7 @@ ca-certs = ${ca-directory:certs}
ca-newcerts = ${ca-directory:newcerts} ca-newcerts = ${ca-directory:newcerts}
ca-crl = ${ca-directory:crl} ca-crl = ${ca-directory:crl}
[ca-httpd] [ca-monitor-httpd]
<= certificate-authority <= certificate-authority
recipe = slapos.cookbook:certificate_authority.request recipe = slapos.cookbook:certificate_authority.request
key-file = ${monitor-httpd-conf-parameter:key-file} key-file = ${monitor-httpd-conf-parameter:key-file}
...@@ -136,9 +136,8 @@ service-pid-folder = ${monitor-directory:pids} ...@@ -136,9 +136,8 @@ service-pid-folder = ${monitor-directory:pids}
crond-folder = ${logrotate-directory:cron-entries} crond-folder = ${logrotate-directory:cron-entries}
logrotate-folder = ${logrotate:logrotate-entries} logrotate-folder = ${logrotate:logrotate-entries}
promise-runner = {{ monitor_runpromise }} promise-runner = {{ monitor_runpromise }}
promise-folder-list = promise-folder = ${directory:promises}
${directory:promises} pid-file = ${monitor-directory:pids}/monitor-bootstrap.pid
${directory:monitor-promise}
public-path-list = public-path-list =
private-path-list = private-path-list =
...@@ -370,15 +369,23 @@ curl_path = {{ curl_executable_location }} ...@@ -370,15 +369,23 @@ curl_path = {{ curl_executable_location }}
check-secure = 1 check-secure = 1
[monitor-bootstrap-promise] [monitor-bootstrap-promise]
recipe = slapos.recipe.template:jinja2 recipe = collective.recipe.template
template = {{ template_wrapper }}
rendered = ${directory:promises}/monitor-bootstrap-status
file = ${monitor-conf-parameters:promise-output-file} file = ${monitor-conf-parameters:promise-output-file}
command = if [ ! -f "${:file}" ]; then echo "Monitor bootstrap exited with error." && exit 2; else echo "Bootstrap OK"; fi input = inline:#!{{ dash_executable_location }}
mode = 0700 PID=`cat ${monitor-conf-parameters:pid-file}`
context = for i in {1..20}; do
key content :command # wait for monitor bootstrap script to finish (max 10 seconds)
raw dash_binary {{ dash_executable_location }} kill -0 "$PID" > /dev/null 2>&1
RETURN_CODE=$?
if [ $RETURN_CODE -eq 0 ] ; then
break
else
sleep 0.5
fi
done
if [ ! -f "${:file}" ]; then echo "Monitor bootstrap exited with error." && exit 2; else echo "Bootstrap OK"; fi
output = ${directory:promises}/monitor-bootstrap-status
mode = 700
[monitor-base] [monitor-base]
# create dependencies between required monitor parts # create dependencies between required monitor parts
...@@ -393,7 +400,7 @@ depends = ...@@ -393,7 +400,7 @@ depends =
${certificate-authority:wrapper} ${certificate-authority:wrapper}
${monitor-conf:rendered} ${monitor-conf:rendered}
${start-monitor:wrapper-path} ${start-monitor:wrapper-path}
${ca-httpd:wrapper} ${ca-monitor-httpd:wrapper}
${monitor-httpd-promise:filename} ${monitor-httpd-promise:filename}
${monitor-status2rss-cron-entry:name} ${monitor-status2rss-cron-entry:name}
${monitor-bootstrap-promise:file} ${monitor-bootstrap-promise:file}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment