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