instance-runner.cfg 24.2 KB
Newer Older
1 2
[buildout]
parts =
3 4 5 6
  nginx_conf
  nginx-launcher
  certificate-authority
  ca-nginx
7
  ca-shellinabox
8 9
  gunicorn-launcher
  gunicorn-graceful
10
  sshkeys-dropbear-runner
11
  dropbear-server-add-authorized-key
12
  sshkeys-authority
13
  publish-connection-informations
14 15 16
  slaprunner-promise
  slaprunner-frontend-promise
  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 31 32
{% if slapparameter_dict.get('custom-frontend-backend-url') %}
  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 55

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

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

61 62 63 64 65 66 67
{% if slapparameter_dict.get('custom-frontend-backend-url') -%}
# Requests, if defined, a frontend to allow access to a server
# located inside of the virtual machine listening to port X
# to LAN IPv4.
# Internaly, the frontend will be asked to listen on the IPv6
# with port X + 10000, to match NAT rules of Qemu.
[request-custom-frontend]
68
recipe = slapos.cookbook:requestoptional
69 70 71 72 73
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

74 75 76 77 78
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}
79

80
{%- if slapparameter_dict.get('custom-frontend-instance-guid') -%}
81
sla-instance_guid = $${slap-parameter:frontend-instance-guid}
82 83
{% endif -%}

84 85
{% set custom_frontend_backend_type = slapparameter_dict.get('custom-frontend-backend-type') -%}
{% if custom_frontend_backend_type -%}
86 87
config-type = {{ custom_frontend_backend_type }}
{% endif -%}
88
config-url = {{ slapparameter_dict.get('custom-frontend-backend-url') }}
89
return = site_url domain
90 91 92

[custom-frontend-promise]
recipe = slapos.cookbook:check_url_available
93 94 95 96 97
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 -%}
98 99 100 101
dash_path = {{ dash_executable_location }}
curl_path = {{ curl_executable_location }}

[publish-connection-informations]
102
custom-frontend-url = https://$${request-custom-frontend:connection-domain}
103
{% endif %}
104

105
# Create all needed directories
106
[directory]
107 108 109 110 111
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
112
tmp = $${buildout:directory}/tmp/
113

114 115 116 117 118 119 120 121 122
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/
123
nginx-data = $${directory:srv}/nginx
124
ca-dir = $${:srv}/ssl
125
project = $${:srv}/runner/project
126 127 128

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

142 143
#Create password recovery code for slaprunner
[recovery-code]
144
recipe = slapos.cookbook:generate.password
145
storage-path = $${directory:etc}/.rcode
146
bytes = 8
147

148
[slaprunner]
149
slaprunner = ${buildout:directory}/bin/slaprunner
150
slapos = ${buildout:directory}/bin/slapos
151 152
slapproxy = ${buildout:directory}/bin/slapproxy
supervisor = ${buildout:directory}/bin/slapgrid-supervisorctl
153
git-binary = ${git:location}/bin/git
154
root_check = false
155
slapos.cfg = $${directory:etc}/slapos.cfg
156 157
working-directory = $${runnerdirectory:home}
project-directory = $${runnerdirectory:project}
158 159
instance_root = $${runnerdirectory:instance-root}
software_root = $${runnerdirectory:software-root}
160
instance-monitor-url = https://[$${:ipv6}]:$${monitor-parameters:port}
161 162 163
etc_dir = $${directory:etc}
log_dir =  $${directory:log}
run_dir = $${directory:run}
164 165 166
ssh_client = $${sshkeys-dropbear-runner:wrapper}
public_key = $${sshkeys-dropbear-runner:public-key}
private_key = $${sshkeys-dropbear-runner:private-key}
167 168
ipv4 = $${slap-network-information:local-ipv4}
ipv6 = $${slap-network-information:global-ipv6}
169
instance_root = $${runnerdirectory:instance-root}
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
170
proxy_port = 50000
171
runner_port = 50005
172
partition-amount = $${slap-parameter:instance-amount}
173
wrapper = $${directory:services}/slaprunner
174
debug = $${slap-parameter:debug}
175
access-url = https://[$${:ipv6}]:$${:runner_port}
176
supervisord_config = $${directory:etc}/supervisord.conf
177
supervisord_server = http://$${supervisord:server}
178
proxy_database = $${slaprunner:working-directory}/proxy.db
179 180 181
console = False
verbose = False
debug = False
182 183 184 185
auto_deploy = $${slap-parameter:auto-deploy}
auto_deploy_instance = $${slap-parameter:auto-deploy-instance}
autorun = $${slap-parameter:autorun}
knowledge0_file = $${buildout:directory}/$${public:filename}
186
minishell_cwd_file = $${directory:etc}/.minishell-cwd
187
minishell_history_file = $${directory:etc}/.minishell_history
188 189
software_info_json = $${runnerdirectory:home}/software_info.json
instance_info_json = $${runnerdirectory:home}/instance_info.json
190
path = $${shell:path}
191

