From 96c1515d6b6b24bdbb49c7fd8f570085687e0694 Mon Sep 17 00:00:00 2001
From: Guillaume Hervier <guillaume.hervier@nexedi.com>
Date: Mon, 24 Sep 2018 16:41:34 +0200
Subject: [PATCH] software/re6stnet: auto-restart services on SR upgrade.

---
 software/re6stnet/instance-re6stnet.cfg.in | 16 +++++++++++-----
 software/re6stnet/software.cfg             |  2 +-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/software/re6stnet/instance-re6stnet.cfg.in b/software/re6stnet/instance-re6stnet.cfg.in
index ef257a01c..8b7621e4d 100644
--- a/software/re6stnet/instance-re6stnet.cfg.in
+++ b/software/re6stnet/instance-re6stnet.cfg.in
@@ -58,7 +58,7 @@ port = 9026
 error-log = ${directory:log}/apache-error.log
 access-log = ${directory:log}/apache-access.log
 pid-file = ${directory:run}/apache.pid
-context = 
+context =
   key apache_port :port
   key re6st_ipv4 re6st-registry:ipv4
   key re6st_port re6st-registry:port
@@ -80,13 +80,19 @@ wrapper-path = {{ apache_wrapper }}
 command-line = "{{ parameter_dict['apache-location'] }}/bin/httpd" -f "${apache-conf:rendered}" -DFOREGROUND
 
 {% if uri_scheme == 'https' %}
-[{{ section('apache-ca') }}]
+[apache-ca]
 <= certificate-authority
 recipe = slapos.cookbook:certificate_authority.request
 executable = ${apache-httpd:wrapper-path}
-wrapper = ${directory:services}/httpd
+wrapper = ${directory:bin}/httpd
 key-file = ${certificate-authority:ca-private}/apache.key
 cert-file = ${certificate-authority:ca-certs}/apache.crt
+
+[{{ section('apache-ca-service') }}]
+recipe = slapos.cookbook:wrapper
+command-line = ${apache-ca:wrapper}
+wrapper-path = ${directory:services}/httpd
+hash-files = ${buildout:directory}/software_release/buildout.cfg
 {% endif %}
 
 [apache-httpd-graceful]
@@ -164,7 +170,7 @@ dh-file = ${re6st-registry-conf-dict:dh}
 
 slave-instance-list = ${slap-parameter:slave_instance_list}
 
-environment = 
+environment =
   PATH={{ openssl_bin }}
 
 [re6stnet-manage]
@@ -222,7 +228,7 @@ extends =
   {{ monitor2_template_rendered }}
   {{ logrotate_cfg }}
 
-parts = 
+parts =
   certificate-authority
   logrotate-apache
   logrotate-entry-re6stnet
diff --git a/software/re6stnet/software.cfg b/software/re6stnet/software.cfg
index 1d730056b..3a013aab0 100644
--- a/software/re6stnet/software.cfg
+++ b/software/re6stnet/software.cfg
@@ -86,7 +86,7 @@ extra-context =
 [template-re6stnet]
 < = download-base
 filename = instance-re6stnet.cfg.in
-md5sum = 8c167f2adb2ed36aeaff773f59214981
+md5sum = 09683c66c16361b77867d8f2e1140a35
 
 [template-apache-conf]
 < = download-base
-- 
2.30.9