instance-runner.cfg 25 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
  slaprunner-promise
  slaprunner-frontend-promise
16
  slaprunner-supervisord-wrapper
17
  dropbear-promise
18
  runtestsuite
19
  shellinabox-promise
20
  symlinks
21
  shellinabox
22
  slapos-cfg
23
  slapos-repo
24
  cron-entry-prepare-software
25
  deploy-instance-parameters
26
  instance-software
27
  instance-software-type
28
  minishell-cwd
29
  bash-profile
30
  supervisord-wrapper
31
  supervisord-promise
32 33 34
{% if slapparameter_dict.get('custom-frontend-backend-url') %}
  custom-frontend-promise
{% endif %}
35
## Monitoring part
36
###Parts to add for monitoring
37
  cron
38 39 40
  certificate-authority
  cron-entry-monitor
  cron-entry-rss
41 42 43
  deploy-index
  deploy-settings-cgi
  deploy-status-cgi
44
  deploy-status-history-cgi
45
  setup-static-files
46 47
  certificate-authority
  zero-parameters
48
  public-symlink
49 50 51 52 53 54
  cgi-httpd-wrapper
  cgi-httpd-graceful-wrapper
  monitor-promise
  monitor-instance-log-access
## Monitor for runner
  monitor-current-log-access
55
  monitor-deploy-cors-domain-cgi
56
  monitor-check-webrunner-internal-instance
57 58

extends = ${monitor-template:output}
59 60 61 62 63

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

64 65 66 67 68 69 70
{% 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]
71
recipe = slapos.cookbook:requestoptional
72 73 74 75 76
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

77 78 79 80 81
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}
82

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

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

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

