From 5a95c9ed2d7f7743139ed6aff03698de56962431 Mon Sep 17 00:00:00 2001
From: Marco Mariani <marco.mariani@nexedi.com>
Date: Mon, 29 Sep 2014 13:51:01 +0200
Subject: [PATCH] slaprunner: fix errors.log permission issue

---
 component/nginx/buildout.cfg            | 1 +
 software/slaprunner/common.cfg          | 4 ++--
 software/slaprunner/instance-runner.cfg | 1 +
 software/slaprunner/launcher.in         | 4 +++-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/component/nginx/buildout.cfg b/component/nginx/buildout.cfg
index d411613c2..ff3fbf32a 100644
--- a/component/nginx/buildout.cfg
+++ b/component/nginx/buildout.cfg
@@ -38,6 +38,7 @@ configure-options =
   --with-http_ssl_module
   --with-mail
   --with-mail_ssl_module
+  --error-log-path=var/log/nginx.error.log
   --with-ld-opt=" -L ${libexpat:location}/lib -L ${openssl:location}/lib -L ${pcre:location}/lib -L ${zlib:location}/lib -Wl,-rpath=${libexpat:location}/lib -Wl,-rpath=${openssl:location}/lib -Wl,-rpath=${pcre:location}/lib -Wl,-rpath=${zlib:location}/lib"
   --with-cc-opt="-I ${libexpat:location}/include -I ${openssl:location}/include -I ${pcre:location}/include -I ${zlib:location}/include"
   --with-http_dav_module 
diff --git a/software/slaprunner/common.cfg b/software/slaprunner/common.cfg
index 8d0e5e125..a36e5951c 100644
--- a/software/slaprunner/common.cfg
+++ b/software/slaprunner/common.cfg
@@ -43,7 +43,7 @@ mode = 0644
 recipe = slapos.recipe.template
 url = ${:_profile_base_location_}/instance-runner.cfg
 output = ${buildout:directory}/template-runner.cfg.in
-md5sum = a4f3127bc82ff3a671a65a150f26c969
+md5sum = 8a6688ed89f49d32312f2145b7f7d15e
 mode = 0644
 
 [template-runner-import-script]
@@ -110,7 +110,7 @@ mode = 0644
 [template_launcher]
 recipe = slapos.recipe.download
 url = ${:_profile_base_location_}/launcher.in
-md5sum = c7f8b6e9ae84aa94686a9cbaaa3dd693
+md5sum = 525e37ea8b2acf6209869999b15071a6
 filename = launcher.in
 mode = 0644
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
diff --git a/software/slaprunner/instance-runner.cfg b/software/slaprunner/instance-runner.cfg
index 6e890b95a..8f91d8481 100644
--- a/software/slaprunner/instance-runner.cfg
+++ b/software/slaprunner/instance-runner.cfg
@@ -281,6 +281,7 @@ path_log = $${directory:log}/nginx.log
 path_access_log = $${directory:log}/nginx.access.log
 path_error_log = $${directory:log}/nginx.error.log
 path_tmp = $${directory:tmp}/
+nginx_prefix = $${buildout:directory}
 # Config files
 path_nginx_conf = $${directory:etc}/nginx.conf
 # Executables
diff --git a/software/slaprunner/launcher.in b/software/slaprunner/launcher.in
index 094c1b933..1462c85da 100644
--- a/software/slaprunner/launcher.in
+++ b/software/slaprunner/launcher.in
@@ -3,4 +3,6 @@
 # BEWARE: It will be overwritten automatically
 
 # Run nginx
-exec {{ param_nginx_frontend['bin_nginx'] }} -c {{ param_nginx_frontend['path_nginx_conf'] }}
+exec {{ param_nginx_frontend['bin_nginx'] }} \
+    -p {{ param_nginx_frontend['nginx_prefix'] }} \
+    -c {{ param_nginx_frontend['path_nginx_conf'] }}
-- 
2.30.9