instance.cfg.in 4.84 KB
Newer Older
1 2 3
[buildout]
parts =
  instance
4
  jupyter_notebook
5
  read-knowledge0
6
  publish-connection-parameter
7
  jupyter-notebook-config
Ayush Tiwari's avatar
Ayush Tiwari committed
8 9 10
  erp5-kernel
  kernel-json
  custom-js
11 12 13
  monitor-base
extends =
  {{ monitor_template_rendered }}/template-monitor.cfg
14 15 16 17 18 19 20


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

[slapconfiguration]
21
recipe = slapos.cookbook:slapconfiguration.serialised
22 23 24 25 26 27
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}

28 29 30 31
# ERP5 URL to use in Jupyter by default
# default value is empty - which means no default ERP5 URL
configuration.erp5-url =

32 33 34 35 36
[instance-parameter]
port = 8888
host = ${slapconfiguration:ipv6-random}
cert_file = ${generate-certificate:cert_file}
key_file = ${generate-certificate:key_file}
37
logfile = ${directory:log}/jupyter_notebook.log
38 39
notebook_dir = ${directory:notebook_dir}

40 41 42 43
[dynamic-jinja2-template-base]
recipe = slapos.recipe.template:jinja2
mode = 0644

44 45 46 47 48 49 50 51 52 53 54 55
[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}
56 57
cert_file = ${directory:etc}/jupyter_cert.crt
key_file = ${directory:etc}/jupyter_cert.key
58 59 60 61

[instance]
recipe = slapos.cookbook:wrapper
command-line =
Iliya Manolov's avatar
Iliya Manolov committed
62
  {{ bin_directory }}/jupyter-lab
63 64 65 66 67 68 69
  --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}
70
  --log-level="DEBUG"
Iliya Manolov's avatar
Iliya Manolov committed
71
wrapper-path = ${directory:service}/jupyter-lab
72
parameters-extra = true
73
environment =
74 75 76
  JUPYTER_PATH=${directory:jupyter_dir}
  JUPYTER_CONFIG_DIR=${directory:jupyter_config_dir}
  JUPYTER_RUNTIME_DIR=${directory:jupyter_runtime_dir}
77
  LANG=C.UTF-8
78

79
[jupyter-notebook-config]
80
<= dynamic-jinja2-template-base
81 82
template = {{ jupyter_config_location }}/{{ jupyter_config_filename }}
rendered = ${directory:jupyter_config_dir}/jupyter_notebook_config.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96
mode = 0744
context =
  raw config_cfg ${buildout:directory}/knowledge0.cfg

[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
97 98 99 100 101 102
# Add folders to explicitly define jupyter directory
jupyter_dir = ${:home}/jupyter
jupyter_config_dir = ${:jupyter_dir}/etc
jupyter_kernel_dir = ${:jupyter_dir}/kernels
jupyter_runtime_dir = ${:jupyter_dir}/runtime
jupyter_custom_dir = ${:jupyter_config_dir}/custom
103
jupyter_nbextensions_dir = ${:jupyter_dir}/nbextensions
104 105 106
erp5_kernel_dir = ${:jupyter_kernel_dir}/ERP5

[jupyter_notebook]
107 108 109 110 111 112 113 114 115
# This part is called like this because knowledge0.write uses the part name for
# the section name in the config file.
recipe = slapos.cookbook:zero-knowledge.write
password = 
filename = knowledge0.cfg

[read-knowledge0]
recipe = slapos.cookbook:zero-knowledge.read
filename = knowledge0.cfg
116
password =
117 118 119 120 121 122 123 124 125 126

[monitor-instance-parameter]
monitor-base-url = ${monitor-frontend-promise:url}
# In case you're using a developer instance you should edit these in:
# monitor-base-url = ${monitor-httpd-conf-parameter:url}
# cors-domains = softinstXXXXX.host.vifib.net (or equivalent)
# interface-url = https://softinstXXXXX.host.vifib.net/erp5/web_site_module/monitoring_rjs_unsafe
instance-configuration =
  raw jupyter-password ${read-knowledge0:password}

127
[publish-connection-parameter]
128
recipe = slapos.cookbook:publish.serialised
Iliya Manolov's avatar
Iliya Manolov committed
129
jupyter-classic-url = https://[${instance-parameter:host}]:${instance-parameter:port}/tree
130
url = ${:jupyter-classic-url}
Iliya Manolov's avatar
Iliya Manolov committed
131
jupyterlab-url = https://[${instance-parameter:host}]:${instance-parameter:port}/lab
Ayush Tiwari's avatar
Ayush Tiwari committed
132 133

[erp5-kernel]
134 135 136
recipe = slapos.cookbook:symbolic.link
link-binary = {{ erp5_kernel_location }}/{{ erp5_kernel_filename }}
target-directory = ${directory:erp5_kernel_dir}
Ayush Tiwari's avatar
Ayush Tiwari committed
137 138 139 140 141 142 143 144

[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 }}
145 146
  raw kernel_dir ${erp5-kernel:target-directory}/{{ erp5_kernel_filename }}
  key erp5_url slapconfiguration:configuration.erp5-url 
Ayush Tiwari's avatar
Ayush Tiwari committed
147 148 149 150
  raw display_name ERP5
  raw language_name python

[custom-js]
151 152 153
recipe = slapos.cookbook:symbolic.link
target-directory = ${directory:jupyter_custom_dir}
link-binary = {{ custom_js_location }}/custom.js
154