instance-runner.cfg 24.3 KB
Newer Older
1 2
[buildout]
parts =
3 4 5 6
  nginx_conf
  nginx-launcher
  certificate-authority
  ca-nginx
7 8
  gunicorn-launcher
  gunicorn-graceful
9
  sshkeys-dropbear-runner
10
  dropbear-server-add-authorized-key
11
  sshkeys-authority
12
  publish-connection-information
13 14
  slaprunner-promise
  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 32
  custom-frontend-promise
{% endif %}
33
## Monitoring part
34
###Parts to add for monitoring
35
  cron
36 37 38
  certificate-authority
  cron-entry-monitor
  cron-entry-rss
39 40 41
  deploy-index
  deploy-settings-cgi
  deploy-status-cgi
42
  deploy-status-history-cgi
43
  setup-static-files
44 45
  certificate-authority
  zero-parameters
46
  public-symlink
47 48 49 50 51 52
  cgi-httpd-wrapper
  cgi-httpd-graceful-wrapper
  monitor-promise
  monitor-instance-log-access
## Monitor for runner
  monitor-current-log-access
53
  monitor-deploy-cors-domain-cgi
54
  monitor-check-webrunner-internal-instance
55 56

extends = ${monitor-template:output}
57 58 59 60 61

eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true

62 63
{% if slapparameter_dict.get('custom-frontend-backend-url') -%}
[request-custom-frontend]
64
recipe = slapos.cookbook:requestoptional
65 66 67 68 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') }}
software-type = {{ slapparameter_dict.get('custom-frontend-software-type', 'RootSoftwareInstance') }}
slave = true
name = Custom Web Frontend

70 71 72 73 74
server-url = $${slap-connection:server-url}
key-file = $${slap-connection:key-file}
cert-file = $${slap-connection:cert-file}
computer-id = $${slap-connection:computer-id}
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 79
{% endif -%}

80 81
{% set custom_frontend_backend_type = slapparameter_dict.get('custom-frontend-backend-type') -%}
{% if custom_frontend_backend_type -%}
82 83
config-type = {{ custom_frontend_backend_type }}
{% endif -%}
84
config-url = {{ slapparameter_dict.get('custom-frontend-backend-url') }}
85
return = site_url domain
86 87 88

[custom-frontend-promise]
recipe = slapos.cookbook:check_url_available
89 90 91 92 93
path = $${directory:promises}/custom_frontend_promise
url = https://$${request-custom-frontend:connection-domain}
{% if slapparameter_dict.get('custom-frontend-basic-auth') -%}
check-secure = 1
{% endif -%}
94 95 96
dash_path = {{ dash_executable_location }}
curl_path = {{ curl_executable_location }}

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 105 106 107 108 109
home = $${buildout:directory}
etc = $${:home}/etc/
var = $${:home}/var/
srv = $${:home}/srv/
bin = $${:home}/bin/
tmp = $${:home}/tmp/
110

111 112 113 114 115 116 117 118 119
sshkeys = $${:srv}/sshkeys
services = $${:etc}/service/
scripts = $${:etc}/run/
ssh = $${:etc}/ssh/
log = $${:var}/log/
run = $${:var}/run/
backup = $${:srv}/backup/
promises = $${:etc}/promise/
test = $${:etc}/test/
120
nginx-data = $${:srv}/nginx
121
ca-dir = $${:srv}/ssl
122
project = $${:srv}/runner/project
123 124 125

[runnerdirectory]
recipe = slapos.cookbook:mkdirectory
126 127
home = $${directory:srv}/runner/
test = $${directory:srv}/test/
128
project = $${:home}/project
129
public = $${:home}/public
130 131
software-root = $${:home}/software
instance-root = $${:home}/instance
132 133 134
project-test = $${:test}/project
software-test = $${:test}/software
instance-test = $${:test}/instance
135
sessions = $${buildout:directory}/.sessions
136 137
private-project = $${:home}/.git-private
public-project = $${:home}/.git-public
138

