Commit bb1b8844 authored by Ayush Tiwari's avatar Ayush Tiwari

IPython Notebook: Convert instance to jinja2 template

parent 17709531
...@@ -24,97 +24,97 @@ parts = ...@@ -24,97 +24,97 @@ parts =
monitor-current-log-access monitor-current-log-access
monitor-deploy-set-password-cgi monitor-deploy-set-password-cgi
extends = ${monitor-template:output} extends = {{ monitor_template }}
eggs-directory = ${buildout:eggs-directory} eggs-directory = {{ eggs_directory }}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = {{ develop_eggs_directory }}
offline = true offline = true
[slapconfiguration] [slapconfiguration]
recipe = slapos.cookbook:slapconfiguration recipe = slapos.cookbook:slapconfiguration
computer = $${slap_connection:computer_id} computer = ${slap-connection:computer-id}
partition = $${slap_connection:partition_id} partition = ${slap-connection:partition-id}
url = $${slap_connection:server_url} url = ${slap-connection:server-url}
key = $${slap_connection:key_file} key = ${slap-connection:key-file}
cert = $${slap_connection:cert_file} cert = ${slap-connection:cert-file}
[instance-parameter] [instance-parameter]
port = 8888 port = 8888
host = $${slapconfiguration:ipv6-random} host = ${slapconfiguration:ipv6-random}
cert_file = $${generate-certificate:cert_file} cert_file = ${generate-certificate:cert_file}
key_file = $${generate-certificate:key_file} key_file = ${generate-certificate:key_file}
logfile = $${directory:log}/ipython_notebook.log logfile = ${directory:log}/ipython_notebook.log
notebook_dir = $${directory:notebook_dir} notebook_dir = ${directory:notebook_dir}
[generate-certificate] [generate-certificate]
; TODO: there is a slapos recipe to generate certificates. Use it instead ; TODO: there is a slapos recipe to generate certificates. Use it instead
recipe = plone.recipe.command recipe = plone.recipe.command
command = command =
if [ ! -e $${instance-parameter:key_file} ] if [ ! -e ${instance-parameter:key_file} ]
then then
${openssl-output:openssl} req -x509 -nodes -days 3650 \ {{ openssl_output }} req -x509 -nodes -days 3650 \
-subj "/C=AA/ST=X/L=X/O=Dis/CN=$${instance-parameter:host}" \ -subj "/C=AA/ST=X/L=X/O=Dis/CN=${instance-parameter:host}" \
-newkey rsa:1024 -keyout $${instance-parameter:key_file} \ -newkey rsa:1024 -keyout ${instance-parameter:key_file} \
-out $${instance-parameter:cert_file} -out ${instance-parameter:cert_file}
fi fi
update-command = $${:command} update-command = ${:command}
cert_file = $${directory:etc}/ipython_notebook_cert.crt cert_file = ${directory:etc}/ipython_notebook_cert.crt
key_file = $${directory:etc}/ipython_notebook_cert.key key_file = ${directory:etc}/ipython_notebook_cert.key
[instance] [instance]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
command-line = command-line =
${buildout:bin-directory}/ipython notebook {{ bin_directory }}/ipython notebook
--no-browser --no-browser
--matplotlib=inline --matplotlib=inline
--ip=$${instance-parameter:host} --ip=${instance-parameter:host}
--port=$${instance-parameter:port} --port=${instance-parameter:port}
--port-retries=0 --port-retries=0
--certfile=$${instance-parameter:cert_file} --certfile=${instance-parameter:cert_file}
--keyfile=$${instance-parameter:key_file} --keyfile=${instance-parameter:key_file}
--notebook-dir=$${instance-parameter:notebook_dir} --notebook-dir=${instance-parameter:notebook_dir}
--logfile=$${instance-parameter:logfile} --logfile=${instance-parameter:logfile}
--config=$${ipython-notebook-config:rendered} --config=${ipython-notebook-config:rendered}
wrapper-path = $${directory:service}/ipython_notebook wrapper-path = ${directory:service}/ipython_notebook
parameters-extra = true parameters-extra = true
[ipython-notebook-config] [ipython-notebook-config]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${ipython-notebook-config:location}/${ipython-notebook-config:filename} template = {{ ipython_notebook_config_location }}/{{ ipython_notebook_config_filename }}
rendered = $${directory:etc}/ipython_notebook_config.py rendered = ${directory:etc}/ipython_notebook_config.py
mode = 0744 mode = 0744
context = context =
raw config_cfg $${buildout:directory}/knowledge0.cfg raw config_cfg ${buildout:directory}/knowledge0.cfg
[monitor-current-log-access] [monitor-current-log-access]
< = monitor-directory-access < = monitor-directory-access
source = $${instance-parameter:logfile} source = ${instance-parameter:logfile}
[monitor-deploy-set-password-cgi] [monitor-deploy-set-password-cgi]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${ipython-notebook-set-password:location}/${ipython-notebook-set-password:filename} template = {{ ipython_notebook_set_password_location }}/{{ ipython_notebook_set_password_filename }}
rendered = $${monitor-directory:knowledge0-cgi}/$${:filename} rendered = ${monitor-directory:knowledge0-cgi}/${:filename}
filename = ipython-notebook-password.cgi filename = ipython-notebook-password.cgi
mode = 0744 mode = 0744
context = context =
raw config_cfg $${buildout:directory}/knowledge0.cfg raw config_cfg ${buildout:directory}/knowledge0.cfg
raw python_executable ${buildout:bin-directory}/ipython raw python_executable {{ bin_directory }}/ipython
key pwd monitor-directory:knowledge0-cgi key pwd monitor-directory:knowledge0-cgi
key this_file :filename key this_file :filename
key httpd_graceful cgi-httpd-graceful-wrapper:rendered key httpd_graceful cgi-httpd-graceful-wrapper:rendered
[directory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
home = $${buildout:directory} home = ${buildout:directory}
etc = $${:home}/etc etc = ${:home}/etc
var = $${:home}/var var = ${:home}/var
script = $${:etc}/run/ script = ${:etc}/run/
service = $${:etc}/service service = ${:etc}/service
promise = $${:etc}/promise/ promise = ${:etc}/promise/
log = $${:var}/log log = ${:var}/log
notebook_dir = $${:var}/notebooks notebook_dir = ${:var}/notebooks
[publish-connection-parameter] [publish-connection-parameter]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
url = https://[$${instance-parameter:host}]:$${instance-parameter:port} url = https://[${instance-parameter:host}]:${instance-parameter:port}
monitor_url = $${monitor-parameters:url} monitor_url = ${monitor-parameters:url}
...@@ -12,7 +12,6 @@ parts = ...@@ -12,7 +12,6 @@ parts =
monitor-eggs monitor-eggs
slapos-cookbook slapos-cookbook
ipython-notebook ipython-notebook
ipython-notebook-set-password
instance instance
[ipython-notebook] [ipython-notebook]
...@@ -42,12 +41,21 @@ filename = ipython_set_password.cgi.jinja ...@@ -42,12 +41,21 @@ filename = ipython_set_password.cgi.jinja
mode = 0644 mode = 0644
[instance] [instance]
recipe = slapos.recipe.template recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/instance.cfg template = ${:_profile_base_location_}/instance.cfg.in
output = ${buildout:directory}/instance.cfg rendered = ${buildout:directory}/template.cfg
mode = 0644
md5sum = 99100ff6c317f1c4c50be4d0d8be2e31
context =
key bin_directory buildout:bin-directory
key develop_eggs_directory buildout:develop-eggs-directory
key eggs_directory buildout:eggs-directory
key monitor_template monitor-template:output
key openssl_output openssl-output:openssl
key ipython_notebook_config_location ipython-notebook-config:location
key ipython_notebook_config_filename ipython-notebook-config:filename
key ipython_notebook_set_password_location ipython-notebook-set-password:location
key ipython_notebook_set_password_filename ipython-notebook-set-password:filename
[versions] [versions]
PyRSS2Gen = 1.1 PyRSS2Gen = 1.1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment