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

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

24 25

# Create all needed directories
26
[directory]
27 28 29 30 31
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
32
tmp = $${buildout:directory}/tmp/
33

34 35 36 37 38 39 40 41 42
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/
43
nginx-data = $${directory:srv}/nginx
44 45
ca-dir = $${:srv}/ssl

46 47 48

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

59 60
#Create password recovery code for slaprunner
[recovery-code]
61
recipe = slapos.cookbook:generate.password
62
storage-path = $${directory:etc}/.rcode
63 64
bytes = 4

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

[slaprunner]
recipe = slapos.cookbook:slaprunner
78 79 80 81 82
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
83
git-binary = ${git:location}/bin/git
84
slapos.cfg = $${directory:etc}/slapos.cfg
85 86 87 88
working-directory = $${runnerdirectory:home}
project-directory = $${runnerdirectory:project}
software-directory = $${runnerdirectory:software-root}
instance-directory = $${runnerdirectory:instance-root}
89 90 91
etc_dir = $${directory:etc}
log_dir =  $${directory:log}
run_dir = $${directory:run}
92 93 94
ssh_client = $${sshkeys-dropbear-runner:wrapper}
public_key = $${sshkeys-dropbear-runner:public-key}
private_key = $${sshkeys-dropbear-runner:private-key}
95 96
ipv4 = $${slap-network-information:local-ipv4}
ipv6 = $${slap-network-information:global-ipv6}
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
97 98
proxy_port = 50000
runner_port = 50000
99
partition-amount = $${slap-parameter:instance-amount}
100
cloud9-url = $${cloud9:access-url}
101
wrapper = $${directory:services}/slaprunner
102
debug = $${slap-parameter:debug}
103

104 105 106 107
[test-runner]
<= slaprunner
recipe = slapos.cookbook:slaprunner.test
slaprunnertest = ${buildout:directory}/bin/slaprunnertest
108
slapos.cfg = $${directory:etc}/slapos-test.cfg
109 110 111 112
working-directory = $${runnerdirectory:test}
project-directory = $${runnerdirectory:project-test}
software-directory = $${runnerdirectory:software-test}
instance-directory = $${runnerdirectory:instance-test}
113
proxy_port = 8602
114 115 116 117 118 119 120 121 122
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/
123

124 125 126 127
[sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = $${sshkeys-directory:requests}
keys-directory = $${sshkeys-directory:keys}
128
wrapper = $${directory:services}/sshkeys_authority
129 130
keygen-binary = ${dropbear:location}/bin/dropbearkey

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

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

[dropbear-server-add-authorized-key]
152
<= dropbear-runner-server
153 154 155 156
recipe = slapos.cookbook:dropbear.add_authorized_key
key = $${slap-parameter:authorized-key}


157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
#----------------
#--
#-- Set nginx as a frontend
[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
ip = $${slap-network-information:global-ipv6}
port = 4443
# 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
190
bin_launcher = $${directory:bin}/launcher
191 192
# Utils
path_shell = ${dash:location}/bin/dash
193 194
# Misc.
etc_dir = $${directory:etc}
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240


[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

#----------------
#--
#-- ssl for nginx

[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
241 242
executable = $${nginx-launcher:rendered}
wrapper = $${directory:services}/nginx-frontend
243 244 245 246 247 248 249
# Put domain name
name = example.com


#----------------
#--
#-- Request frontend
250 251
[request-frontend]
<= slap-connection
252
recipe = slapos.cookbook:requestoptional
253 254 255 256 257 258 259 260 261
name = 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
config = url
config-url = $${slaprunner:access-url}
return = site_url


262 263 264
#----------------
#--
#-- Send informations to SlapOS Master
265 266
[publish-connection-informations]
recipe = slapos.cookbook:publish
267
1_info = Set your passord in slaprunner in order to access cloud9
268 269
backend_url = $${slaprunner:access-url}
url =  $${request-frontend:connection-site_url}
270
cloud9_url = https://[$${nginx-frontend:ip}]:$${nginx-frontend:port}
271
ssh_command = ssh $${dropbear-runner-server:host} -p $${dropbear-runner-server:port}
272
password_recovery_code = $${recovery-code:passwd}
273

Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
274 275

# Deploy promises scripts
276 277
[slaprunner-promise]
recipe = slapos.cookbook:check_port_listening
278
path = $${directory:promises}/slaprunner
279 280
hostname = $${slaprunner:ipv6}
port = $${slaprunner:runner_port}
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
281

282
[slaprunner-frontend-promise]
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
283
recipe = slapos.cookbook:check_url_available
284
path = $${directory:promises}/slaprunner_frontend
Jean-Baptiste Petre's avatar
Jean-Baptiste Petre committed
285 286 287 288
url = $${request-frontend:connection-site_url}
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl

289 290
[cloud9-promise]
recipe = slapos.cookbook:check_url_available
291
path = $${directory:promises}/cloud9
292
url = http://$${cloud9:ip}:$${cloud9:port}
293 294 295 296 297
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl

[dropbear-promise]
recipe = slapos.cookbook:check_port_listening
298
path = $${directory:promises}/dropbear
299 300
hostname = $${dropbear-runner-server:host}
port = $${dropbear-runner-server:port}
301

302 303
[symlinks]
recipe = cns.recipe.symlink
304
symlink_target = $${directory:bin}
305
symlink_base = ${buildout:directory}/bin
306 307 308 309

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