139 140
#Create password recovery code for slaprunner
[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 149
slapproxy = ${buildout:directory}/bin/slapproxy
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 154
working-directory = $${runnerdirectory:home}
project-directory = $${runnerdirectory:project}
155 156
instance_root = $${runnerdirectory:instance-root}
software_root = $${runnerdirectory:software-root}
157
instance-monitor-url = https://[$${:ipv6}]:$${monitor-parameters:port}
158 159 160
etc_dir = $${directory:etc}
log_dir =  $${directory:log}
run_dir = $${directory:run}
161 162 163
ssh_client = $${sshkeys-dropbear-runner:wrapper}
public_key = $${sshkeys-dropbear-runner:public-key}
private_key = $${sshkeys-dropbear-runner:private-key}
164 165
ipv4 = $${slap-network-information:local-ipv4}
ipv6 = $${slap-network-information:global-ipv6}
166
instance_root = $${runnerdirectory:instance-root}
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
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 177 178
console = False
verbose = False
debug = False
179 180 181 182
auto_deploy = $${slap-parameter:auto-deploy}
auto_deploy_instance = $${slap-parameter:auto-deploy-instance}
autorun = $${slap-parameter:autorun}
knowledge0_file = $${buildout:directory}/$${public:filename}
183
minishell_cwd_file = $${directory:etc}/.minishell-cwd
184
minishell_history_file = $${directory:etc}/.minishell_history
185 186
software_info_json = $${runnerdirectory:home}/software_info.json
instance_info_json = $${runnerdirectory:home}/instance_info.json
187
path = $${shell:path}
188
instance_name = $${slap-parameter:instance-name}
189

190 191 192 193 194 195 196 197 198 199 200

#---------------------------
#--
#-- supervisord managing slaprunner instance processes
[slaprunner-supervisord-wrapper]
recipe = slapos.cookbook:wrapper
# XXX hardcoded locations
command-line = $${buildout:directory}/bin/slapos node supervisord --cfg $${directory:etc}/slapos.cfg -n
wrapper-path = $${directory:services}/slaprunner-supervisord


201 202
[test-runner]
<= slaprunner
203
slapos.cfg = $${directory:etc}/slapos-test.cfg
204 205
working-directory = $${runnerdirectory:test}
project-directory = $${runnerdirectory:project-test}
206 207
software_root = $${runnerdirectory:software-test}
instance_root = $${runnerdirectory:instance-test}
208
proxy_port = 8602
209
etc_dir = $${directory:test}
210 211
autorun = False
auto_deploy = True
212

213 214 215
[runtestsuite]
recipe = slapos.cookbook:wrapper
command-line = ${buildout:directory}/bin/slaprunnertest
216
wrapper-path = $${directory:bin}/runTestSuite
217
environment = RUNNER_CONFIG=$${slapos-cfg:rendered}
218 219 220 221 222 223

# Deploy dropbear (minimalist SSH server)
[sshkeys-directory]
recipe = slapos.cookbook:mkdirectory
requests = $${directory:sshkeys}/requests/
keys = $${directory:sshkeys}/keys/
224

225 226 227 228
[sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = $${sshkeys-directory:requests}
keys-directory = $${sshkeys-directory:keys}
229
wrapper = $${directory:services}/sshkeys_authority
230 231
keygen-binary = ${dropbear:location}/bin/dropbearkey

232
[dropbear-runner-server]
233 234
recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6}
235
port = 22222
236
home = $${buildout:directory}
237 238
wrapper = $${directory:bin}/runner_sshd
shell = ${bash:location}/bin/bash
239 240 241
rsa-keyfile = $${directory:ssh}/server_key.rsa
dropbear-binary = ${dropbear:location}/sbin/dropbear

242
[sshkeys-dropbear-runner]
243 244 245 246
<= sshkeys-authority
recipe = slapos.cookbook:sshkeys_authority.request
name = dropbear
type = rsa
247 248 249 250
executable = $${dropbear-runner-server:wrapper}
public-key = $${dropbear-runner-server:rsa-keyfile}.pub
private-key = $${dropbear-runner-server:rsa-keyfile}
wrapper = $${directory:services}/runner_sshd
251 252

[dropbear-server-add-authorized-key]
253
<= dropbear-runner-server
254
recipe = slapos.cookbook:dropbear.add_authorized_key
255
key = $${slap-parameter:user-authorized-key}
256

257
#---------------------------
258
#--
259 260
#-- Set nginx frontend

261 262 263 264 265 266 267 268 269 270
[tempdirectory]
recipe = slapos.cookbook:mkdirectory
client_body_temp_path = $${directory:tmp}/client_body_temp_path
proxy_temp_path = $${directory:tmp}/proxy_temp_path
fastcgi_temp_path = $${directory:tmp}/fastcgi_temp_path
uwsgi_temp_path = $${directory:tmp}/uwsgi_temp_path
scgi_temp_path = $${directory:tmp}/scgi_temp_path

[nginx-frontend]
# Options
271
nb_workers = 5
272
# Network
273 274 275
local-ip = $${slap-network-information:local-ipv4}
global-ip = $${slap-network-information:global-ipv6}
global-port = $${slaprunner:runner_port}
276
# Backend
277 278
runner-ip = $${slaprunner:ipv4}
runner-port = $${slaprunner:runner_port}
279 280 281 282 283 284 285 286
# SSL
ssl-certificate = $${ca-nginx:cert-file}
ssl-key = $${ca-nginx:key-file}
# Log
path_pid = $${directory:run}/nginx.pid
path_log = $${directory:log}/nginx.log
path_access_log = $${directory:log}/nginx.access.log
path_error_log = $${directory:log}/nginx.error.log
287
path_tmp = $${directory:tmp}/
288
nginx_prefix = $${buildout:directory}
289 290 291
# Config files
path_nginx_conf = $${directory:etc}/nginx.conf
# Executables
292
bin_nginx = ${nginx-webdav:location}/sbin/nginx
293
bin_launcher = $${directory:bin}/launcher
294 295
# Utils
path_shell = ${dash:location}/bin/dash
296 297
# Misc.
etc_dir = $${directory:etc}
298
work_dir = $${slaprunner:working-directory}
299 300 301 302 303 304

[nginx_conf]
recipe = slapos.recipe.template:jinja2
template = ${template_nginx_conf:location}/${template_nginx_conf:filename}
rendered = $${nginx-frontend:path_nginx_conf}
context =
305
    key shellinabox_socket shellinabox:socket
306
    key socket gunicorn:socket
307 308 309 310 311 312 313 314 315 316 317
    section param_nginx_frontend nginx-frontend
    section param_tempdir tempdirectory

[nginx-launcher]
recipe = slapos.recipe.template:jinja2
template = ${template_launcher:location}/${template_launcher:filename}
rendered = $${nginx-frontend:bin_launcher}
mode = 700
context =
    section param_nginx_frontend nginx-frontend

318 319 320 321 322 323 324 325 326 327 328 329 330
[httpd-parameters]
path_pid = $${directory:run}/httpd.pid
path_error_log = $${directory:log}/httpd-error.log
path_access_log = $${directory:log}/httpd-access.log
key_file = $${ca-httpd:key-file}
cert_file = $${ca-httpd:cert-file}
global_ip = $${slap-network-information:global-ipv6}
global_port = $${slaprunner:runner_port}
monitor_port = $${monitor-parameters:port}
monitor_index = $${deploy-index:rendered}
working_directory = $${slaprunner:working-directory}
dav_lock = $${directory:var}/DavLock
etc_dir = $${directory:etc}
331
var_dir = $${directory:var}
332
project_folder = $${directory:project}
333
project_private_folder = $${runnerdirectory:private-project}
334
project_public_folder = $${runnerdirectory:public-project}
335
runner_home = $${runnerdirectory:home}
336
git_http_backend = ${git:location}/libexec/git-core/git-http-backend
337
cgi_httpd_conf = $${monitor-httpd-configuration-file:rendered}
338
httpd_cors_file = $${monitor-httpd-cors:location}
339 340 341 342 343

[httpd-conf]
recipe = slapos.recipe.template:jinja2
template = ${template_httpd_conf:location}/${template_httpd_conf:filename}
rendered = $${directory:etc}/httpd.conf
344
context =
345 346 347
    section parameters httpd-parameters

[cgi-httpd-wrapper]
348 349 350
recipe = slapos.cookbook:wrapper
apache-executable = ${apache:location}/bin/httpd
wrapper-path = $${ca-httpd:executable}
351 352
command-line = $${:apache-executable} -f $${httpd-conf:rendered} -DFOREGROUND

353 354 355 356
#--------------------
#--
#-- WSGI

357
[gunicorn]
358 359 360 361 362 363 364 365
bin_gunicorn = $${directory:bin}/gunicorn
bin_launcher = $${directory:services}/gunicorn
path_shell = ${dash:location}/bin/dash
socket = $${directory:tmp}/flaskserver.sock
path_pid = $${directory:run}/gunicorn.pid

[gunicorn-launcher]
recipe = slapos.cookbook:wrapper
366
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
367
error-log-file = gunicorn-error.log
368
wrapper-path = $${gunicorn:bin_launcher}
369
environment = PATH=$${environ:PATH}:${git:location}/bin/
370
  RUNNER_CONFIG=$${slaprunner:slapos.cfg}
371
  LANG=en_GB.UTF-8
372 373 374

[gunicorn-graceful]
recipe = slapos.cookbook:wrapper
375
command-line = $${directory:bin}/killpidfromfile $${gunicorn:path_pid} SIGHUP
376 377
wrapper-path = $${directory:scripts}/gunicorn-graceful

378
#--------------------
379
#--
380
#-- ssl certificates
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405

[certificate-authority]
recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl
ca-dir = $${directory:ca-dir}
requests-directory = $${cadirectory:requests}
wrapper = $${directory:services}/certificate_authority
ca-private = $${cadirectory:private}
ca-certs = $${cadirectory:certs}
ca-newcerts = $${cadirectory:newcerts}
ca-crl = $${cadirectory:crl}

[cadirectory]
recipe = slapos.cookbook:mkdirectory
requests = $${directory:ca-dir}/requests/
private = $${directory:ca-dir}/private/
certs = $${directory:ca-dir}/certs/
newcerts = $${directory:ca-dir}/newcerts/
crl = $${directory:ca-dir}/crl/

[ca-nginx]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
key-file = $${cadirectory:certs}/nginx_frontend.key
cert-file = $${cadirectory:certs}/nginx_frontend.crt
406 407
executable = $${nginx-launcher:rendered}
wrapper = $${directory:services}/nginx-frontend
408 409 410
# Put domain name
name = example.com

411
#--------------------
412 413
#--
#-- Request frontend
414

415 416
[request-frontend]
<= slap-connection
417
recipe = slapos.cookbook:requestoptional
418
name = SlapRunner Frontend
419 420 421
# XXX We have hardcoded SR URL here.
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
slave = true
422
config-url = $${slaprunner:access-url}
423
config-domain = $${slap-parameter:frontend-domain}
424
return = site_url domain
425

426 427 428 429 430 431 432
[monitor-frontend]
<= slap-connection
recipe = slapos.cookbook:requestoptional
name = Monitor Frontend
# XXX We have hardcoded SR URL here.
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
slave = true
433
config-url = https://[$${monitor-httpd-configuration:listening-ip}]:$${monitor-parameters:port}
434 435 436
config-domain = $${slap-parameter:frontend-domain}
return = site_url domain

437
#--------------------------------------
438
#--
439
#-- Send information to SlapOS Master
440

441
[publish-connection-information]
442
recipe = slapos.cookbook:publish
443
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.
444
2_info = In order to set up your account, get the recovery-code from the monitoring interface. Before read the notification on monitor_info.
445
backend_url = $${slaprunner:access-url}
446
access_url = $${:url}/login
447
url =  https://$${request-frontend:connection-domain}
448
ssh_command = ssh $${dropbear-runner-server:host} -p $${dropbear-runner-server:port}
449
monitor_url = https://$${monitor-frontend:connection-domain}
450
monitor_backend_url = https://[$${monitor-httpd-configuration:listening-ip}]:$${monitor-parameters:port}
451 452
webdav_url = $${:monitor_url}/share/
public_url =  $${:monitor_url}/public/
453 454
git_public_url = https://[$${httpd-parameters:global_ip}]:$${httpd-parameters:monitor_port}/git-public/
git_private_url = https://[$${httpd-parameters:global_ip}]:$${httpd-parameters:monitor_port}/git/
455

456 457 458
#---------------------------
#--
#-- Deploy promises scripts
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
459

460 461
[slaprunner-promise]
recipe = slapos.cookbook:check_port_listening
462
path = $${directory:promises}/slaprunner
463 464
hostname = $${slaprunner:ipv6}
port = $${slaprunner:runner_port}
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
465

466
[slaprunner-frontend-promise]
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
467
recipe = slapos.cookbook:check_url_available
468
path = $${directory:promises}/slaprunner_frontend
469
url = https://$${request-frontend:connection-domain}/login
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
470 471
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl
472
check-secure = 1
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
473

474 475
[dropbear-promise]
recipe = slapos.cookbook:check_port_listening
476
path = $${directory:promises}/dropbear
477 478
hostname = $${dropbear-runner-server:host}
port = $${dropbear-runner-server:port}
479

480 481
[symlinks]
recipe = cns.recipe.symlink
482
symlink_target = $${directory:bin}
483
symlink_base = ${buildout:directory}/bin
484 485 486

[slap-parameter]
# Default value if no ssh key is specified
487
user-authorized-key =
488
# Default value of instances number in slaprunner
489
instance-amount = 10
490 491
debug = false
frontend-domain =
492 493
slapos-repository = http://git.erp5.org/repos/slapos.git
slapos-software =
494
slapos-software-type =
495
slapos-reference = master
496
auto-deploy = false
497
auto-deploy-instance = true
498
autorun = false
499
monitor-port = 9684
500
instance-name =
501 502 503

[monitor-parameters]
port = $${slap-parameter:monitor-port}
504

505 506
[slapos-cfg]
recipe = slapos.recipe.template:jinja2
507
template = ${template-slapos-cfg:location}/${template-slapos-cfg:filename}
508 509 510
rendered = $${slaprunner:slapos.cfg}
mode = 700
context =
511
  section slaprunner slaprunner
512

513 514
[slapos-test-cfg]
recipe = slapos.recipe.template:jinja2
515
template = ${template-slapos-cfg:location}/${template-slapos-cfg:filename}
516 517 518 519 520
rendered = $${test-runner:slapos.cfg}
mode = 700
context =
  section slaprunner test-runner

521
[shellinabox]
522 523 524 525 526 527 528 529 530 531
recipe = slapos.recipe.template:jinja2
# We cannot use slapos.cookbook:wrapper here because this recipe escapes too much
socket = $${directory:run}/siab.sock
mode = 0700
rendered = $${directory:services}/shellinaboxd
template = inline:
  #!/bin/sh
  exec ${shellinabox:location}/bin/shellinaboxd \
    --disable-ssl \
    --disable-ssl-menu \
532 533
    --unixdomain-only=$${:socket}:$(id -u):$(id -g):0600 \
    --service "/:$(id -u):$(id -g):HOME:$${shell:wrapper}"
534 535 536

[shell]
recipe = slapos.cookbook:shell
537
wrapper = $${directory:bin}/bash
538
shell = ${bash:location}/bin/bash
539 540
home = $${buildout:directory}
path = $${environ:PATH}:/usr/bin:/bin/:${nano:location}/bin:${vim:location}/bin:${screen:location}/bin:${git:location}/bin:${tig:location}/bin
541 542
ps1 = "\\w> "

543 544 545
[environ]
recipe = collective.recipe.environment

546 547 548 549 550 551
[slapos-repo]
recipe = slapos.recipe.build:gitclone
repository = $${slap-parameter:slapos-repository}
git-executable = ${git:location}/bin/git
develop = true
location = $${directory:project}/slapos
552
branch = $${slap-parameter:slapos-reference}
553 554 555

[prepare-software]
recipe = slapos.cookbook:wrapper
556
command-line = ${curl:location}/bin/curl -g https://[$${slaprunner:ipv6}]:$${slaprunner:runner_port}/isSRReady --max-time 1 --insecure
557 558
wrapper-path = $${directory:scripts}/prepareSoftware

559 560 561 562 563 564 565
[cron-entry-prepare-software]
<= cron
recipe = slapos.cookbook:cron.d
name = prepare-software
frequency = */2 * * * *
command = $${prepare-software:wrapper-path}

566 567 568
[instance-parameters]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
569
template = ${template-parameters:location}/${template-parameters:filename}
570 571
rendered = $${directory:etc}/.parameter.xml.default
mode = 0644
572
context =
573 574 575 576 577 578 579 580
  key slapparameter_dict slap-configuration:configuration

[deploy-instance-parameters]
recipe = plone.recipe.command
stop-on-error = true
parameter-xml = $${directory:etc}/.parameter.xml
command = if [ ! -f $${:parameter-xml} ]; then cp $${instance-parameters:rendered} $${:parameter-xml}; fi

581 582 583 584 585 586 587
[instance-software-type]
recipe = plone.recipe.command
stop-on-error = true
# XXX It should not be named with .xml as it is not xml
software-type-path = $${directory:etc}/.software_type.xml
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 590 591 592
[instance-software]
recipe = plone.recipe.command
stop-on-error = true
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 595 596 597 598 599 600
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}

