instance-runner.cfg 11.1 KB
Newer Older
1 2
[buildout]
parts =
3 4
  nginx_conf
  nginx-launcher
5
  cloud9
6 7
  certificate-authority
  ca-nginx
8
  ca-node-frontend
9
  slaprunner
10
  test-runner
11
  sshkeys-dropbear-runner
12
  dropbear-server-add-authorized-key
13
  sshkeys-authority
14
  publish-connection-informations
15 16 17 18
  slaprunner-promise
  slaprunner-frontend-promise
  cloud9-promise
  dropbear-promise
19
  symlinks
20 21 22
  request-cloud9-frontend
  node-frontend-promise
  nginx-promise
23 24 25 26 27

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

28 29

# Create all needed directories
30
[directory]
31 32 33 34 35
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
36
tmp = $${buildout:directory}/tmp/
37

38 39 40 41 42 43 44 45 46
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/
47
nginx-data = $${directory:srv}/nginx
48 49
ca-dir = $${:srv}/ssl

50 51 52

[runnerdirectory]
recipe = slapos.cookbook:mkdirectory
53 54
home = $${directory:srv}/runner/
test = $${directory:srv}/test/
55 56 57
project = $${:home}/project
software-root = $${:home}/software
instance-root = $${:home}/instance
58 59 60
project-test = $${:test}/project
software-test = $${:test}/software
instance-test = $${:test}/instance
61
sessions = $${buildout:directory}/.sessions
62

63 64
#Create password recovery code for slaprunner
[recovery-code]
65
recipe = slapos.cookbook:generate.password
66
storage-path = $${directory:etc}/.rcode
67 68
bytes = 4

69 70 71
# Deploy cloud9 and slaprunner
[cloud9]
recipe = slapos.cookbook:cloud9
72
ip = $${slap-network-information:local-ipv4}
73
port = 4443
74
wrapper = $${directory:services}/cloud9
75 76
working-directory = $${runnerdirectory:home}
git-binary = ${git:location}/bin/git
Cédric de Saint Martin's avatar
Cédric de Saint Martin committed
77
node-binary = ${nodejs:location}/bin/node
78
cloud9 = ${cloud9:executable}
79 80 81

[slaprunner]
recipe = slapos.cookbook:slaprunner
82 83 84 85 86
slaprunner = ${buildout:directory}/bin/slaprunner
slapgrid_sr = ${buildout:directory}/bin/slapgrid-sr
slapgrid_cp = ${buildout:directory}/bin/slapgrid-cp
slapproxy = ${buildout:directory}/bin/slapproxy
supervisor = ${buildout:directory}/bin/slapgrid-supervisorctl
87
git-binary = ${git:location}/bin/git
88
slapos.cfg = $${directory:etc}/slapos.cfg
89 90 91 92
working-directory = $${runnerdirectory:home}
project-directory = $${runnerdirectory:project}
software-directory = $${runnerdirectory:software-root}
instance-directory = $${runnerdirectory:instance-root}
93 94 95
etc_dir = $${directory:etc}
log_dir =  $${directory:log}
run_dir = $${directory:run}
96 97 98
ssh_client = $${sshkeys-dropbear-runner:wrapper}
public_key = $${sshkeys-dropbear-runner:public-key}
private_key = $${sshkeys-dropbear-runner:private-key}
99 100
ipv4 = $${slap-network-information:local-ipv4}
ipv6 = $${slap-network-information:global-ipv6}
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
101 102
proxy_port = 50000
runner_port = 50000
103
partition-amount = $${slap-parameter:instance-amount}
104
cloud9-url = $${cloud9:access-url}
105
wrapper = $${directory:services}/slaprunner
106
debug = $${slap-parameter:debug}
107

108 109 110 111
[test-runner]
<= slaprunner
recipe = slapos.cookbook:slaprunner.test
slaprunnertest = ${buildout:directory}/bin/slaprunnertest
112
slapos.cfg = $${directory:etc}/slapos-test.cfg
113 114 115 116
working-directory = $${runnerdirectory:test}
project-directory = $${runnerdirectory:project-test}
software-directory = $${runnerdirectory:software-test}
instance-directory = $${runnerdirectory:instance-test}
117
proxy_port = 8602
118 119 120 121 122 123 124 125 126
wrapper = $${directory:bin}/runTestSuite
etc_dir = $${directory:test}


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

128 129 130 131
[sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = $${sshkeys-directory:requests}
keys-directory = $${sshkeys-directory:keys}
132
wrapper = $${directory:services}/sshkeys_authority
133 134
keygen-binary = ${dropbear:location}/bin/dropbearkey

135
[dropbear-runner-server]
136 137
recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6}
138
port = 22222
139
home = $${directory:ssh}
140 141
wrapper = $${directory:bin}/runner_sshd
shell = ${bash:location}/bin/bash
142 143 144
rsa-keyfile = $${directory:ssh}/server_key.rsa
dropbear-binary = ${dropbear:location}/sbin/dropbear

145
[sshkeys-dropbear-runner]
146 147 148 149
<= sshkeys-authority
recipe = slapos.cookbook:sshkeys_authority.request
name = dropbear
type = rsa
150 151 152 153
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
154 155

[dropbear-server-add-authorized-key]
156
<= dropbear-runner-server
157 158 159
recipe = slapos.cookbook:dropbear.add_authorized_key
key = $${slap-parameter:authorized-key}