[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 112 113 114 115 116
home = $${buildout:directory}
etc = $${:home}/etc/
var = $${:home}/var/
srv = $${:home}/srv/
bin = $${:home}/bin/
tmp = $${:home}/tmp/
117

118 119 120 121 122 123 124 125 126
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/
127
nginx-data = $${:srv}/nginx
128
ca-dir = $${:srv}/ssl
129
project = $${:srv}/runner/project
130 131 132

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

146 147
#Create password recovery code for slaprunner
[recovery-code]
148
recipe = slapos.cookbook:generate.password
149
storage-path = $${directory:etc}/.rcode
150
bytes = 8
151

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

196 197 198 199 200 201 202 203 204 205 206

#---------------------------
#--
#-- 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


207 208
[test-runner]
<= slaprunner
209
slapos.cfg = $${directory:etc}/slapos-test.cfg
210 211
working-directory = $${runnerdirectory:test}
project-directory = $${runnerdirectory:project-test}
212 213
software_root = $${runnerdirectory:software-test}
instance_root = $${runnerdirectory:instance-test}
214
proxy_port = 8602
215
etc_dir = $${directory:test}
216 217
autorun = False
auto_deploy = True
218

219 220 221
[runtestsuite]
recipe = slapos.cookbook:wrapper
command-line = ${buildout:directory}/bin/slaprunnertest
222
wrapper-path = $${directory:bin}/runTestSuite
223
environment = RUNNER_CONFIG=$${slapos-cfg:rendered}
224 225 226 227 228 229

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

231 232 233 234
[sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = $${sshkeys-directory:requests}
keys-directory = $${sshkeys-directory:keys}
235
wrapper = $${directory:services}/sshkeys_authority
236 237
keygen-binary = ${dropbear:location}/bin/dropbearkey

238
[dropbear-runner-server]
239 240
recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6}
241
port = 22222
242
home = $${buildout:directory}
243 244
wrapper = $${directory:bin}/runner_sshd
shell = ${bash:location}/bin/bash
245 246 247
rsa-keyfile = $${directory:ssh}/server_key.rsa
dropbear-binary = ${dropbear:location}/sbin/dropbear

248
[sshkeys-dropbear-runner]
249 250 251 252
<= sshkeys-authority
recipe = slapos.cookbook:sshkeys_authority.request
name = dropbear
type = rsa
253 254 255 256
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
257 258

[dropbear-server-add-authorized-key]
259
<= dropbear-runner-server
260
recipe = slapos.cookbook:dropbear.add_authorized_key
261
key = $${slap-parameter:user-authorized-key}
262

263
#---------------------------
264
#--
265 266
#-- Set nginx frontend

267 268 269 270 271 272 273 274 275 276 277 278
[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
279 280 281
local-ip = $${slap-network-information:local-ipv4}
global-ip = $${slap-network-information:global-ipv6}
global-port = $${slaprunner:runner_port}
282
# Backend
283 284
runner-ip = $${slaprunner:ipv4}
runner-port = $${slaprunner:runner_port}
285 286 287 288 289 290 291 292
# 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
293
path_tmp = $${directory:tmp}/
294
nginx_prefix = $${buildout:directory}
295 296 297
# Config files
path_nginx_conf = $${directory:etc}/nginx.conf
# Executables
298
bin_nginx = ${nginx-webdav:location}/sbin/nginx
299
bin_launcher = $${directory:bin}/launcher
300 301
# Utils
path_shell = ${dash:location}/bin/dash
302 303
# Misc.
etc_dir = $${directory:etc}
304
work_dir = $${slaprunner:working-directory}
305 306 307 308 309 310

[nginx_conf]
recipe = slapos.recipe.template:jinja2
template = ${template_nginx_conf:location}/${template_nginx_conf:filename}
rendered = $${nginx-frontend:path_nginx_conf}
context =
311
    key shellinabox_port shellinabox:port
312
    key socket gunicorn:socket
313 314 315 316 317 318 319 320 321 322 323
    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

324 325 326 327 328 329 330 331 332 333 334 335 336
[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}
337
var_dir = $${directory:var}
338
project_folder = $${directory:project}
339
project_private_folder = $${runnerdirectory:private-project}
340
project_public_folder = $${runnerdirectory:public-project}
341
runner_home = $${runnerdirectory:home}
342
git_http_backend = ${git:location}/libexec/git-core/git-http-backend
343
cgi_httpd_conf = $${monitor-httpd-configuration-file:rendered}
344
httpd_cors_file = $${monitor-httpd-cors:location}
345 346 347 348 349

[httpd-conf]
recipe = slapos.recipe.template:jinja2
template = ${template_httpd_conf:location}/${template_httpd_conf:filename}
rendered = $${directory:etc}/httpd.conf
350
context =
351 352 353
    section parameters httpd-parameters

[cgi-httpd-wrapper]
354 355 356
recipe = slapos.cookbook:wrapper
apache-executable = ${apache:location}/bin/httpd
wrapper-path = $${ca-httpd:executable}
357 358
command-line = $${:apache-executable} -f $${httpd-conf:rendered} -DFOREGROUND

359 360 361 362
#--------------------
#--
#-- WSGI

363
[gunicorn]
364 365 366 367 368 369 370 371
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
372
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
373
error-log-file = gunicorn-error.log
374
wrapper-path = $${gunicorn:bin_launcher}
375
environment = PATH=$${environ:PATH}:${git:location}/bin/
376
  RUNNER_CONFIG=$${slaprunner:slapos.cfg}
377
  LANG=en_GB.UTF-8
378 379 380

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

384
#--------------------
385
#--
386
#-- ssl certificates
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411

[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
412 413
executable = $${nginx-launcher:rendered}
wrapper = $${directory:services}/nginx-frontend
414 415 416
# Put domain name
name = example.com

417 418 419 420 421
[ca-shellinabox]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
executable = $${shellinabox:wrapper}
wrapper = $${directory:services}/shellinaboxd
422 423
key-file = $${cadirectory:certs}/shellinabox.key
cert-file = $${cadirectory:certs}/shellinabox.crt
424
#--------------------
425 426
#--
#-- Request frontend
427

428 429
[request-frontend]
<= slap-connection
430
recipe = slapos.cookbook:requestoptional
431
name = SlapRunner Frontend
432 433 434
# 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
435
config-url = $${slaprunner:access-url}
436
config-domain = $${slap-parameter:frontend-domain}
437
return = site_url domain
438

439 440 441 442 443 444 445
[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
446
config-url = https://[$${monitor-httpd-configuration:listening-ip}]:$${monitor-parameters:port}
447 448 449
config-domain = $${slap-parameter:frontend-domain}
return = site_url domain

450
#--------------------------------------
451 452
#--
#-- Send informations to SlapOS Master
453

454 455
[publish-connection-informations]
recipe = slapos.cookbook:publish
456
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.
457
2_info = In order to set up your account, get the recovery-code from the monitoring interface. Before read the notification on monitor_info.
458
backend_url = $${slaprunner:access-url}
459
access_url = $${:url}/login
460
url =  https://$${request-frontend:connection-domain}
461
ssh_command = ssh $${dropbear-runner-server:host} -p $${dropbear-runner-server:port}
462
monitor_url = https://$${monitor-frontend:connection-domain}
463
monitor_backend_url = https://[$${monitor-httpd-configuration:listening-ip}]:$${monitor-parameters:port}
464 465
webdav_url = $${:monitor_url}/share/
public_url =  $${:monitor_url}/public/
466 467
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/
468

469 470 471
#---------------------------
#--
#-- Deploy promises scripts
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
472

473 474
[slaprunner-promise]
recipe = slapos.cookbook:check_port_listening
475
path = $${directory:promises}/slaprunner
476 477
hostname = $${slaprunner:ipv6}
port = $${slaprunner:runner_port}
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
478

479
[slaprunner-frontend-promise]
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
480
recipe = slapos.cookbook:check_url_available
481
path = $${directory:promises}/slaprunner_frontend
482
url = https://$${request-frontend:connection-domain}/login
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
483 484
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl
485
check-secure = 1
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
486

487 488
[dropbear-promise]
recipe = slapos.cookbook:check_port_listening
489
path = $${directory:promises}/dropbear
490 491
hostname = $${dropbear-runner-server:host}
port = $${dropbear-runner-server:port}
492

493 494 495 496 497 498
[shellinabox-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/shellinabox
hostname = $${shellinabox:ipv6}
port = $${shellinabox:port}

499 500
[symlinks]
recipe = cns.recipe.symlink
501
symlink_target = $${directory:bin}
502
symlink_base = ${buildout:directory}/bin
503 504 505

[slap-parameter]
# Default value if no ssh key is specified
506
user-authorized-key =
507
# Default value of instances number in slaprunner
508
instance-amount = 10
509 510
debug = false
frontend-domain =
511 512
slapos-repository = http://git.erp5.org/repos/slapos.git
slapos-software =
513
slapos-software-type =
514
slapos-reference = master
515
auto-deploy = false
516
auto-deploy-instance = true
517
autorun = false
518
monitor-port = 9684
519 520 521

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

523 524
[slapos-cfg]
recipe = slapos.recipe.template:jinja2
525
template = ${template-slapos-cfg:location}/${template-slapos-cfg:filename}
526 527 528
rendered = $${slaprunner:slapos.cfg}
mode = 700
context =
529
  section slaprunner slaprunner
530

531 532
[slapos-test-cfg]
recipe = slapos.recipe.template:jinja2
533
template = ${template-slapos-cfg:location}/${template-slapos-cfg:filename}
534 535 536 537 538
rendered = $${test-runner:slapos.cfg}
mode = 700
context =
  section slaprunner test-runner

539 540
[shellinabox]
recipe = slapos.cookbook:shellinabox
541
ipv6 = $${slap-network-information:global-ipv6}
542
port = 8949
543
shell = $${shell:wrapper}
544
wrapper = $${directory:bin}/shellinaboxd
545
shellinabox-binary = ${shellinabox:location}/bin/shellinaboxd
546
password = $${zero-parameters:shell-password}
547
directory = $${runnerdirectory:home}
548
login-shell = $${directory:bin}/login
549 550 551
certificate-directory = $${cadirectory:certs}
cert-file = $${ca-shellinabox:cert-file}
key-file = $${ca-shellinabox:key-file}
552

553 554 555
[shellinabox-code]
recipe = slapos.cookbook:generate.password
storage-path = $${directory:etc}/.scode
556
bytes = 8
557 558 559 560 561 562

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

566 567 568
[environ]
recipe = collective.recipe.environment

569 570 571 572 573 574
[slapos-repo]
recipe = slapos.recipe.build:gitclone
repository = $${slap-parameter:slapos-repository}
git-executable = ${git:location}/bin/git
develop = true
location = $${directory:project}/slapos
575
branch = $${slap-parameter:slapos-reference}
576 577 578

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

582 583 584 585 586 587 588
[cron-entry-prepare-software]
<= cron
recipe = slapos.cookbook:cron.d
name = prepare-software
frequency = */2 * * * *
command = $${prepare-software:wrapper-path}

589 590 591
[instance-parameters]
recipe = slapos.recipe.template:jinja2
extensions = jinja2.ext.do
592
template = ${template-parameters:location}/${template-parameters:filename}
593 594
rendered = $${directory:etc}/.parameter.xml.default
mode = 0644
595
context =
596 597 598 599 600 601 602 603
  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

604 605 606 607 608 609 610
[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

611 612 613 614 615
[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

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

624 625
[public]
shell-password = $${shellinabox-code:passwd}
626 627
recovery-code = $${recovery-code:passwd}

628
[zero-parameters]
629 630


631 632 633 634 635 636
[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

637
[bash-profile]
638 639 640 641 642 643
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
644

645 646 647 648 649

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

650
[supervisord]
651
autorestart = false
652 653 654 655
autostart = false
directory = $${buildout:directory}
exitcodes = 0
logfile = $${directory:log}/supervisord.log
656
no_logfile = NONE
657 658 659
numprocs = 1
path = $${environ:PATH}
pidfile = $${directory:run}/supervisord.pid
660 661
server = $${slaprunner:ipv4}:$${:port}
port = 39986
662
slapgrid-cp = slapgrid-cp
663
slapgrid-cp-command = $${slaprunner:slapos} node instance --all --cfg $${:slapos-cfg} --pidfile $${:slapgrid-cp-pid} --verbose --logfile $${:slapgrid-cp-log}
664 665
slapgrid-cp-log = $${runnerdirectory:home}/instance.log
slapgrid-cp-pid = $${directory:run}/slapgrid-cp.pid
666
slapgrid-cp-startretries = 0
667
slapgrid-sr = slapgrid-sr
668
slapgrid-sr-command = $${slaprunner:slapos} node software --all --cfg $${:slapos-cfg} --pidfile $${:slapgrid-sr-pid} --verbose --logfile $${:slapgrid-sr-log}
669 670
slapgrid-sr-log = $${runnerdirectory:home}/software.log
slapgrid-sr-pid = $${directory:run}/slapgrid-sr.pid
671
slapgrid-sr-startretries = 0
672 673 674
slapproxy = slapproxy
slapproxy-autorestart = true
slapproxy-autostart = true
675
slapproxy-startsecs = 1
676
slapproxy-command = $${slaprunner:slapos} proxy start --logfile $${:slapproxy-log} --cfg $${:slapos-cfg}
677
slapproxy-log = $${directory:log}/slapproxy.log
678 679
socket_name = unix://$${:socket_path}
socket_path = $${directory:tmp}/supervisord.sock
680
startsecs = 0
681 682 683
# 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
684
slapos-cfg = $${slaprunner:slapos.cfg}
685 686 687 688 689 690

[supervisord-conf]
recipe = slapos.recipe.template:jinja2
template = ${template-supervisord:location}/${template-supervisord:filename}
rendered = $${directory:etc}/supervisord.conf
context =
691 692
    import multiprocessing multiprocessing
    import builtin __builtin__
693
    section supervisord supervisord
694
    key slapparameter_dict slap-configuration:configuration
695 696 697 698 699 700 701 702 703 704
    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
705
    raw python_executable ${buildout:directory}/bin/${extra-eggs:interpreter}
706 707 708 709 710 711

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

712 713 714 715 716 717
[supervisord-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/supervisord
hostname = $${slaprunner:ipv4}
port = $${supervisord:port}

718

719 720 721
[monitor-current-log-access]
< = monitor-directory-access
source = $${directory:log}
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737

[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

738 739 740 741 742 743 744
[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

745 746 747 748 749 750
[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