601
[public]
602 603
recovery-code = $${recovery-code:passwd}

604
[zero-parameters]
605 606


607 608 609 610 611 612
[minishell-cwd]
recipe = plone.recipe.command
command = if [ ! -f $${slaprunner:minishell_cwd_file} ]; then echo $${runnerdirectory:home} > $${slaprunner:minishell_cwd_file}; fi
location = $${slaprunner:minishell_cwd_file}
stop-on-error = true

613
[bash-profile]
614 615 616 617 618 619
recipe = slapos.recipe.template:jinja2
template = ${template-bash-profile:location}/${template-bash-profile:filename}
rendered = $${buildout:directory}/.bash_profile
context =
    raw path $PATH:${nano:location}/bin:${vim:location}/bin:${screen:location}/bin:${git:location}/bin:${curl:location}/bin:${python2.7:location}/bin
    key workdir runnerdirectory:home
620

621 622 623 624 625

#---------------------------
#--
#-- supervisord managing slaprunner automation features

626
[supervisord]
627
autorestart = false
628 629 630 631
autostart = false
directory = $${buildout:directory}
exitcodes = 0
logfile = $${directory:log}/supervisord.log
632
no_logfile = NONE
633 634 635
numprocs = 1
path = $${environ:PATH}
pidfile = $${directory:run}/supervisord.pid
636 637
server = $${slaprunner:ipv4}:$${:port}
port = 39986
638
slapgrid-cp = slapgrid-cp
639
slapgrid-cp-command = $${slaprunner:slapos} node instance --all --cfg $${:slapos-cfg} --pidfile $${:slapgrid-cp-pid} --verbose --logfile $${:slapgrid-cp-log}
640 641
slapgrid-cp-log = $${runnerdirectory:home}/instance.log
slapgrid-cp-pid = $${directory:run}/slapgrid-cp.pid
642
slapgrid-cp-startretries = 0
643
slapgrid-sr = slapgrid-sr
644
slapgrid-sr-command = $${slaprunner:slapos} node software --all --cfg $${:slapos-cfg} --pidfile $${:slapgrid-sr-pid} --verbose --logfile $${:slapgrid-sr-log}
645 646
slapgrid-sr-log = $${runnerdirectory:home}/software.log
slapgrid-sr-pid = $${directory:run}/slapgrid-sr.pid
647
slapgrid-sr-startretries = 0
648 649 650
slapproxy = slapproxy
slapproxy-autorestart = true
slapproxy-autostart = true
651
slapproxy-startsecs = 1
652
slapproxy-command = $${slaprunner:slapos} proxy start --logfile $${:slapproxy-log} --cfg $${:slapos-cfg}
653
slapproxy-log = $${directory:log}/slapproxy.log
654 655
socket_name = unix://$${:socket_path}
socket_path = $${directory:tmp}/supervisord.sock
656
startsecs = 0
657 658 659
# This file logs errors from listeners. Supervisord has its own logfile.
# Processes should handle their logs by themselves
stderr_logfile = $${directory:log}/supervisord-errors.log
660
slapos-cfg = $${slaprunner:slapos.cfg}
661 662 663 664 665 666

