Skip to content

Commit eb3bda1

Browse files
authored
Merge pull request #947 from OpenSourceBrain/jupyterhub-update
Jupyterhub updates into docker test branch
2 parents af807b0 + 3102d5a commit eb3bda1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2492
-414
lines changed

.github/workflows/deploy-dev.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build and Deploy OSBv2 to Dev
2+
on:
3+
push:
4+
branches: [ develop, release/* ]
5+
6+
jobs:
7+
prepare:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
- uses: actions/checkout@v2
13+
name: Post main clone
14+
with:
15+
name: MetaCell/cloud-harness
16+
ref: ${{ vars.CLOUDHARNESS_BRANCH || 'master' }}
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.9'
21+
- name: Prepare helm chart
22+
run: |
23+
bash cloud-harness/install.sh
24+
harness-deployment cloud-harness . -d ${{vars.DOMAIN}} -r ${{vars.REGISTRY}} -rs ${{secrets.REGISTRY_SECRET}}
25+
-n ${{vars.NAMESPACE}} --write-env -e dev -i osb-portal
26+
- uses: actions/upload-artifact@v4
27+
with:
28+
name: env_vars_to_export
29+
path: deployment/.env
30+
build-base-images:
31+
runs-on: ubuntu-latest
32+
steps:
33+
34+
- name: Build the Docker image
35+
run: |
36+
cd applications/nwb-explorer
37+
docker build -t mynwbexplorer -f Dockerfile --no-cache .
38+
- name: Deploy to Dev
39+
uses: MetaCell/deploy-osbv2@v1
40+
with:
41+
environment: dev
42+
service: nwbexplorer
43+
port: 80
44+
dependencies: jupyterhub
45+
git:
46+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ environment first.
1212

1313
With conda:
1414
```bash
15-
conda create --name osb python=3.9
15+
conda create --name osb python=3.12
1616
conda activate osb
1717
```
1818

applications/jupyterhub/src/chauthenticator/chauthenticator/auth.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ class CloudHarnessAuthenticateHandler(BaseHandler):
2121
"""
2222

2323
def initialize(self, force_new_server, process_user):
24+
print("CH auth handler initialized")
2425
super().initialize()
2526
self.force_new_server = force_new_server
2627
self.process_user = process_user
2728

2829
@gen.coroutine
2930
def get(self):
31+
print("CH auth handler begin")
3032
if 'open=' in self.request.uri:
3133
url = self.request.uri.split('open=').pop()
3234
self.request.cookies.set("loadurl", bytes(

applications/jupyterhub/theming/page.html

Lines changed: 105 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
{% macro modal(title, btn_label=None, btn_class="btn-primary") %}
22
{% set key = title.replace(' ', '-').lower() %}
33
{% set btn_label = btn_label or title %}
4-
<div class="modal fade" id="{{key}}-dialog" tabindex="-1" role="dialog" aria-labelledby="{{key}}-label"
5-
aria-hidden="true">
4+
<div class="modal fade" id="{{key}}-dialog" tabindex="-1" role="dialog" aria-labelledby="{{key}}-label" aria-hidden="true">
65
<div class="modal-dialog">
76
<div class="modal-content">
87
<div class="modal-header">
9-
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
10-
class="sr-only">Close</span></button>
11-
<h4 class="modal-title" id="{{key}}-label">{{title}}</h4>
8+
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
9+
<h1 class="modal-title" id="{{key}}-label">{{title}}</h1>
1210
</div>
1311
<div class="modal-body">
1412
{{ caller() }}
@@ -24,67 +22,71 @@ <h4 class="modal-title" id="{{key}}-label">{{title}}</h4>
2422

2523

2624
<!DOCTYPE HTML>
27-
<html>
25+
<html lang="en">
2826

2927
<head>
30-
<meta charset="utf-8">
31-
32-
<title>{% block title %}Loading workspace{% endblock %}</title>
33-
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge">
34-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
35-
36-
{% block stylesheet %}
37-
<link rel="stylesheet" href="{{ static_url("css/style.min.css") }}" type="text/css" />
38-
<link rel="shortcut icon" type="image/x-icon" href="{{ static_url("images/favicon.ico") }}">
39-
{% endblock %}
40-
<script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
41-
<script src="{{static_url("components/jquery/dist/jquery.min.js") }}" type="text/javascript" charset="utf-8"></script>
42-
<script src="{{static_url("components/bootstrap/dist/js/bootstrap.min.js") }}" type="text/javascript"
43-
charset="utf-8"></script>
44-
<script>
45-
require.config({
28+
<meta charset="utf-8">
29+
30+
<title>{% block title %}JupyterHub{% endblock %}</title>
31+
<meta http-equiv="X-UA-Compatible" content="chrome=1">
32+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
33+
34+
{% block stylesheet %}
35+
<link rel="stylesheet" href="{{ static_url("css/style.min.css") }}" type="text/css"/>
36+
{% endblock %}
37+
{% block favicon %}
38+
<link rel="icon" href="{{ static_url("favicon.ico") }}" type="image/x-icon">
39+
{% endblock %}
40+
{% block scripts %}
41+
<script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
42+
<script src="{{static_url("components/jquery/dist/jquery.min.js") }}" type="text/javascript" charset="utf-8"></script>
43+
<script src="{{static_url("components/bootstrap/dist/js/bootstrap.min.js") }}" type="text/javascript" charset="utf-8"></script>
44+
{% endblock %}
45+
<script>
46+
require.config({
4647
{% if version_hash %}
47-
urlArgs: "v={{version_hash}}",
48-
{% endif %}
49-
baseUrl: '{{static_url("js", include_version=False)}}',
50-
paths: {
51-
components: '../components',
52-
jquery: '../components/jquery/dist/jquery.min',
53-
bootstrap: '../components/bootstrap/dist/js/bootstrap.min',
48+
urlArgs: "v={{version_hash}}",
49+
{% endif %}
50+
baseUrl: '{{static_url("js", include_version=False)}}',
51+
paths: {
52+
components: '../components',
53+
jquery: '../components/jquery/dist/jquery.min',
54+
bootstrap: '../components/bootstrap/dist/js/bootstrap.min',
5455
moment: "../components/moment/moment",
5556
},
56-
shim: {
57-
bootstrap: {
58-
deps: ["jquery"],
59-
exports: "bootstrap"
60-
},
61-
}
57+
shim: {
58+
bootstrap: {
59+
deps: ["jquery"],
60+
exports: "bootstrap"
61+
},
62+
}
6263
});
63-
</script>
64+
</script>
6465

65-
<script type="text/javascript">
66-
window.jhdata = {
67-
base_url: "{{base_url}}",
68-
prefix: "{{prefix}}",
66+
<script type="text/javascript">
67+
window.jhdata = {
68+
base_url: "{{base_url}}",
69+
prefix: "{{prefix}}",
6970
{% if user %}
70-
user: "{{user.name}}",
71-
{% endif %}
72-
{% if admin_access %}
73-
admin_access: true,
74-
{% else %}
75-
admin_access: false,
76-
{% endif %}
77-
{% if not no_spawner_check and user and user.spawner.options_form %}
78-
options_form: true,
79-
{% else %}
80-
options_form: false,
81-
{% endif %}
71+
user: "{{user.json_escaped_name}}",
72+
{% endif %}
73+
{% if admin_access %}
74+
admin_access: true,
75+
{% else %}
76+
admin_access: false,
77+
{% endif %}
78+
{% if not no_spawner_check and user and user.spawner.options_form %}
79+
options_form: true,
80+
{% else %}
81+
options_form: false,
82+
{% endif %}
83+
xsrf_token: "{{ xsrf_token }}",
8284
}
83-
</script>
85+
</script>
86+
<script src="{{ static_url("hot_fix_for_eventsource.js") }}" type="text/javascript" charset="utf-8"></script>
8487

85-
<script src="{{ static_url("hot_fix_for_eventsource.js") }}" type="text/javascript" charset="utf-8"></script>
86-
{% block meta %}
87-
{% endblock %}
88+
{% block meta %}
89+
{% endblock %}
8890

8991
</head>
9092
<style>
@@ -193,32 +195,38 @@ <h4 class="modal-title" id="{{key}}-label">{{title}}</h4>
193195
details[open] summary:before {
194196
transform: rotate(180deg);
195197
}
198+
199+
.navbar {
200+
display: none;
201+
}
196202
</style>
197203

198204
<body>
199205

200-
<noscript>
201-
<div id='noscript'>
202-
JupyterHub requires JavaScript.<br>
203-
Please enable it to proceed.
204-
</div>
205-
</noscript>
206+
<noscript>
207+
<div id='noscript'>
208+
JupyterHub requires JavaScript.<br>
209+
Please enable it to proceed.
210+
</div>
211+
</noscript>
206212

207-
{% block nav_bar %}
208-
<!-- <nav class="navbar navbar-default">
213+
{% block nav_bar %}
214+
<nav class="navbar navbar-default">
209215
<div class="container-fluid">
210216
<div class="navbar-header">
211217
{% block logo %}
212218
<span id="jupyterhub-logo" class="pull-left">
213-
<a href="{{logo_url or base_url}}"><img src='{{base_url}}logo' alt='JupyterHub' class='jpy-logo' title='Home'/></a>
219+
<a href="{{logo_url or base_url}}"><img src='{{base_url}}logo' alt='JupyterHub logo' class='jpy-logo' title='Home'/></a>
214220
</span>
215221
{% endblock %}
222+
{% if user %}
216223
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#thenavbar" aria-expanded="false">
217224
<span class="sr-only">Toggle navigation</span>
218225
<span class="icon-bar"></span>
219226
<span class="icon-bar"></span>
220227
<span class="icon-bar"></span>
221228
</button>
229+
{% endif %}
222230
</div>
223231

224232
<div class="collapse navbar-collapse" id="thenavbar">
@@ -227,9 +235,21 @@ <h4 class="modal-title" id="{{key}}-label">{{title}}</h4>
227235
{% block nav_bar_left_items %}
228236
<li><a href="{{base_url}}home">Home</a></li>
229237
<li><a href="{{base_url}}token">Token</a></li>
230-
{% if user.admin %}
238+
{% if 'admin-ui' in parsed_scopes %}
231239
<li><a href="{{base_url}}admin">Admin</a></li>
232240
{% endif %}
241+
{% if services %}
242+
<li class="dropdown">
243+
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Services<span class="caret"></span></a>
244+
<ul class="dropdown-menu">
245+
{% for service in services %}
246+
{% block service scoped %}
247+
<li><a class="dropdown-item" href="{{service.prefix}}">{{service.name}}</a></li>
248+
{% endblock %}
249+
{% endfor %}
250+
</ul>
251+
</li>
252+
{% endif %}
233253
{% endblock %}
234254
</ul>
235255
{% endif %}
@@ -239,7 +259,7 @@ <h4 class="modal-title" id="{{key}}-label">{{title}}</h4>
239259
{% block login_widget %}
240260
<span id="login_widget">
241261
{% if user %}
242-
<p class="navbar-text">{{user.name}}</p>
262+
<p class="navbar-text">{{user.name}}</p>
243263
<a id="logout" role="button" class="navbar-btn btn-sm btn btn-default" href="{{logout_url}}"> <i aria-hidden="true" class="fa fa-sign-out"></i> Logout</a>
244264
{% else %}
245265
<a id="login" role="button" class="btn-sm btn navbar-btn btn-default" href="{{login_url}}">Login</a>
@@ -254,30 +274,33 @@ <h4 class="modal-title" id="{{key}}-label">{{title}}</h4>
254274
{% block header %}
255275
{% endblock %}
256276
</div>
257-
</nav> -->
258-
{% endblock %}
277+
</nav>
278+
{% endblock %}
259279

260280

261-
{% block announcement %}
262-
{% if announcement %}
263-
<div class="container text-center announcement">
264-
{{ announcement | safe }}
265-
</div>
266-
{% endif %}
267-
{% endblock %}
281+
{% block announcement %}
282+
{% if announcement %}
283+
<div class="container text-center announcement alert alert-warning">
284+
{{ announcement | safe }}
285+
</div>
286+
{% endif %}
287+
{% endblock %}
288+
268289

290+
{% block main %}
291+
{% endblock %}
269292

270-
{% block main %}
271-
{% endblock %}
293+
{% block footer %}
294+
{% endblock %}
272295

273-
{% call modal('Error', btn_label='OK') %}
296+
{% call modal('Error', btn_label='OK') %}
274297
<div class="ajax-error">
275298
The error
276299
</div>
277-
{% endcall %}
300+
{% endcall %}
278301

279-
{% block script %}
280-
{% endblock %}
302+
{% block script %}
303+
{% endblock %}
281304

282305
</body>
283306

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
harness:
2+
deployment:
3+
image: gcr.io/metacellllc/osb/netpyne:0.7.6.2
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
harness:
2+
deployment:
3+
image: gcr.io/metacellllc/osb/netpyne:0.7.6.2

applications/netpyne/deploy/values.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ harness:
66
name: proxy-public
77
deployment:
88
auto: false
9-
image: netpyne:latest
109
jupyterhub:
1110
args: ["--NotebookApp.default_url=/geppetto", "--library=netpyne_ui", "--NotebookApp.notebook_dir=/opt/workspace", "--NotebookApp.disable_check_xsrf=True"]
1211
applicationHook: "osb_jupyter.change_pod_manifest"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
lfpykit==0.5.1
22
pyNeuroML>=0.7.5
33
git+https://github.com/Neurosim-lab/netpyne.git@osbv2
4-
traitlets==5.9.0
4+
traitlets==5.9.0
5+
jupyterhub>=4.0.0

applications/nwb-explorer/Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ RUN chown $NB_UID /opt
3232
RUN chown $NB_UID .
3333

3434
USER $NB_UID
35-
35+
COPY requirements.txt requirements.txt
36+
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
37+
pip install cython && pip install -r requirements.txt --prefer-binary
3638
COPY dependencies/nwb-explorer/requirements.txt requirements.txt
3739
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
3840
pip install cython && pip install -r requirements.txt --prefer-binary
@@ -58,4 +60,7 @@ RUN chown $NB_UID .
5860
COPY --from=jsbuild --chown=$NB_UID:$NB_UID $FOLDER/webapp/build webapp/build
5961

6062
USER $NB_UID
63+
64+
RUN rm -Rf $(pwd)/workspace && ln -s /opt/workspace $(pwd)/
65+
6166
CMD ./NWBE
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 3051a70b2ada1de5a9b91c49a7deb1e3a5c855a4
1+
Subproject commit 20e799e0076d0f965154e2a484df1f998f9e1452

0 commit comments

Comments
 (0)