Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable ingress notebook access #219

Merged
merged 2 commits into from
Jul 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion paddlecloud/notebook/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,20 @@ class UserNotebook():
"name": "cloud-notebook",
"image": settings.PADDLE_BOOK_IMAGE,
"command": ["sh", "-c",
"mkdir -p /root/.jupyter; echo \"c.NotebookApp.base_url = '/notebook/%s'\" > /root/.jupyter/jupyter_notebook_config.py; jupyter notebook --debug --ip=0.0.0.0 --no-browser --allow-root --NotebookApp.token='' --NotebookApp.disable_check_xsrf=True /book/"],
"mkdir -p /root/.jupyter; echo \"c.NotebookApp.base_url = '/notebook/%s'\" > /root/.jupyter/jupyter_notebook_config.py; echo \"c.NotebookApp.allow_origin = '*'\" >> /root/.jupyter/jupyter_notebook_config.py; jupyter notebook --ip=0.0.0.0 --no-browser --allow-root --NotebookApp.token='' --NotebookApp.disable_check_xsrf=True /book/"],
"ports": [{
"containerPort": settings.PADDLE_BOOK_PORT
}],
"resources": {
"requests": {
"memory": "4Gi",
"cpu": "1",
},
"limits": {
"memory": "4Gi",
"cpu": "1",
}
},
"env" : [
{"name": "USER_NAMESPACE", "valueFrom": {"fieldRef": {"fieldPath": "metadata.namespace"}}},
{"name": "USER_POD_NAME", "valueFrom": {"fieldRef": {"fieldPath": "metadata.name"}}},
Expand Down
9 changes: 3 additions & 6 deletions paddlecloud/paddlecloud/templates/site_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

{% block nav %}
{% get_user_notebook_status request.user as status %}
{% if request.user.is_authenticated %}
<ul class="nav navbar-nav">
<li><a href="/notedash">MyNoteBook
{% if request.user.is_authenticated %}
<li><a href="/notedash">我的NoteBook
{% if status == "running" %}
<span class="label label-success">{{ status }}</span>
{% elif status == "starting" %}
Expand All @@ -19,12 +19,9 @@
{% elif status == "unknown" %}
<span class="label label-default">{{ status }}</span>
{% endif %}
{% endif %}
</a></li>
<li>

</li>
</ul>
{% endif %}
{% endblock %}

{% block styles %}
Expand Down