160 161 162 163 164 165 166 167 168
#---------------------
#--
#-- Set node frontend

[node-frontend]
launcher = $${directory:bin}/node-frontend
ip = $${slap-network-information:global-ipv6}
port = $${cloud9:port}
access-url = https://[$${:ip}]:$${:port}
169

170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
[node-frontend-launcher]
recipe = slapos.recipe.template:jinja2
template = ${node-frontend-template:location}/${node-frontend-template:filename}
rendered = $${node-frontend:launcher}
mode = 700
context =
	key ip node-frontend:ip
	key port node-frontend:port
	key key ca-node-frontend:key-file
	key certificate ca-node-frontend:cert-file
	key backend_ip nginx-frontend:ip
	key backend_port nginx-frontend:port
	raw shell_path ${bash:location}/bin/bash
	raw node_env ${buildout:parts-directory}:${npm-modules:location}/node_modules
	raw node_path ${nodejs:location}/bin/node
	raw conf_path ${simple-proxy:location}/${simple-proxy:filename}

#---------------------------
188
#--
189 190
#-- Set nginx frontend

191 192 193 194 195 196 197 198 199 200 201 202
[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
203 204
ip = $${slap-network-information:local-ipv4}
port = 30001
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
# Backend
backend-ip = $${cloud9:ip}
backend-port = $${cloud9:port}
# 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
path_tmp = $${buildout:directory}/tmp
# Config files
path_nginx_conf = $${directory:etc}/nginx.conf
# Executables
bin_nginx = ${nginx:location}/sbin/nginx
221
bin_launcher = $${directory:bin}/launcher
222 223
# Utils
path_shell = ${dash:location}/bin/dash
224 225
# Misc.
etc_dir = $${directory:etc}
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243


[nginx_conf]
recipe = slapos.recipe.template:jinja2
template = ${template_nginx_conf:location}/${template_nginx_conf:filename}
rendered = $${nginx-frontend:path_nginx_conf}
context =
    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

244
#--------------------
245
#--
246
#-- ssl certificates
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271

[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
272 273
executable = $${nginx-launcher:rendered}
wrapper = $${directory:services}/nginx-frontend
274 275 276
# Put domain name
name = example.com

277 278 279 280 281 282 283 284 285
[ca-node-frontend]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
key-file = $${cadirectory:certs}/nodejs.key
cert-file = $${cadirectory:certs}/nodejs.crt
executable = $${node-frontend-launcher:rendered}
wrapper = $${directory:services}/node-frontend
# Put domain name
name = example.com
286

287
#--------------------
288 289
#--
#-- Request frontend
290

291 292
[request-frontend]
<= slap-connection
293
recipe = slapos.cookbook:requestoptional
294
name = SlapRunner Frontend
295 296 297 298 299 300 301
# 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
config = url
config-url = $${slaprunner:access-url}
return = site_url

302 303 304 305 306 307 308 309 310 311
[request-cloud9-frontend]
<= slap-connection
recipe = slapos.cookbook:requestoptional
name = Cloud9 Frontend
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
slave = true
config = url https-only
config-url = $${node-frontend:access-url}
config-https-only = true
return = site_url domain
312

313
#--------------------------------------
314 315
#--
#-- Send informations to SlapOS Master
316

317 318
[publish-connection-informations]
recipe = slapos.cookbook:publish
319
1_info = Set your passord in slaprunner in order to access cloud9
320 321
backend_url = $${slaprunner:access-url}
url =  $${request-frontend:connection-site_url}
322 323
cloud9_backend_url = $${node-frontend:access-url}
cloud9_url = https://$${request-cloud9-frontend:connection-domain}
324
ssh_command = ssh $${dropbear-runner-server:host} -p $${dropbear-runner-server:port}
325
password_recovery_code = $${recovery-code:passwd}
326

327 328 329
#---------------------------
#--
#-- Deploy promises scripts
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
330

331 332
[slaprunner-promise]
recipe = slapos.cookbook:check_port_listening
333
path = $${directory:promises}/slaprunner
334 335
hostname = $${slaprunner:ipv6}
port = $${slaprunner:runner_port}
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
336

337
[slaprunner-frontend-promise]
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
338
recipe = slapos.cookbook:check_url_available
339
path = $${directory:promises}/slaprunner_frontend
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
340 341 342 343
url = $${request-frontend:connection-site_url}
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl

344 345
[cloud9-promise]
recipe = slapos.cookbook:check_url_available
346
path = $${directory:promises}/cloud9
347
url = http://$${cloud9:ip}:$${cloud9:port}
348 349 350
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl

351 352 353 354 355 356 357 358 359 360 361 362
[node-frontend-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/node-frontend
hostname = $${node-frontend:ip}
port = $${node-frontend:port}

[nginx-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directory:promises}/nginx
hostname = $${nginx-frontend:ip}
port = $${nginx-frontend:port}

363 364
[dropbear-promise]
recipe = slapos.cookbook:check_port_listening
365
path = $${directory:promises}/dropbear
366 367
hostname = $${dropbear-runner-server:host}
port = $${dropbear-runner-server:port}
368

369 370
[symlinks]
recipe = cns.recipe.symlink
371
symlink_target = $${directory:bin}
372
symlink_base = ${buildout:directory}/bin
373 374 375 376

[slap-parameter]
# Default value if no ssh key is specified
authorized-key =
377
# Default value of instances number in slaprunner
378
instance-amount = 10
379
debug = false