instance.cfg.in 5.14 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
[buildout]
parts =
  instance
  publish-connection-parameter
## Monitoring part XXX whe should not have to specify all parts like this
## Parts to add for monitoring
  certificate-authority
  cron
  cron-entry-monitor
  cron-entry-rss
  deploy-index
  deploy-settings-cgi
  deploy-status-cgi
  deploy-status-history-cgi
  setup-static-files
  certificate-authority
  zero-parameters
  public-symlink
  cgi-httpd-wrapper
  cgi-httpd-graceful-wrapper
  monitor-promise
  monitor-instance-log-access
## Monitor for ipython
  monitor-current-log-access
  monitor-deploy-set-password-cgi
Ayush Tiwari's avatar
Ayush Tiwari committed
26 27 28
  erp5-kernel
  kernel-json
  custom-js
29 30 31 32 33 34 35 36

extends = {{ monitor_template }}

eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true

[slapconfiguration]
37
recipe = slapos.cookbook:slapconfiguration.serialised
38 39 40 41 42 43
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}

44 45 46 47
# ERP5 URL to use in Jupyter by default
# default value is empty - which means no default ERP5 URL
configuration.erp5-url =

48 49 50 51 52 53 54 55
[instance-parameter]
port = 8888
host = ${slapconfiguration:ipv6-random}
cert_file = ${generate-certificate:cert_file}
key_file = ${generate-certificate:key_file}
logfile = ${directory:log}/ipython_notebook.log
notebook_dir = ${directory:notebook_dir}

56 57 58 59
[dynamic-jinja2-template-base]
recipe = slapos.recipe.template:jinja2
mode = 0644

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
[generate-certificate]
; TODO: there is a slapos recipe to generate certificates. Use it instead
recipe = plone.recipe.command
command =
  if [ ! -e ${instance-parameter:key_file} ]
  then
    {{ openssl_output }} req -x509 -nodes -days 3650 \
      -subj "/C=AA/ST=X/L=X/O=Dis/CN=${instance-parameter:host}" \
      -newkey rsa:1024 -keyout ${instance-parameter:key_file} \
      -out ${instance-parameter:cert_file}
  fi
update-command = ${:command}
cert_file = ${directory:etc}/ipython_notebook_cert.crt
key_file = ${directory:etc}/ipython_notebook_cert.key

[instance]
recipe = slapos.cookbook:wrapper
command-line =
  {{ bin_directory }}/ipython notebook
  --no-browser
  --ip=${instance-parameter:host}
  --port=${instance-parameter:port}
  --port-retries=0
  --certfile=${instance-parameter:cert_file}
  --keyfile=${instance-parameter:key_file}
  --notebook-dir=${instance-parameter:notebook_dir}
  --logfile=${instance-parameter:logfile}
  --config=${ipython-notebook-config:rendered}
88 89 90
# Add 'log-level' alias to 'DEBUG' so as to log requests being done while running
# of service ipython_notebook.
  --log-level="DEBUG"
91 92
wrapper-path = ${directory:service}/ipython_notebook
parameters-extra = true
93 94
# Explicitly define IPython Directory to be used while starting ipython notebook
environment = IPYTHONDIR=${directory:ipython_dir}
95 96

[ipython-notebook-config]
97
<= dynamic-jinja2-template-base
98 99 100 101 102 103 104 105 106 107 108
template = {{ ipython_notebook_config_location }}/{{ ipython_notebook_config_filename }}
rendered = ${directory:etc}/ipython_notebook_config.py
mode = 0744
context =
  raw config_cfg ${buildout:directory}/knowledge0.cfg

[monitor-current-log-access]
< = monitor-directory-access
source = ${instance-parameter:logfile}

[monitor-deploy-set-password-cgi]
109
<= dynamic-jinja2-template-base
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
template = {{ ipython_notebook_set_password_location }}/{{ ipython_notebook_set_password_filename }}
rendered = ${monitor-directory:knowledge0-cgi}/${:filename}
filename = ipython-notebook-password.cgi
mode = 0744
context =
  raw config_cfg ${buildout:directory}/knowledge0.cfg
  raw python_executable {{ bin_directory }}/ipython
  key pwd monitor-directory:knowledge0-cgi
  key this_file :filename
  key httpd_graceful cgi-httpd-graceful-wrapper:rendered

[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc
var = ${:home}/var
script = ${:etc}/run/
service = ${:etc}/service
promise = ${:etc}/promise/
log = ${:var}/log
notebook_dir = ${:var}/notebooks
131 132 133
# Add folders to explicitly define ipython directory
ipython_dir = ${:home}/ipython
ipython_kernel_dir = ${:ipython_dir}/kernels
Ayush Tiwari's avatar
Ayush Tiwari committed
134
erp5_kernel_dir = ${:ipython_kernel_dir}/ERP5
135 136

[publish-connection-parameter]
137
recipe = slapos.cookbook:publish.serialised
138 139
url = https://[${instance-parameter:host}]:${instance-parameter:port}
monitor_url = ${monitor-parameters:url}
Ayush Tiwari's avatar
Ayush Tiwari committed
140 141 142 143 144 145 146 147

[erp5-kernel]
<= dynamic-jinja2-template-base
template = {{ erp5_kernel_location }}/{{ erp5_kernel_filename }}
rendered = ${directory:erp5_kernel_dir}/ERP5kernel.py
# Use ipython as executable python as we'll be needing requests library in kernel
context =
  raw python_executable {{ bin_directory }}/ipython
148
  key erp5_url slapconfiguration:configuration.erp5-url
Ayush Tiwari's avatar
Ayush Tiwari committed
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165

[kernel-json]
<= dynamic-jinja2-template-base
template = {{ kernel_json_location }}/{{ kernel_json_filename }}
rendered = ${directory:erp5_kernel_dir}/kernel.json
# Use python2.7 executable bin file for kernel config
context =
  raw python_executable {{ python_executable }}
  key kernel_dir erp5-kernel:rendered
  raw display_name ERP5
  raw language_name python

[custom-js]
<= dynamic-jinja2-template-base
template = {{ custom_js_location }}/{{ custom_js_filename }}
rendered = ${directory:ipython_dir}/profile_default/static/custom/custom.js
mode = 0744