192 193
[test-runner]
<= slaprunner
194
slapos.cfg = $${directory:etc}/slapos-test.cfg
195 196
working-directory = $${runnerdirectory:test}
project-directory = $${runnerdirectory:project-test}
197 198
software_root = $${runnerdirectory:software-test}
instance_root = $${runnerdirectory:instance-test}
199
proxy_port = 8602
200
etc_dir = $${directory:test}
201 202
autorun = False
auto_deploy = True
203

204 205 206 207
[runtestsuite]
recipe = slapos.cookbook:wrapper
command-line = ${buildout:directory}/bin/slaprunnertest
wrapper-path = $${directory:bin}/runTestSuite
208
environment = RUNNER_CONFIG=$${slapos-cfg:rendered}
209 210 211 212 213 214

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

216 217 218 219
[sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = $${sshkeys-directory:requests}
keys-directory = $${sshkeys-directory:keys}
220
wrapper = $${directory:services}/sshkeys_authority
221 222
keygen-binary = ${dropbear:location}/bin/dropbearkey

223
[dropbear-runner-server]
224 225
recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6}
226
port = 22222
227
home = $${buildout:directory}
228 229
wrapper = $${directory:bin}/runner_sshd
shell = ${bash:location}/bin/bash
230 231 232
rsa-keyfile = $${directory:ssh}/server_key.rsa
dropbear-binary = ${dropbear:location}/sbin/dropbear

233
[sshkeys-dropbear-runner]
234 235 236 237
<= sshkeys-authority
recipe = slapos.cookbook:sshkeys_authority.request
name = dropbear
type = rsa
238 239 240 241
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
242 243

[dropbear-server-add-authorized-key]
244
<= dropbear-runner-server
245
recipe = slapos.cookbook:dropbear.add_authorized_key
246
key = $${slap-parameter:user-authorized-key}
247

248
#---------------------------
249
#--
250 251
#-- Set nginx frontend

