Skip to content

Commit 091284c

Browse files
authored
Merge pull request #45 from shingo78/feature/jupyterhub-5.2
Upgrade JuyterHub to 5.2
2 parents 1217148 + 2380f5b commit 091284c

9 files changed

Lines changed: 51 additions & 44 deletions

File tree

jupyterhub/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM jupyterhub/jupyterhub:4.0 AS builder
1+
FROM jupyterhub/jupyterhub:5.2 AS builder
22

33
# dev tools
44
RUN apt-get update && \
@@ -43,7 +43,7 @@ RUN python3 -m pip wheel --wheel-dir wheelhouse --constraint requirements \
4343
RUN python3 -m pip wheel --wheel-dir wheelhouse --constraint requirements \
4444
jupyterhub-idle-culler
4545

46-
FROM jupyterhub/jupyterhub:4.0
46+
FROM jupyterhub/jupyterhub:5.2
4747

4848
# dind
4949
RUN apt-get update && \
@@ -58,8 +58,8 @@ RUN apt-get update && \
5858
apt-get autoclean && apt-get clean && apt-get autoremove
5959

6060
# install the wheels from first stage
61-
COPY --from=builder /tmp/wheelhouse /tmp/wheelhouse
62-
RUN python3 -m pip install --no-cache --no-deps /tmp/wheelhouse/*
61+
RUN --mount=type=cache,from=builder,source=/tmp/wheelhouse,target=/tmp/wheelhouse \
62+
python3 -m pip install --no-cache --no-deps /tmp/wheelhouse/*
6363

6464
# Resources
6565
RUN mkdir /var/jupyterhub

jupyterhub/cwh-repo2docker/cwh_repo2docker/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ async def _get_cmd_from_image(self):
148148
async def get_command(self):
149149
image_cmd = await self._get_cmd_from_image()
150150
# override cmd for docker-stacks image
151-
if image_cmd == ['start-notebook.sh']:
151+
if (image_cmd == ['start-notebook.sh']
152+
or image_cmd == ['start-notebook.py']):
152153
return image_cmd + self.get_args()
153154

154155
if self.cmd:

jupyterhub/cwh-repo2docker/cwh_repo2docker/custom_templates/page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
{% block nav_bar_left_items %}
44
{{ super() }}
55
{% if 'access:services!service={{cwh_repo2docker_service_name}}' in expanded_scopes or 'access:services' in expanded_scopes %}
6-
<li><a href="{{prefix}}services/{{cwh_repo2docker_service_name}}/">Environments</a></li>
6+
<li class="nav-item"><a class="nav-link" href="{{prefix}}services/{{cwh_repo2docker_service_name}}/">Environments</a></li>
77
{% endif %}
88
{% endblock %}

jupyterhub/cwh-repo2docker/cwh_repo2docker/static/js/images.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
require([
2-
"jquery", "bootstrap", "moment", "jhapi", "utils",
2+
"jquery", "moment", "jhapi", "utils",
33
"static/vendor/xterm-addon-fit.js",
44
"static/vendor/xterm.js"
55
], function(
66
$,
7-
bs,
87
moment,
98
JHAPI,
109
utils,
@@ -39,7 +38,8 @@ require([
3938
dialog.find(".build-args-input").val("");
4039
dialog.find(".username-input").val("");
4140
dialog.find(".password-input").val("");
42-
dialog.modal();
41+
var modal = new bootstrap.Modal(dialog[0])
42+
modal.show();
4343
});
4444

4545
$(".set-default-course-image").click(function() {
@@ -71,7 +71,8 @@ require([
7171
var password = dialog.find(".password-input").val().trim();
7272
var spinner = $("#adding-environment-dialog");
7373
spinner.find('.modal-footer').remove();
74-
spinner.modal();
74+
var modal = new bootstrap.Modal(spinner[0])
75+
modal.show();
7576
$.ajax("api/environments?_xsrf=" + xsrf_token, {
7677
type: "POST",
7778
data: JSON.stringify({
@@ -96,7 +97,8 @@ require([
9697
var dialog = $("#remove-environment-dialog");
9798
dialog.find(".delete-environment").attr("data-image", image);
9899
dialog.find(".delete-environment").text(name);
99-
dialog.modal();
100+
var modal = new bootstrap.Modal(dialog[0])
101+
modal.show();
100102
});
101103

102104
$("#remove-environment-dialog")
@@ -106,7 +108,8 @@ require([
106108
var image = dialog.find(".delete-environment").data("image");
107109
var spinner = $("#removing-environment-dialog");
108110
spinner.find('.modal-footer').remove();
109-
spinner.modal();
111+
var modal = new bootstrap.Modal(spinner[0])
112+
modal.show();
110113
$.ajax("api/environments?_xsrf=" + xsrf_token, {
111114
type: "DELETE",
112115
data: JSON.stringify({
@@ -124,6 +127,8 @@ require([
124127
var image = row.data("image");
125128
var dialog = $("#show-logs-dialog");
126129

130+
dialog.find(".modal-dialog").addClass("modal-lg");
131+
127132
var log = new xterm.Terminal({
128133
convertEol: true,
129134
disableStdin: true
@@ -165,7 +170,8 @@ require([
165170
eventSource.close();
166171
}
167172
});
168-
dialog.modal();
173+
var modal = new bootstrap.Modal(dialog[0])
174+
modal.show();
169175
});
170176

171177
// initialize tooltips

jupyterhub/cwh-repo2docker/cwh_repo2docker/templates/images.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,20 @@
109109
{% call modal(name, btn_class='btn-primary save-button') %}
110110
<div class="form-horizontal">
111111
<div class="form-group">
112-
<label for="repository-url" class="col-sm-4 control-label">Repository URL</label>
113-
<div class="col-sm-8">
112+
<label for="repository-url" class="col-sm-6 control-label">Repository URL</label>
113+
<div class="col-sm-10">
114114
<input type="text" class="form-control repo-input" id="repository-url"/>
115115
</div>
116116
</div>
117117
<div class="form-group">
118-
<label for="reference" class="col-sm-4 control-label">Reference (git commit)</label>
119-
<div class="col-sm-8">
118+
<label for="reference" class="col-sm-6 control-label">Reference (git commit)</label>
119+
<div class="col-sm-10">
120120
<input type="text" class="form-control ref-input" id="reference" placeholder="HEAD"/>
121121
</div>
122122
</div>
123123
<div class="form-group">
124-
<label for="name" class="col-sm-4 control-label">Name of the environment</label>
125-
<div class="col-sm-8">
124+
<label for="name" class="col-sm-6 control-label">Name of the environment</label>
125+
<div class="col-sm-10">
126126
<input data-toggle="tooltip" title="Allowed characters are a to z, A to Z, 0 to 9, - and _"
127127
type="text" class="form-control name-input" id="name"/>
128128
<p class="help-block">Example: course-python-101-B37</p>
@@ -132,23 +132,23 @@
132132
<details>
133133
<summary>&gt; Advanced</summary>
134134
<div class="form-group">
135-
<label for="build-args" class="col-sm-4 control-label">Build Arguments</label>
136-
<div class="col-sm-8">
135+
<label for="build-args" class="col-sm-6 control-label">Build Arguments</label>
136+
<div class="col-sm-10">
137137
<textarea class="form-control build-args-input" id="build-args" rows="4" placeholder="arg1=val1&#10;arg2=val2&#10;..."></textarea>
138138
</div>
139139
</div>
140140
</details>
141141
<details>
142142
<summary>&gt; Credentials (optional)</summary>
143143
<div class="form-group">
144-
<label for="username" class="col-sm-4 control-label">Git Username</label>
145-
<div class="col-sm-8">
144+
<label for="username" class="col-sm-6 control-label">Git Username</label>
145+
<div class="col-sm-10">
146146
<input type="text" class="form-control username-input" id="username"/>
147147
</div>
148148
</div>
149149
<div class="form-group">
150-
<label for="password" class="col-sm-4 control-label">Git Password</label>
151-
<div class="col-sm-8">
150+
<label for="password" class="col-sm-6 control-label">Git Password</label>
151+
<div class="col-sm-10">
152152
<input type="password" class="form-control password-input" id="password"/>
153153
</div>
154154
</div>
Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
{% extends "templates/page.html" %}
22

3-
{% block nav_bar %}
4-
<nav class="navbar navbar-default">
5-
<div class="container-fluid">
6-
<div class="navbar-header">
7-
<span id="jupyterhub-logo" class="pull-left">
8-
<a href="{{logo_url or base_url}}"><img src='{{base_url}}logo' alt='JupyterHub logo' class='jpy-logo' title='Home'/></a>
9-
</span>
10-
<span class="navbar-brand">{{ brand_text }}</span>
11-
</div>
12-
<div class="collapse navbar-collapse" id="thenavbar">
13-
<ul class="nav navbar-nav">
14-
<li><a href="{{base_url}}home">Home</a></li>
15-
</ul>
16-
</div>
17-
</div>
18-
</nav>
19-
{% endblock %}
3+
{% block logo %}
4+
{{ super() }}
5+
<span class="navbar-brand">{{ brand_text }}</span>
6+
{% endblock logo %}
7+
8+
{% block nav_bar_left_items %}
9+
<li class="nav-item">
10+
<a class="nav-link" href="{{ base_url }}home">Home</a>
11+
</li>
12+
{% endblock nav_bar_left_items %}
13+
14+
{% block login_widget %}
15+
{% endblock login_widget %}
2016

2117
{% block announcement %}
2218
{% endblock %}

jupyterhub/cwh-repo2docker/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
include_package_data = True,
1212
install_requires = [
1313
"coursewareuserspawner",
14-
"jupyterhub~=4.0",
14+
"jupyterhub~=5.0",
1515
"aiodocker",
1616
'aiohttp']
1717
)

jupyterhub/spawner/coursewareuserspawner/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@ def get_env(self):
343343
NB_UID=self.user_id,
344344
HOME=self.homedir,
345345
))
346+
if os.environ('DEBUG', 'no') in ['yes', '1']:
347+
env.update(dict(
348+
REPO_DIR=self.homedir,
349+
))
346350
# Fix 20180802
347351
if self._is_admin():
348352
env['GRANT_SUDO'] = 'yes'

jupyterhub/spawner/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def run(self):
4141
long_description = "Spawn single-user servers with Docker.",
4242
platforms = "Linux, Mac OS X",
4343
install_requires = [
44-
'requests-unixsocket @ git+https://github.com/NII-cloud-operation/requests-unixsocket.git',
44+
'requests-unixsocket',
4545
'dockerspawner'
4646
],
4747
cmdclass = {

0 commit comments

Comments
 (0)