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