[supervisord-conf]
recipe = slapos.recipe.template:jinja2
template = ${template-supervisord:location}/${template-supervisord:filename}
rendered = $${directory:etc}/supervisord.conf
context =
667 668
    import multiprocessing multiprocessing
    import builtin __builtin__
669
    section supervisord supervisord
670
    key slapparameter_dict slap-configuration:configuration
671 672 673 674 675 676 677 678 679 680
    key listener_slapgrid listener-slapgrid-bin:rendered

[listener-slapgrid-bin]
recipe = slapos.recipe.template:jinja2
template = ${template-listener-slapgrid:location}/${template-listener-slapgrid:filename}
rendered = $${directory:bin}/listener_slapgrid.py
mode = 0744
context =
    section supervisord supervisord
    section slaprunner slaprunner
681
    raw python_executable ${buildout:directory}/bin/${extra-eggs:interpreter}
682 683 684 685 686 687

[supervisord-wrapper]
recipe = slapos.cookbook:wrapper
command-line = $${buildout:directory}/bin/supervisord -c $${supervisord-conf:rendered} --nodaemon
wrapper-path = $${directory:services}/supervisord

688 689 690 691 692 693
[supervisord-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/supervisord
hostname = $${slaprunner:ipv4}
port = $${supervisord:port}

694

695 696 697
[monitor-current-log-access]
< = monitor-directory-access
source = $${directory:log}
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713

[monitor-deploy-cors-domain-cgi]
recipe = slapos.recipe.template:jinja2
template = ${cors-domain-cgi:location}/${cors-domain-cgi:filename}
rendered = $${monitor-directory:knowledge0-cgi}/$${:filename}
filename = cors-domain.cgi
mode = 0744
context =
  raw config_cfg $${buildout:directory}/knowledge0.cfg
  raw timestamp $${buildout:directory}/.timestamp
  raw python_executable ${buildout:executable}
  key apache_file httpd-parameters:httpd_cors_file
  key pwd monitor-directory:knowledge0-cgi
  key this_file :filename
  key httpd_graceful cgi-httpd-graceful-wrapper:rendered

714 715 716 717 718 719 720
[monitor-check-webrunner-internal-instance]
recipe = slapos.recipe.template:jinja2
template = ${monitor-check-webrunner-internal-instance:location}/${monitor-check-webrunner-internal-instance:filename}
rendered = $${monitor-directory:monitor-custom-scripts}/$${:filename}
filename = monitor-check-webrunner-internal-instance.py
mode = 0744

721 722 723 724 725 726
[monitor-httpd-cors]
recipe = plone.recipe.command
command = if [ ! -f $${:location} ]; then touch $${:location}; fi
location = $${directory:etc}/$${:filename}
filename = httpd-cors.cfg
stop-on-error = true