slaprunner: fix PATH for minishell
[slapos.git] / software / slaprunner / instance-runner.cfg
1 [buildout]
2 parts =
3   nginx_conf
4   nginx-launcher
5   certificate-authority
6   ca-nginx
7   ca-shellinabox
8   gunicorn-launcher
9   gunicorn-graceful
10   sshkeys-dropbear-runner
11   dropbear-server-add-authorized-key
12   sshkeys-authority
13   publish-connection-informations
14   slaprunner-promise
15   slaprunner-frontend-promise
16   dropbear-promise
17   runtestsuite
18   shellinabox-promise
19   symlinks
20   shellinabox
21   slapos-cfg
22   slapos-repo-config
23   cron-entry-prepare-software
24   deploy-instance-parameters
25   instance-software-type
26   minishell-cwd
27   bash-profile
28   supervisord-wrapper
29   supervisord-promise
30 {% if slapparameter_dict.get('custom-frontend-backend-url') %}
31   custom-frontend-promise
32 {% endif %}
33 ## Monitoring part
34 ###Parts to add for monitoring
35   cron
36   certificate-authority
37   cron-entry-monitor
38   cron-entry-rss
39   deploy-index
40   deploy-settings-cgi
41   deploy-status-cgi
42   deploy-status-history-cgi
43   setup-static-files
44   certificate-authority
45   zero-parameters
46   public-symlink
47   cgi-httpd-wrapper
48   cgi-httpd-graceful-wrapper
49   monitor-promise
50   monitor-instance-log-access
51 ## Monitor for runner
52   monitor-current-log-access
53   monitor-deploy-cors-domain-cgi
54
55 extends = ${monitor-template:output}
56
57 eggs-directory = ${buildout:eggs-directory}
58 develop-eggs-directory = ${buildout:develop-eggs-directory}
59 offline = true
60
61 {% if slapparameter_dict.get('custom-frontend-backend-url') -%}
62 # Requests, if defined, a frontend to allow access to a server
63 # located inside of the virtual machine listening to port X
64 # to LAN IPv4.
65 # Internaly, the frontend will be asked to listen on the IPv6
66 # with port X + 10000, to match NAT rules of Qemu.
67 [request-custom-frontend]
68 recipe = slapos.cookbook:requestoptional
69 software-url = {{ slapparameter_dict.get('custom-frontend-software-url', 'http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg') }}
70 software-type = {{ slapparameter_dict.get('custom-frontend-software-type', 'RootSoftwareInstance') }}
71 slave = true
72 name = Custom Web Frontend
73
74 server-url = $${slap-connection:server-url}
75 key-file = $${slap-connection:key-file}
76 cert-file = $${slap-connection:cert-file}
77 computer-id = $${slap-connection:computer-id}
78 partition-id = $${slap-connection:partition-id}
79
80 {%- if slapparameter_dict.get('custom-frontend-instance-guid') -%}
81 sla = instance_guid
82 sla-instance_guid = $${slap-parameter:frontend-instance-guid}
83 {% endif -%}
84
85 {% set custom_frontend_backend_type = slapparameter_dict.get('custom-frontend-backend-type')%}
86 {% if custom_frontend_backend_type %}
87 config = url type
88 config-type = {{ custom_frontend_backend_type }}
89 {% else %}
90 config = url
91 {% endif -%}
92 config-url = {{ slapparameter_dict.get('custom-frontend-backend-url') }}
93 return = site_url domain
94
95 [custom-frontend-promise]
96 recipe = slapos.cookbook:check_url_available
97 path = $${directory:promises}/custom_frontend_promise
98 url = https://$${request-custom-frontend:connection-domain}
99 {% if slapparameter_dict.get('custom-frontend-basic-auth') -%}
100 check-secure = 1
101 {% endif -%}
102 dash_path = {{ dash_executable_location }}
103 curl_path = {{ curl_executable_location }}
104
105 [publish-connection-informations]
106 custom-frontend-url = https://$${request-custom-frontend:connection-domain}
107 {% endif %}
108
109 # Create all needed directories
110 [directory]
111 recipe = slapos.cookbook:mkdirectory
112 etc = $${buildout:directory}/etc/
113 var = $${buildout:directory}/var/
114 srv = $${buildout:directory}/srv/
115 bin = $${buildout:directory}/bin/
116 tmp = $${buildout:directory}/tmp/
117
118 sshkeys = $${:srv}/sshkeys
119 services = $${:etc}/service/
120 scripts = $${:etc}/run/
121 ssh = $${:etc}/ssh/
122 log = $${:var}/log/
123 run = $${:var}/run/
124 backup = $${:srv}/backup/
125 promises = $${:etc}/promise/
126 test = $${:etc}/test/
127 nginx-data = $${directory:srv}/nginx
128 ca-dir = $${:srv}/ssl
129 project = $${:srv}/runner/project
130
131 [runnerdirectory]
132 recipe = slapos.cookbook:mkdirectory
133 home = $${directory:srv}/runner/
134 test = $${directory:srv}/test/
135 project = $${:home}/project
136 public = $${:home}/public
137 software-root = $${:home}/software
138 instance-root = $${:home}/instance
139 project-test = $${:test}/project
140 software-test = $${:test}/software
141 instance-test = $${:test}/instance
142 sessions = $${buildout:directory}/.sessions
143 private-project = $${:home}/.git-private
144 public-project = $${:home}/.git-public
145
146 #Create password recovery code for slaprunner
147 [recovery-code]
148 recipe = slapos.cookbook:generate.password
149 storage-path = $${directory:etc}/.rcode
150 bytes = 8
151
152 [slaprunner]
153 slaprunner = ${buildout:directory}/bin/slaprunner
154 slapos = ${buildout:directory}/bin/slapos
155 slapproxy = ${buildout:directory}/bin/slapproxy
156 supervisor = ${buildout:directory}/bin/slapgrid-supervisorctl
157 git-binary = ${git:location}/bin/git
158 root_check = false
159 slapos.cfg = $${directory:etc}/slapos.cfg
160 working-directory = $${runnerdirectory:home}
161 project-directory = $${runnerdirectory:project}
162 instance_root = $${runnerdirectory:instance-root}
163 software_root = $${runnerdirectory:software-root}
164 instance-monitor-url = https://[$${:ipv6}]:$${monitor-parameters:port}
165 etc_dir = $${directory:etc}
166 log_dir =  $${directory:log}
167 run_dir = $${directory:run}
168 ssh_client = $${sshkeys-dropbear-runner:wrapper}
169 public_key = $${sshkeys-dropbear-runner:public-key}
170 private_key = $${sshkeys-dropbear-runner:private-key}
171 ipv4 = $${slap-network-information:local-ipv4}
172 ipv6 = $${slap-network-information:global-ipv6}
173 instance_root = $${runnerdirectory:instance-root}
174 proxy_port = 50000
175 runner_port = 50005
176 partition-amount = $${slap-parameter:instance-amount}
177 wrapper = $${directory:services}/slaprunner
178 debug = $${slap-parameter:debug}
179 access-url = https://[$${:ipv6}]:$${:runner_port}
180 supervisord_config = $${directory:etc}/supervisord.conf
181 supervisord_server = http://$${supervisord:server}
182 proxy_database = $${slaprunner:working-directory}/proxy.db
183 console = False
184 verbose = False
185 debug = False
186 auto_deploy = $${slap-parameter:auto-deploy}
187 auto_deploy_instance = $${slap-parameter:auto-deploy-instance}
188 autorun = $${slap-parameter:autorun}
189 knowledge0_file = $${buildout:directory}/$${public:filename}
190 minishell_cwd_file = $${directory:etc}/.minishell-cwd
191 minishell_history_file = $${directory:etc}/.minishell_history
192 software_info_json = $${runnerdirectory:home}/software_info.json
193 instance_info_json = $${runnerdirectory:home}/instance_info.json
194 path = $${shell:path}
195
196 [test-runner]
197 <= slaprunner
198 slapos.cfg = $${directory:etc}/slapos-test.cfg
199 working-directory = $${runnerdirectory:test}
200 project-directory = $${runnerdirectory:project-test}
201 software_root = $${runnerdirectory:software-test}
202 instance_root = $${runnerdirectory:instance-test}
203 proxy_port = 8602
204 etc_dir = $${directory:test}
205 autorun = False
206 auto_deploy = True
207
208 [runtestsuite]
209 recipe = slapos.cookbook:wrapper
210 command-line = ${buildout:directory}/bin/slaprunnertest
211 wrapper-path = $${directory:bin}/runTestSuite
212 environment = RUNNER_CONFIG=$${slapos-cfg:rendered}
213
214 # Deploy dropbear (minimalist SSH server)
215 [sshkeys-directory]
216 recipe = slapos.cookbook:mkdirectory
217 requests = $${directory:sshkeys}/requests/
218 keys = $${directory:sshkeys}/keys/
219
220 [sshkeys-authority]
221 recipe = slapos.cookbook:sshkeys_authority
222 request-directory = $${sshkeys-directory:requests}
223 keys-directory = $${sshkeys-directory:keys}
224 wrapper = $${directory:services}/sshkeys_authority
225 keygen-binary = ${dropbear:location}/bin/dropbearkey
226
227 [dropbear-runner-server]
228 recipe = slapos.cookbook:dropbear
229 host = $${slap-network-information:global-ipv6}
230 port = 22222
231 home = $${buildout:directory}
232 wrapper = $${directory:bin}/runner_sshd
233 shell = ${bash:location}/bin/bash
234 rsa-keyfile = $${directory:ssh}/server_key.rsa
235 dropbear-binary = ${dropbear:location}/sbin/dropbear
236
237 [sshkeys-dropbear-runner]
238 <= sshkeys-authority
239 recipe = slapos.cookbook:sshkeys_authority.request
240 name = dropbear
241 type = rsa
242 executable = $${dropbear-runner-server:wrapper}
243 public-key = $${dropbear-runner-server:rsa-keyfile}.pub
244 private-key = $${dropbear-runner-server:rsa-keyfile}
245 wrapper = $${directory:services}/runner_sshd
246
247 [dropbear-server-add-authorized-key]
248 <= dropbear-runner-server
249 recipe = slapos.cookbook:dropbear.add_authorized_key
250 key = $${slap-parameter:user-authorized-key}
251
252 #---------------------------
253 #--
254 #-- Set nginx frontend
255
256 [tempdirectory]
257 recipe = slapos.cookbook:mkdirectory
258 client_body_temp_path = $${directory:tmp}/client_body_temp_path
259 proxy_temp_path = $${directory:tmp}/proxy_temp_path
260 fastcgi_temp_path = $${directory:tmp}/fastcgi_temp_path
261 uwsgi_temp_path = $${directory:tmp}/uwsgi_temp_path
262 scgi_temp_path = $${directory:tmp}/scgi_temp_path
263
264 [nginx-frontend]
265 # Options
266 nb_workers = 2
267 # Network
268 local-ip = $${slap-network-information:local-ipv4}
269 port = 30001
270 global-ip = $${slap-network-information:global-ipv6}
271 global-port = $${slaprunner:runner_port}
272 # Backend
273 runner-ip = $${slaprunner:ipv4}
274 runner-port = $${slaprunner:runner_port}
275 # SSL
276 ssl-certificate = $${ca-nginx:cert-file}
277 ssl-key = $${ca-nginx:key-file}
278 # Log
279 path_pid = $${directory:run}/nginx.pid
280 path_log = $${directory:log}/nginx.log
281 path_access_log = $${directory:log}/nginx.access.log
282 path_error_log = $${directory:log}/nginx.error.log
283 path_tmp = $${directory:tmp}/
284 # Config files
285 path_nginx_conf = $${directory:etc}/nginx.conf
286 # Executables
287 bin_nginx = ${nginx-webdav:location}/sbin/nginx
288 bin_launcher = $${directory:bin}/launcher
289 # Utils
290 path_shell = ${dash:location}/bin/dash
291 # Misc.
292 etc_dir = $${directory:etc}
293 work_dir = $${slaprunner:working-directory}
294
295 [nginx_conf]
296 recipe = slapos.recipe.template:jinja2
297 template = ${template_nginx_conf:location}/${template_nginx_conf:filename}
298 rendered = $${nginx-frontend:path_nginx_conf}
299 context =
300     key shellinabox_port shellinabox:port
301     key socket gunicorn:socket
302     section param_nginx_frontend nginx-frontend
303     section param_tempdir tempdirectory
304
305 [nginx-launcher]
306 recipe = slapos.recipe.template:jinja2
307 template = ${template_launcher:location}/${template_launcher:filename}
308 rendered = $${nginx-frontend:bin_launcher}
309 mode = 700
310 context =
311     section param_nginx_frontend nginx-frontend
312
313 [httpd-parameters]
314 path_pid = $${directory:run}/httpd.pid
315 path_error_log = $${directory:log}/httpd-error.log
316 path_access_log = $${directory:log}/httpd-access.log
317 key_file = $${ca-httpd:key-file}
318 cert_file = $${ca-httpd:cert-file}
319 global_ip = $${slap-network-information:global-ipv6}
320 global_port = $${slaprunner:runner_port}
321 monitor_port = $${monitor-parameters:port}
322 monitor_index = $${deploy-index:rendered}
323 working_directory = $${slaprunner:working-directory}
324 dav_lock = $${directory:var}/DavLock
325 etc_dir = $${directory:etc}
326 var_dir = $${directory:var}
327 project_folder = $${directory:project}
328 project_private_folder = $${runnerdirectory:private-project}
329 project_public_folder = $${runnerdirectory:public-project}
330 runner_home = $${runnerdirectory:home}
331 git_http_backend = ${git:location}/libexec/git-core/git-http-backend
332 cgi_httpd_conf = $${monitor-httpd-configuration-file:rendered}
333 httpd_cors_file = $${monitor-httpd-cors:location}
334
335 [httpd-conf]
336 recipe = slapos.recipe.template:jinja2
337 template = ${template_httpd_conf:location}/${template_httpd_conf:filename}
338 rendered = $${directory:etc}/httpd.conf
339 context =
340     section parameters httpd-parameters
341
342 [cgi-httpd-wrapper]
343 recipe = slapos.cookbook:wrapper
344 apache-executable = ${apache:location}/bin/httpd
345 wrapper-path = $${ca-httpd:executable}
346 command-line = $${:apache-executable} -f $${httpd-conf:rendered} -DFOREGROUND
347
348 #--------------------
349 #--
350 #-- WSGI
351
352 [gunicorn]
353 bin_gunicorn = $${directory:bin}/gunicorn
354 bin_launcher = $${directory:services}/gunicorn
355 path_shell = ${dash:location}/bin/dash
356 socket = $${directory:tmp}/flaskserver.sock
357 path_pid = $${directory:run}/gunicorn.pid
358
359 [gunicorn-launcher]
360 recipe = slapos.cookbook:wrapper
361 command-line = $${gunicorn:bin_gunicorn} slapos.runner:app -p $${gunicorn:path_pid} -b unix:$${gunicorn:socket} -e RUNNER_CONFIG=$${slaprunner:slapos.cfg} --error-logfile $${directory:log}/$${:error-log-file} --log-level error --preload 
362 error-log-file = gunicorn-error.log
363 wrapper-path = $${gunicorn:bin_launcher}
364 environment = PATH=$${environ:PATH}:${git:location}/bin/
365   RUNNER_CONFIG=$${slaprunner:slapos.cfg}
366   LANG=en_GB.UTF-8
367
368 [gunicorn-graceful]
369 recipe = slapos.cookbook:wrapper
370 command-line = $${directory:bin}/killpidfromfile $${gunicorn:path_pid} SIGHUP
371 wrapper-path = $${directory:scripts}/gunicorn-graceful
372
373 #--------------------
374 #--
375 #-- ssl certificates
376
377 [certificate-authority]
378 recipe = slapos.cookbook:certificate_authority
379 openssl-binary = ${openssl:location}/bin/openssl
380 ca-dir = $${directory:ca-dir}
381 requests-directory = $${cadirectory:requests}
382 wrapper = $${directory:services}/certificate_authority
383 ca-private = $${cadirectory:private}
384 ca-certs = $${cadirectory:certs}
385 ca-newcerts = $${cadirectory:newcerts}
386 ca-crl = $${cadirectory:crl}
387
388 [cadirectory]
389 recipe = slapos.cookbook:mkdirectory
390 requests = $${directory:ca-dir}/requests/
391 private = $${directory:ca-dir}/private/
392 certs = $${directory:ca-dir}/certs/
393 newcerts = $${directory:ca-dir}/newcerts/
394 crl = $${directory:ca-dir}/crl/
395
396 [ca-nginx]
397 <= certificate-authority
398 recipe = slapos.cookbook:certificate_authority.request
399 key-file = $${cadirectory:certs}/nginx_frontend.key
400 cert-file = $${cadirectory:certs}/nginx_frontend.crt
401 executable = $${nginx-launcher:rendered}
402 wrapper = $${directory:services}/nginx-frontend
403 # Put domain name
404 name = example.com
405
406 [ca-shellinabox]
407 <= certificate-authority
408 recipe = slapos.cookbook:certificate_authority.request
409 executable = $${shellinabox:wrapper}
410 wrapper = $${directory:services}/shellinaboxd
411 key-file = $${cadirectory:certs}/shellinabox.key
412 cert-file = $${cadirectory:certs}/shellinabox.crt
413 #--------------------
414 #--
415 #-- Request frontend
416
417 [request-frontend]
418 <= slap-connection
419 recipe = slapos.cookbook:requestoptional
420 name = SlapRunner Frontend
421 # XXX We have hardcoded SR URL here.
422 software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
423 slave = true
424 config = url domain
425 config-url = $${slaprunner:access-url}
426 config-domain = $${slap-parameter:frontend-domain}
427 return = site_url domain
428
429 [monitor-frontend]
430 <= slap-connection
431 recipe = slapos.cookbook:requestoptional
432 name = Monitor Frontend
433 # XXX We have hardcoded SR URL here.
434 software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
435 slave = true
436 config = url domain
437 config-url = https://[$${monitor-httpd-configuration:listening-ip}]:$${monitor-parameters:port}
438 config-domain = $${slap-parameter:frontend-domain}
439 return = site_url domain
440
441 #--------------------------------------
442 #--
443 #-- Send informations to SlapOS Master
444
445 [publish-connection-informations]
446 recipe = slapos.cookbook:publish
447 1_info = On your first run, Use "access_url" to setup you account. Then you can use both "url" or "access_url". Or "backend_url" if you want to use ipv6. Set up your account in the webrunner in order to use webdav, and being able to clone your git repositories from the runner.
448 2_info = In order to set up your account, get the recovery-code from the monitoring interface. Before read the notification on monitor_info.
449 backend_url = $${slaprunner:access-url}
450 access_url = $${:url}/login
451 url =  https://$${request-frontend:connection-domain}
452 ssh_command = ssh $${dropbear-runner-server:host} -p $${dropbear-runner-server:port}
453 monitor_url = https://$${monitor-frontend:connection-domain}
454 webdav_url = $${:monitor_url}/share/
455 public_url =  $${:monitor_url}/public/
456 git_public_url = https://[$${httpd-parameters:global_ip}]:$${httpd-parameters:monitor_port}/git-public/
457 git_private_url = https://[$${httpd-parameters:global_ip}]:$${httpd-parameters:monitor_port}/git/
458
459 #---------------------------
460 #--
461 #-- Deploy promises scripts
462
463 [slaprunner-promise]
464 recipe = slapos.cookbook:check_port_listening
465 path = $${directory:promises}/slaprunner
466 hostname = $${slaprunner:ipv6}
467 port = $${slaprunner:runner_port}
468
469 [slaprunner-frontend-promise]
470 recipe = slapos.cookbook:check_url_available
471 path = $${directory:promises}/slaprunner_frontend
472 url = https://$${request-frontend:connection-domain}/login
473 dash_path = ${dash:location}/bin/dash
474 curl_path = ${curl:location}/bin/curl
475 check-secure = 1
476
477 [dropbear-promise]
478 recipe = slapos.cookbook:check_port_listening
479 path = $${directory:promises}/dropbear
480 hostname = $${dropbear-runner-server:host}
481 port = $${dropbear-runner-server:port}
482
483 [shellinabox-promise]
484 recipe = slapos.cookbook:check_port_listening
485 path = $${directory:promises}/shellinabox
486 hostname = $${shellinabox:ipv6}
487 port = $${shellinabox:port}
488
489 [symlinks]
490 recipe = cns.recipe.symlink
491 symlink_target = $${directory:bin}
492 symlink_base = ${buildout:directory}/bin
493
494 [slap-parameter]
495 # Default value if no ssh key is specified
496 user-authorized-key =
497 # Default value of instances number in slaprunner
498 instance-amount = 10
499 debug = false
500 frontend-domain =
501 slapos-repository = http://git.erp5.org/repos/slapos.git
502 slapos-software =
503 slapos-software-type =
504 slapos-reference = master
505 auto-deploy = false
506 auto-deploy-instance = true
507 autorun = false
508 monitor-port = 9684
509
510 [monitor-parameters]
511 port = $${slap-parameter:monitor-port}
512
513 [slapos-cfg]
514 recipe = slapos.recipe.template:jinja2
515 template = ${template-slapos-cfg:location}/${template-slapos-cfg:filename}
516 rendered = $${slaprunner:slapos.cfg}
517 mode = 700
518 context =
519   section slaprunner slaprunner
520
521 [slapos-test-cfg]
522 recipe = slapos.recipe.template:jinja2
523 template = ${template-slapos-cfg:location}/${template-slapos-cfg:filename}
524 rendered = $${test-runner:slapos.cfg}
525 mode = 700
526 context =
527   section slaprunner test-runner
528
529 [shellinabox]
530 recipe = slapos.cookbook:shellinabox
531 ipv6 = $${slap-network-information:global-ipv6}
532 port = 8949
533 shell = $${shell:wrapper}
534 wrapper = $${directory:bin}/shellinaboxd
535 shellinabox-binary = ${shellinabox:location}/bin/shellinaboxd
536 password = $${zero-parameters:shell-password}
537 directory = $${runnerdirectory:home}
538 login-shell = $${directory:bin}/login
539 certificate-directory = $${cadirectory:certs}
540 cert-file = $${ca-shellinabox:cert-file}
541 key-file = $${ca-shellinabox:key-file}
542
543 [shellinabox-code]
544 recipe = slapos.cookbook:generate.password
545 storage-path = $${directory:etc}/.scode
546 bytes = 8
547
548 [shell]
549 recipe = slapos.cookbook:shell
550 wrapper = $${directory:bin}/sh
551 shell = ${bash:location}/bin/bash
552 home = $${runnerdirectory:home}
553 path = $${environ:PATH}:${nano:location}/bin:${vim:location}/bin:${screen:location}/bin:${git:location}/bin
554 ps1 = "\\w> "
555
556 [environ]
557 recipe = collective.recipe.environment
558
559 [slapos-repo]
560 recipe = slapos.recipe.build:gitclone
561 repository = $${slap-parameter:slapos-repository}
562 git-executable = ${git:location}/bin/git
563 develop = true
564 location = $${directory:project}/slapos
565
566 [slapos-repo-config]
567 recipe = plone.recipe.command
568 stop-on-error = true
569 command = cd $${slapos-repo:location} && ${git:location}/bin/git checkout $${slap-parameter:slapos-reference} && SR=$${slap-parameter:slapos-software} && if [ -n "$SR" ] && [ ! -f "$${directory:etc}/.project" ]; then echo workspace/slapos/$${slap-parameter:slapos-software}/ > $${directory:etc}/.project; fi
570 update-command = true
571
572 [prepare-software]
573 recipe = slapos.cookbook:wrapper
574 command-line = ${curl:location}/bin/curl -g https://[$${slaprunner:ipv6}]:$${slaprunner:runner_port}/isSRReady --max-time 1 --insecure
575 wrapper-path = $${directory:scripts}/prepareSoftware
576
577 [cron-entry-prepare-software]
578 <= cron
579 recipe = slapos.cookbook:cron.d
580 name = prepare-software
581 frequency = */2 * * * *
582 command = $${prepare-software:wrapper-path}
583
584 [instance-parameters]
585 recipe = slapos.recipe.template:jinja2
586 extensions = jinja2.ext.do
587 template = ${template-parameters:location}/${template-parameters:filename}
588 rendered = $${directory:etc}/.parameter.xml.default
589 mode = 0644
590 context =
591   key slapparameter_dict slap-configuration:configuration
592
593 [deploy-instance-parameters]
594 recipe = plone.recipe.command
595 stop-on-error = true
596 parameter-xml = $${directory:etc}/.parameter.xml
597 command = if [ ! -f $${:parameter-xml} ]; then cp $${instance-parameters:rendered} $${:parameter-xml}; fi
598
599 [instance-software-type]
600 recipe = plone.recipe.command
601 stop-on-error = true
602 # XXX It should not be named with .xml as it is not xml
603 software-type-path = $${directory:etc}/.software_type.xml
604 command = if [ ! -f $${:software-type-path} -a "$${slap-parameter:slapos-software-type}" != "" ]; then echo "$${slap-parameter:slapos-software-type}" > $${:software-type-path}; fi
605
606 [slap-configuration]
607 recipe = slapos.cookbook:slapconfiguration.serialised
608 computer = $${slap-connection:computer-id}
609 partition = $${slap-connection:partition-id}
610 url = $${slap-connection:server-url}
611 key = $${slap-connection:key-file}
612 cert = $${slap-connection:cert-file}
613
614 [public]
615 shell-password = $${shellinabox-code:passwd}
616 recovery-code = $${recovery-code:passwd}
617
618 [zero-parameters]
619
620
621 [minishell-cwd]
622 recipe = plone.recipe.command
623 command = if [ ! -f $${slaprunner:minishell_cwd_file} ]; then echo $${runnerdirectory:home} > $${slaprunner:minishell_cwd_file}; fi
624 location = $${slaprunner:minishell_cwd_file}
625 stop-on-error = true
626
627 [bash-profile]
628 recipe = slapos.recipe.template:jinja2
629 template = ${template-bash-profile:location}/${template-bash-profile:filename}
630 rendered = $${buildout:directory}/.bash_profile
631 context =
632     raw path $PATH:${nano:location}/bin:${vim:location}/bin:${screen:location}/bin:${git:location}/bin:${curl:location}/bin:${python2.7:location}/bin
633     key workdir runnerdirectory:home
634
635 [supervisord]
636 autorestart = false
637 autostart = false
638 directory = $${buildout:directory}
639 exitcodes = 0
640 logfile = $${directory:log}/supervisord.log
641 no_logfile = NONE
642 numprocs = 1
643 path = $${environ:PATH}
644 pidfile = $${directory:run}/supervisord.pid
645 server = $${slaprunner:ipv4}:$${:port}
646 port = 39986
647 slapgrid-cp = slapgrid-cp
648 slapgrid-cp-command = $${slaprunner:slapos} node instance --all --cfg $${:slapos-cfg} --pidfile $${:slapgrid-cp-pid} --verbose --logfile $${:slapgrid-cp-log}
649 slapgrid-cp-log = $${runnerdirectory:home}/instance.log
650 slapgrid-cp-pid = $${directory:run}/slapgrid-cp.pid
651 slapgrid-cp-startretries = 0
652 slapgrid-sr = slapgrid-sr
653 slapgrid-sr-command = $${slaprunner:slapos} node software --all --cfg $${:slapos-cfg} --pidfile $${:slapgrid-sr-pid} --verbose --logfile $${:slapgrid-sr-log}
654 slapgrid-sr-log = $${runnerdirectory:home}/software.log
655 slapgrid-sr-pid = $${directory:run}/slapgrid-sr.pid
656 slapgrid-sr-startretries = 0
657 slapproxy = slapproxy
658 slapproxy-autorestart = true
659 slapproxy-autostart = true
660 slapproxy-startsecs = 1
661 slapproxy-command = $${slaprunner:slapos} proxy start --logfile $${:slapproxy-log} --cfg $${:slapos-cfg}
662 slapproxy-log = $${directory:log}/slapproxy.log
663 socket_name = unix://$${:socket_path}
664 socket_path = $${directory:tmp}/supervisord.sock
665 startsecs = 0
666 # This file logs errors from listeners. Supervisord has its own logfile.
667 # Processes should handle their logs by themselves
668 stderr_logfile = $${directory:log}/supervisord-errors.log
669 slapos-cfg = $${slaprunner:slapos.cfg}
670
671 [supervisord-conf]
672 recipe = slapos.recipe.template:jinja2
673 template = ${template-supervisord:location}/${template-supervisord:filename}
674 rendered = $${directory:etc}/supervisord.conf
675 context =
676     import multiprocessing multiprocessing
677     import builtin __builtin__
678     section supervisord supervisord
679     key slapparameter_dict slap-configuration:configuration
680     key listener_slapgrid listener-slapgrid-bin:rendered
681
682 [listener-slapgrid-bin]
683 recipe = slapos.recipe.template:jinja2
684 template = ${template-listener-slapgrid:location}/${template-listener-slapgrid:filename}
685 rendered = $${directory:bin}/listener_slapgrid.py
686 mode = 0744
687 context =
688     section supervisord supervisord
689     section slaprunner slaprunner
690     raw python_executable ${buildout:directory}/bin/${extra-eggs:interpreter}
691
692 [supervisord-wrapper]
693 recipe = slapos.cookbook:wrapper
694 command-line = $${buildout:directory}/bin/supervisord -c $${supervisord-conf:rendered} --nodaemon
695 wrapper-path = $${directory:services}/supervisord
696
697 [supervisord-promise]
698 recipe = slapos.cookbook:check_port_listening
699 path = $${directory:promises}/supervisord
700 hostname = $${slaprunner:ipv4}
701 port = $${supervisord:port}
702
703 [monitor-current-log-access]
704 < = monitor-directory-access
705 source = $${directory:log}
706
707 [monitor-deploy-cors-domain-cgi]
708 recipe = slapos.recipe.template:jinja2
709 template = ${cors-domain-cgi:location}/${cors-domain-cgi:filename}
710 rendered = $${monitor-directory:knowledge0-cgi}/$${:filename}
711 filename = cors-domain.cgi
712 mode = 0744
713 context =
714   raw config_cfg $${buildout:directory}/knowledge0.cfg
715   raw timestamp $${buildout:directory}/.timestamp
716   raw python_executable ${buildout:executable}
717   key apache_file httpd-parameters:httpd_cors_file
718   key pwd monitor-directory:knowledge0-cgi
719   key this_file :filename
720   key httpd_graceful cgi-httpd-graceful-wrapper:rendered
721
722 [monitor-httpd-cors]
723 recipe = plone.recipe.command
724 command = if [ ! -f $${:location} ]; then touch $${:location}; fi
725 location = $${directory:etc}/$${:filename}
726 filename = httpd-cors.cfg
727 stop-on-error = true