252 253 254 255 256 257 258 259 260 261 262 263
[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
nb_workers = 2
# Network
264
local-ip = $${slap-network-information:local-ipv4}
265
port = 30001
266 267
global-ip = $${slap-network-information:global-ipv6}
global-port = $${slaprunner:runner_port}
268
# Backend
269 270
runner-ip = $${slaprunner:ipv4}
runner-port = $${slaprunner:runner_port}
271 272 273 274 275 276 277 278
# 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
279
path_tmp = $${directory:tmp}/
280
nginx_prefix = $${buildout:directory}
281 282 283
# Config files
path_nginx_conf = $${directory:etc}/nginx.conf
# Executables
284
bin_nginx = ${nginx-webdav:location}/sbin/nginx
285
bin_launcher = $${directory:bin}/launcher
286 287
# Utils
path_shell = ${dash:location}/bin/dash
288 289
# Misc.
etc_dir = $${directory:etc}
290
work_dir = $${slaprunner:working-directory}
291 292 293 294 295 296

[nginx_conf]
recipe = slapos.recipe.template:jinja2
template = ${template_nginx_conf:location}/${template_nginx_conf:filename}
rendered = $${nginx-frontend:path_nginx_conf}
context =
297
    key shellinabox_port shellinabox:port
298
    key socket gunicorn:socket
299 300 301 302 303 304 305 306 307 308 309
    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

310 311 312 313 314 315 316 317 318 319 320 321 322
[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}
323
var_dir = $${directory:var}
324
project_folder = $${directory:project}
325
project_private_folder = $${runnerdirectory:private-project}
326
project_public_folder = $${runnerdirectory:public-project}
327
runner_home = $${runnerdirectory:home}
328
git_http_backend = ${git:location}/libexec/git-core/git-http-backend
329
cgi_httpd_conf = $${monitor-httpd-configuration-file:rendered}
330
httpd_cors_file = $${monitor-httpd-cors:location}
331 332 333 334 335

[httpd-conf]
recipe = slapos.recipe.template:jinja2
template = ${template_httpd_conf:location}/${template_httpd_conf:filename}
rendered = $${directory:etc}/httpd.conf
336
context =
337 338 339
    section parameters httpd-parameters

[cgi-httpd-wrapper]
340 341 342
recipe = slapos.cookbook:wrapper
apache-executable = ${apache:location}/bin/httpd
wrapper-path = $${ca-httpd:executable}
343 344
command-line = $${:apache-executable} -f $${httpd-conf:rendered} -DFOREGROUND

345 346 347 348
#--------------------
#--
#-- WSGI

349
[gunicorn]
350 351 352 353 354 355 356 357
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
358 359
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 
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 366

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

370
#--------------------
371
#--
372
#-- ssl certificates
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397

[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
398 399
executable = $${nginx-launcher:rendered}
wrapper = $${directory:services}/nginx-frontend
400 401 402
# Put domain name
name = example.com

403 404 405 406 407
[ca-shellinabox]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
executable = $${shellinabox:wrapper}
wrapper = $${directory:services}/shellinaboxd
408 409
key-file = $${cadirectory:certs}/shellinabox.key
cert-file = $${cadirectory:certs}/shellinabox.crt
410
#--------------------
411 412
#--
#-- Request frontend
413

414 415
[request-frontend]
<= slap-connection
416
recipe = slapos.cookbook:requestoptional
417
name = SlapRunner Frontend
418 419 420
# 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
421
config-url = $${slaprunner:access-url}
422
config-domain = $${slap-parameter:frontend-domain}
423
return = site_url domain
424

425 426 427 428 429 430 431
[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
432
config-url = https://[$${monitor-httpd-configuration:listening-ip}]:$${monitor-parameters:port}
433 434 435
config-domain = $${slap-parameter:frontend-domain}
return = site_url domain

436
#--------------------------------------
437 438
#--
#-- Send informations to SlapOS Master
439

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

454 455 456
#---------------------------
#--
#-- Deploy promises scripts
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
457

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

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

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

478 479 480 481 482 483
[shellinabox-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/shellinabox
hostname = $${shellinabox:ipv6}
port = $${shellinabox:port}

484 485
[symlinks]
recipe = cns.recipe.symlink
486
symlink_target = $${directory:bin}
487
symlink_base = ${buildout:directory}/bin
488 489 490

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

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

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

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

524 525
[shellinabox]
recipe = slapos.cookbook:shellinabox
526
ipv6 = $${slap-network-information:global-ipv6}
527
port = 8949
528
shell = $${shell:wrapper}
529
wrapper = $${directory:bin}/shellinaboxd
530
shellinabox-binary = ${shellinabox:location}/bin/shellinaboxd
531
password = $${zero-parameters:shell-password}
532
directory = $${runnerdirectory:home}
533
login-shell = $${directory:bin}/login
534 535 536
certificate-directory = $${cadirectory:certs}
cert-file = $${ca-shellinabox:cert-file}
key-file = $${ca-shellinabox:key-file}
537

538 539 540
[shellinabox-code]
recipe = slapos.cookbook:generate.password
storage-path = $${directory:etc}/.scode
541
bytes = 8
542 543 544 545 546 547

[shell]
recipe = slapos.cookbook:shell
wrapper = $${directory:bin}/sh
shell = ${bash:location}/bin/bash
home = $${runnerdirectory:home}
548
path = $${environ:PATH}:${nano:location}/bin:${vim:location}/bin:${screen:location}/bin:${git:location}/bin
549 550
ps1 = "\\w> "

551 552 553
[environ]
recipe = collective.recipe.environment

554 555 556 557 558 559 560 561 562 563
[slapos-repo]
recipe = slapos.recipe.build:gitclone
repository = $${slap-parameter:slapos-repository}
git-executable = ${git:location}/bin/git
develop = true
location = $${directory:project}/slapos

[slapos-repo-config]
recipe = plone.recipe.command
stop-on-error = true
564 565
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
update-command = true
566 567 568

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

572 573 574 575 576 577 578
[cron-entry-prepare-software]
<= cron
recipe = slapos.cookbook:cron.d
name = prepare-software
frequency = */2 * * * *
command = $${prepare-software:wrapper-path}

579 580 581
[instance-parameters]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
582
template = ${template-parameters:location}/${template-parameters:filename}
583 584
rendered = $${directory:etc}/.parameter.xml.default
mode = 0644
585
context =
586 587 588 589 590 591 592 593
  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

594 595 596 597 598 599 600
[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

601 602 603 604 605 606 607 608
[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}

609 610
[public]
shell-password = $${shellinabox-code:passwd}
611 612
recovery-code = $${recovery-code:passwd}

613
[zero-parameters]
614 615


616 617 618 619 620 621
[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

622
[bash-profile]
623 624 625 626 627 628
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
629

630
[supervisord]
631
autorestart = false
632 633 634 635
autostart = false
directory = $${buildout:directory}
exitcodes = 0
logfile = $${directory:log}/supervisord.log
636
no_logfile = NONE
637 638 639
numprocs = 1
path = $${environ:PATH}
pidfile = $${directory:run}/supervisord.pid
640 641
server = $${slaprunner:ipv4}:$${:port}
port = 39986
642
slapgrid-cp = slapgrid-cp
643
slapgrid-cp-command = $${slaprunner:slapos} node instance --all --cfg $${:slapos-cfg} --pidfile $${:slapgrid-cp-pid} --verbose --logfile $${:slapgrid-cp-log}
644 645
slapgrid-cp-log = $${runnerdirectory:home}/instance.log
slapgrid-cp-pid = $${directory:run}/slapgrid-cp.pid
646
slapgrid-cp-startretries = 0
647
slapgrid-sr = slapgrid-sr
648
slapgrid-sr-command = $${slaprunner:slapos} node software --all --cfg $${:slapos-cfg} --pidfile $${:slapgrid-sr-pid} --verbose --logfile $${:slapgrid-sr-log}
649 650
slapgrid-sr-log = $${runnerdirectory:home}/software.log
slapgrid-sr-pid = $${directory:run}/slapgrid-sr.pid
651
slapgrid-sr-startretries = 0
652 653 654
slapproxy = slapproxy
slapproxy-autorestart = true
slapproxy-autostart = true
655
slapproxy-startsecs = 1
656
slapproxy-command = $${slaprunner:slapos} proxy start --logfile $${:slapproxy-log} --cfg $${:slapos-cfg}
657
slapproxy-log = $${directory:log}/slapproxy.log
658 659
socket_name = unix://$${:socket_path}
socket_path = $${directory:tmp}/supervisord.sock
660
startsecs = 0
661 662 663
# 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
664
slapos-cfg = $${slaprunner:slapos.cfg}
665 666 667 668 669 670

[supervisord-conf]
recipe = slapos.recipe.template:jinja2
template = ${template-supervisord:location}/${template-supervisord:filename}
rendered = $${directory:etc}/supervisord.conf
context =
671 672
    import multiprocessing multiprocessing
    import builtin __builtin__
673
    section supervisord supervisord
674
    key slapparameter_dict slap-configuration:configuration
675 676 677 678 679 680 681 682 683 684
    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
685
    raw python_executable ${buildout:directory}/bin/${extra-eggs:interpreter}
686 687 688 689 690 691

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

692 693 694 695 696 697
[supervisord-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/supervisord
hostname = $${slaprunner:ipv4}
port = $${supervisord:port}

698 699 700
[monitor-current-log-access]
< = monitor-directory-access
source = $${directory:log}
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722

[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

[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