Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Iliya Manolov
slapos
Commits
adc48463
Commit
adc48463
authored
Apr 03, 2017
by
Iliya Manolov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated md5sum.
parent
f9707a05
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
109 additions
and
12 deletions
+109
-12
software/ipython_notebook/instance.cfg.in
software/ipython_notebook/instance.cfg.in
+30
-2
software/ipython_notebook/software.cfg
software/ipython_notebook/software.cfg
+14
-3
software/ipython_notebook/template/ipython_notebook_config.py.jinja
...python_notebook/template/ipython_notebook_config.py.jinja
+19
-3
software/ipython_notebook/template/ipython_set_password.cgi.jinja
.../ipython_notebook/template/ipython_set_password.cgi.jinja
+1
-2
software/ipython_notebook/template/jupyter_password_updater.in
...are/ipython_notebook/template/jupyter_password_updater.in
+4
-0
software/ipython_notebook/template/jupyter_password_updater.py.jinja
...ython_notebook/template/jupyter_password_updater.py.jinja
+39
-0
stack/monitor/buildout.cfg
stack/monitor/buildout.cfg
+1
-1
stack/monitor/instance-monitor.cfg.jinja2.in
stack/monitor/instance-monitor.cfg.jinja2.in
+1
-1
No files found.
software/ipython_notebook/instance.cfg.in
View file @
adc48463
[buildout]
parts =
instance
create-knowledge0
read-knowledge0
publish-connection-parameter
erp5-kernel
kernel-json
custom-js
monitor-base
extends =
{{ monitor_template_rendered }}/template-monitor.cfg
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
...
...
@@ -78,6 +82,14 @@ rendered = ${directory:etc}/ipython_notebook_config.py
mode = 0744
context =
raw config_cfg ${buildout:directory}/knowledge0.cfg
# [ipython-notebook-set-password]
# <= dynamic-jinja-template-base
# template = {{ ipython_notebook_config_location }}/{{ ipython_notebook_set_password_filename }}
# rendered = ${directory:etc}/ipython_notebook_set_password.py
# mode = 0744
# context =
# raw config_cfg ${buildout:directory}/knowledge0.cfg
[directory]
recipe = slapos.cookbook:mkdirectory
...
...
@@ -94,8 +106,25 @@ ipython_dir = ${:home}/ipython
ipython_kernel_dir = ${:ipython_dir}/kernels
erp5_kernel_dir = ${:ipython_kernel_dir}/ERP5
[create-knowledge0]
recipe = slapos.cookbook:zero-knowledge.write
filename = knowledge0.cfg
[read-knowledge0]
recipe = slapos.cookbook:zero-knowledge.read
filename = knowledge0.cfg
[monitor-instance-parameter]
monitor-base-url = ${monitor-httpd-conf-parameter:url}
cors-domains = softinst65443.host.vifib.net
interface-url = https://softinst65443.host.vifib.net/erp5/web_site_module/monitoring_rjs_unsafe
instance-configuration =
raw jupyter-password ${read-knowledge0:password}
# raw kek topdeck
[publish-connection-parameter]
recipe = slapos.cookbook:publish.serialised
<= monitor-publish
url = https://[${instance-parameter:host}]:${instance-parameter:port}
[erp5-kernel]
...
...
@@ -123,4 +152,3 @@ context =
template = {{ custom_js_location }}/{{ custom_js_filename }}
rendered = ${directory:ipython_dir}/profile_default/static/custom/custom.js
mode = 0744
software/ipython_notebook/software.cfg
View file @
adc48463
[buildout]
versions = versions
extends =
extends =
../../stack/slapos.cfg
../../component/ipython/buildout.cfg
../../component/scipy/buildout.cfg
../../component/scikit-learn/buildout.cfg
../../component/pandas/buildout.cfg
../../component/openssl/buildout.cfg
../../stack/monitor/buildout.cfg
parts =
slapos-cookbook
ipython-notebook
...
...
@@ -33,7 +34,7 @@ mode = 0644
[ipython-notebook-config]
<= download-file-base
filename = ipython_notebook_config.py.jinja
md5sum = a5bc4ee8539109d1de7ab33b4c2c97ea
# md5sum = 67f71a392b6dbe446290011009b42116
[ipython-notebook-set-password]
<= download-file-base
...
...
@@ -60,7 +61,7 @@ recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg.in
rendered = ${buildout:directory}/template.cfg
mode = 0644
md5sum = 26a28b74c8b18c92108c751b87abe80c
#md5sum = 4a933553588035fb91cfcced08aed576
context =
key bin_directory buildout:bin-directory
key develop_eggs_directory buildout:develop-eggs-directory
...
...
@@ -77,6 +78,16 @@ context =
key kernel_json_filename kernel-json:filename
key custom_js_location custom-js:location
key custom_js_filename custom-js:filename
key monitor_template_rendered buildout:directory
#[instance-jupyter-password-updater]
#recipe = slapos.recipe.template:jinja2
#template = ${:_profile_base_location_}/template/jupyter_password_updater.py.jinja
#rendered = ${monitor-directory:reports}/jupyter_password_updater.py
#mode = 0744
# md5sum =
#context =
# key knowledge0_directory buildout:directory
[versions]
PyRSS2Gen = 1.1
...
...
software/ipython_notebook/template/ipython_notebook_config.py.jinja
View file @
adc48463
```
This script initializes Jupyter's configuration such as passwords and other
things. It is run by IPython hence why it can use functions like get_config().
```
import ConfigParser
import os
knowledge_0 = '{{ config_cfg }}'
if not os.path.exists(knowledge_0):
print "Your software does <b>not</b> embed 0-knowledge. \
This interface is useless in this case</body></html>"
exit(0)
c = get_config()
parser = ConfigParser.ConfigParser()
parser.read(knowledge_0)
if parser.has_option("ipython_notebook", "password"):
c.NotebookApp.password = parser.get("ipython_notebook", "password")
if not parser.has_section("ipython_notebook"):
parser.add_section("ipython_notebook")
if not parser.has_option("ipython_notebook", "password"):
parser.set("ipython_notebook", "password", "abcdefgh")
c.NotebookApp.password = parser.get("ipython_notebook", "password")
with open(knowledge_0, 'w') as file:
parser.write(file)
software/ipython_notebook/template/ipython_set_password.cgi.jinja
View file @
adc48463
...
...
@@ -60,5 +60,4 @@ print """<div class="pure-control-group">
<script
type=
"text/javascript"
src=
"static/jquery-1.10.2.min.js"
></script>
<script
type=
"text/javascript"
src=
"static/monitor-register.js"
></script>
</body></html>
"""
"""
\ No newline at end of file
software/ipython_notebook/template/jupyter_password_updater.in
0 → 100644
View file @
adc48463
#!{{ python_executable }}
import os
knowledge0 =
\ No newline at end of file
software/ipython_notebook/template/jupyter_password_updater.py.jinja
0 → 100644
View file @
adc48463
#!{{ python_executable }}
import os
import time
import calendar
import random
import ConfigParser
knowledge0_dir = '{{ knowledge0_directory }}/knowledge0.cfg'
set_random_password = True
random_password_length = 10
```
def generate_random_password(password_length):
result = ''
for i in range(0, password_length):
result += chr(ord('a')+random.randint(0, 25))
return result
def set_password(newPassword, target):
parser = ConfigParser.ConfigParser()
parser.read(knowledge_0)
parser.set("ipython_notebook", "password", "abcdefgh")
if set_random_password:
newPassword = generate_random_password(random_password_length)
set_password(newPassword, knowledge0_dir)
else:
lastModifiedTime = os.path.getmtime(knowledge0_dir)
currentTime = calendar.timegm(time.gmtime())
timeBetweenUpdates = currentTime - lastModifiedTime
timeDelta = 60
if (timeBetweenUpdates < timeDelta):
newPassword = read_password(knowledge0_dir)
set_password(newPassword, knowledge0_dir)
```
\ No newline at end of file
stack/monitor/buildout.cfg
View file @
adc48463
...
...
@@ -102,7 +102,7 @@ recipe = slapos.recipe.template:jinja2
filename = template-monitor.cfg
template = ${:_profile_base_location_}/instance-monitor.cfg.jinja2.in
rendered = ${buildout:directory}/template-monitor.cfg
md5sum =
be07297494e08377c4dfecb26c2919ef
md5sum =
2b6f160f6324e9e11e3bb03267279691
context =
key apache_location apache:location
key gzip_location gzip:location
...
...
stack/monitor/instance-monitor.cfg.jinja2.in
View file @
adc48463
...
...
@@ -379,7 +379,7 @@ depends =
[monitor-publish]
monitor-base-url = ${publish:monitor-base-url}
monitor-setup-url = ${monitor-instance-parameter:interface-url}/#page=settings_configurator&url=${publish:monitor-url}&username=$
$
{publish:monitor-user}&password=${publish:monitor-password}
monitor-setup-url = ${monitor-instance-parameter:interface-url}/#page=settings_configurator&url=${publish:monitor-url}&username=${publish:monitor-user}&password=${publish:monitor-password}
[buildout]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment