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

v0.7.4 #837

Merged
merged 83 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
457d230
Test docker build for NWBE
pgleeson Apr 25, 2022
74029c8
Test build jupyterlab also
pgleeson Apr 25, 2022
e992bc0
Add netpyne docker test
pgleeson Apr 25, 2022
d29a340
Merge branch 'develop' into feature/docker_builds_gha
pgleeson May 24, 2022
cf3363d
Merge branch 'develop' into feature/docker_builds_gha
pgleeson Aug 25, 2022
36a786a
Test on ubuntu-20.04
pgleeson May 30, 2023
cac9bea
Merge pull request #781 from OpenSourceBrain/release/0.7.3
filippomc Jul 31, 2023
d1720be
fix: increase the size of volume claim for nfs server in live
etowett Aug 31, 2023
1e7570f
Merge pull request #789 from OpenSourceBrain/fix/increase-nfsserver-p…
filippomc Sep 8, 2023
167f8a7
Merge pull request #753 from OpenSourceBrain/develop
pgleeson Sep 27, 2023
06d3194
Update docker-nwbe.yml
pgleeson Oct 18, 2023
4ceacb0
Update nwb explorer
filippomc Oct 26, 2023
a6ae7ab
Fix nwb explorer build
filippomc Oct 26, 2023
fa2fb39
#775 link to guided tour
filippomc Oct 31, 2023
04cde42
#792 update logo on about page
filippomc Oct 31, 2023
bb6625e
#773 login page new logo
filippomc Oct 31, 2023
890d630
#770 link to main site
filippomc Oct 31, 2023
3432897
#771 fix drawer text alignment on firefox
filippomc Oct 31, 2023
d4aef22
Update docker-nwbe.yml
pgleeson Oct 31, 2023
d74cebe
Expand external file load supported urls
filippomc Oct 31, 2023
ce3b8c2
#773 login page new logo fix
filippomc Oct 31, 2023
2537151
#733 tags from repository to workspace fixed
filippomc Oct 31, 2023
1fe9149
Fix hub regression
filippomc Oct 31, 2023
717fa84
Fix hub regression
filippomc Oct 31, 2023
5dc5fcb
#776 - Adding "Manage running workspaces" button and linking
D-GopalKrishna Nov 6, 2023
4a05adc
Image selection for trusted users
filippomc Nov 6, 2023
a0ee759
Fix nwb explorer build
filippomc Nov 6, 2023
2912e5a
Fix deployment
filippomc Nov 6, 2023
0e45346
Small jupyterhub dev enhancements
filippomc Nov 7, 2023
f532f2d
Improve jupyterhub parameter parsing
filippomc Nov 7, 2023
59c587a
Simplify netpyne build
filippomc Nov 7, 2023
72e6bc7
#776 Change styling for the button
D-GopalKrishna Nov 7, 2023
7d37cb8
Merge pull request #800 from OpenSourceBrain/feature/776
filippomc Nov 7, 2023
25bbe15
#769 fixing width modal table
Aiga115 Nov 8, 2023
a7a51cd
#769 fix modal table width: create workspace from repository
Aiga115 Nov 8, 2023
08e7ba9
Merge pull request #801 from OpenSourceBrain/feature/769
filippomc Nov 8, 2023
7954044
#802-b favicon icons changed
Aiga115 Nov 10, 2023
d651ea0
#802_b small change
Aiga115 Nov 10, 2023
8456aba
NWB explorer update
filippomc Nov 13, 2023
e5a37d8
#717 resolve - workspace without a defaultApplication value
D-GopalKrishna Nov 14, 2023
d32a30c
#762 fix Creating new workspace from repository
D-GopalKrishna Nov 14, 2023
1ba0e16
#762 cleanup
D-GopalKrishna Nov 14, 2023
ec8e585
Merge pull request #807 from OpenSourceBrain/feature/762
filippomc Nov 14, 2023
ac540c4
Update NWB explorer, dialog fix
filippomc Nov 14, 2023
1942535
Update NWB explorer
filippomc Nov 14, 2023
7fc45ae
Update NWB explorer
filippomc Nov 14, 2023
0d8fde5
Fix resource loading
filippomc Nov 15, 2023
fc57208
Fix resource switch with special characters
filippomc Nov 15, 2023
0de4291
Merge branch 'feature/802_b' of https://github.com/OpenSourceBrain/OS…
filippomc Nov 15, 2023
1c6e85f
Update nwb explorer
filippomc Nov 15, 2023
b545817
Fix workspace create dialog not closing
filippomc Nov 15, 2023
a450414
#776 fix hub link
filippomc Nov 15, 2023
2b826c4
Merge pull request #798 from OpenSourceBrain/develop
pgleeson Nov 15, 2023
edea24e
Fix workspace creation
filippomc Nov 16, 2023
4037ca1
Minorupdate to gha docker test files
pgleeson Nov 17, 2023
19d4d19
#831 Username match fix
filippomc Nov 28, 2023
332fda9
#832 fix jupyterlab
filippomc Nov 28, 2023
ba80919
#832 fix netpyne
filippomc Nov 28, 2023
81a3df4
#819 fix switch application resource
filippomc Nov 29, 2023
13b5666
#824 pagination count to 24
D-GopalKrishna Nov 30, 2023
7347ccc
#824 BE filtering tags - remove union with q_base
D-GopalKrishna Nov 30, 2023
c98379d
Fix parameters
filippomc Dec 1, 2023
55a02ff
Fix JH login cookie
filippomc Dec 1, 2023
b5197b1
Build fix
filippomc Dec 1, 2023
198cb02
#829 fix accents preventing spwan
filippomc Dec 1, 2023
9759f72
SA-164 increase nfs-server volume size in prod
etowett Dec 1, 2023
3f3e41d
#820 fix anonymous users issues
filippomc Dec 1, 2023
69046b3
Merge pull request #834 from OpenSourceBrain/SA-164/increase-osb-nfs-…
filippomc Dec 1, 2023
39d146b
#824 converting union to intersect to keep the prev filters
D-GopalKrishna Dec 4, 2023
a7d7bbf
Update nwb explorer
filippomc Dec 4, 2023
ac2a38d
Merge pull request #833 from OpenSourceBrain/feature/824
filippomc Dec 4, 2023
5d0209c
Fix tests
filippomc Dec 4, 2023
6901278
Merge branch 'develop' of https://github.com/OpenSourceBrain/OSBv2 in…
filippomc Dec 4, 2023
bb4d836
Fix e2e testing
filippomc Dec 4, 2023
8a076a9
Fix jupyterhub apps parameters pass
filippomc Dec 4, 2023
5444a4f
#819 fix load resource on application switch
filippomc Dec 5, 2023
496598a
Fix jupyterlab resource load
filippomc Dec 5, 2023
8c4ab9d
Jupyterhub -- ignore deployment in docker build
filippomc Dec 5, 2023
3fda313
#819 harder switch
filippomc Dec 5, 2023
744b6db
Remove useless CSP
filippomc Dec 6, 2023
7e0becf
Merge pull request #818 from OpenSourceBrain/feature/docker_builds_gha
filippomc Dec 6, 2023
474e216
#824 fix the tags search in my workspace
D-GopalKrishna Dec 6, 2023
644911d
Merge pull request #836 from OpenSourceBrain/feature/824
filippomc Dec 6, 2023
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
25 changes: 25 additions & 0 deletions .github/workflows/docker-jupyterlab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Docker Image Build Jupyterlab

on:
push:
branches: [ master, dev*, feature/docker* ]
pull_request:
branches: [ master, dev*, feature/docker* ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Build the Docker image
run: |
cd applications/jupyterlab
docker build -t myjlab -f Dockerfile --no-cache .

- name: Info on Docker image sizes
run: |
docker images
25 changes: 25 additions & 0 deletions .github/workflows/docker-netpyne.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Docker Image Build NetPyNE-UI

on:
push:
branches: [ master, dev*, feature/docker* ]
pull_request:
branches: [ master, dev*, feature/docker* ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Build the Docker image
run: |
cd applications/netpyne
docker build -t mynpui -f Dockerfile --no-cache .

- name: Info on Docker image sizes
run: |
docker images
27 changes: 27 additions & 0 deletions .github/workflows/docker-nwbe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Docker Image Build NWB Explorer

on:
push:
branches: [ master, dev*, feature/docker* ]
pull_request:
branches: [ master, dev*, feature/docker* ]

jobs:

build:

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3

- name: Build the Docker image
run: |
cd applications/nwb-explorer
docker build -t mynwbosb -f Dockerfile --no-cache .

- name: Info on Docker image sizes
run: |
docker images


Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
from cloudharness.auth.quota import get_user_quotas
from keycloak.exceptions import KeycloakGetError, KeycloakError
from accounts_api.models import User
from cloudharness.auth import AuthClient
from cloudharness.auth import AuthClient, UserNotFound
from cloudharness import log
import typing
# from cloudharness.models import User as CHUser # Cloudharness 2.0.0

class UserNotFound(Exception): pass


class UserNotAuthorized(Exception): pass

Expand All @@ -20,7 +18,8 @@ def get_user(username_or_id: str) -> User:
try:

kc_user = client.get_user(username_or_id)

except UserNotFound:
raise
except KeycloakGetError as e:
if e.response_code == 404:
raise UserNotFound(username_or_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ body {
}

.login-pf-logo {
background: url(../img/osblogo.png) no-repeat;
background: url(../img/osb-logo.png) no-repeat;
background-size: contain;
width: 132px;
height: 20px;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
2 changes: 1 addition & 1 deletion applications/accounts/themes/custom/login/template.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</#list>
</#if>
<title>${msg("loginTitle",(realm.displayName!''))}</title>
<link rel="icon" href="${url.resourcesPath}/img/favicon.ico" />
<link rel="icon" href="${url.resourcesPath}/img/favicon.svg" />
<#if properties.stylesCommon?has_content>
<#list properties.stylesCommon?split(' ') as style>
<link href="${url.resourcesCommonPath}/${style}" rel="stylesheet" />
Expand Down
1 change: 1 addition & 0 deletions applications/jupyterhub/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/deploy
2 changes: 0 additions & 2 deletions applications/jupyterhub/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ COPY --chown=1000:1000 theming/spawn_pending.html /usr/local/share/jupyterhub/te
COPY --chown=1000:1000 theming/hot_fix_for_eventsource.js /usr/local/share/jupyterhub/static/hot_fix_for_eventsource.js
COPY --chown=1000:1000 theming/arrow-dropdown.svg /usr/local/share/jupyterhub/static/arrow-dropdown.svg

COPY hub/jupyter_notebook_config.py /etc/jupyter/jupyter_notebook_config.py

RUN chmod 777 /usr/src/app -R
USER jovyan

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
print(c.NotebookApp.tornado_settings)
c.NotebookApp.tornado_settings = {
'headers': {
'Content-Security-Policy': "frame-ancestors 'self' localhost:3000 localhost:* localhost *.osb.local *.opensourcebrain.org *.metacell.us",
'Content-Security-Policy': "frame-ancestors 'self' localhost:3000 localhost:* localhost:3000 *.osb.local *.opensourcebrain.org *.metacell.us",
}
}
print(c.NotebookApp.tornado_settings)
Expand Down
9 changes: 9 additions & 0 deletions applications/jupyterhub/deploy/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: "jupyterhub-notebook-config"
labels:
app: jupytehub
data:
{{- (.Files.Glob "resources/jupyterhub/applications/*").AsConfig | nindent 2 }}
---
1 change: 1 addition & 0 deletions applications/jupyterhub/deploy/values-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ harness:
dependencies:
soft: [nfsserver, accounts]
hard: []
nfs_volumes: false
2 changes: 1 addition & 1 deletion applications/jupyterhub/deploy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ harness:
quota-ws-maxmem: 1
# sets the storage dedicated to the user data in Gb units (float)
quota-storage-max : 1.25

nfs_volumes: false
hub:
config:
JupyterHub:
Expand Down
2 changes: 1 addition & 1 deletion applications/jupyterhub/kubespawner
Submodule kubespawner updated from 8942af to 812d30
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,19 @@ def initialize(self, force_new_server, process_user):

@gen.coroutine
def get(self):
if 'open=' in self.request.uri:
url = self.request.uri.split('open=').pop()
self.request.cookies.set("loadurl", bytes(
url, 'utf-8'), encrypted=False, httponly=False)

# legacy nwb explorer support
elif 'nwbfile=' in self.request.uri:
print("Nwb file found")
url = self.request.uri.split('nwbfile=').pop().split("&")[0]
print("NWB URL", url)
self._set_cookie("nwbloadurl", bytes(
url, 'utf-8'), encrypted=False, httponly=False)
self.clear_login_cookie()

try:

accessToken = self.request.cookies.get(
Expand All @@ -50,7 +61,9 @@ def get(self):
self.request.cookies.clear()
raw_user = self.get_anonymous_user()

print("JH user: ", raw_user.__dict__)


# print("JH user: ", raw_user.__dict__)
self.set_login_cookie(raw_user)
user = yield gen.maybe_future(self.process_user(raw_user, self))
self.redirect(self.get_next_url(user))
Expand Down Expand Up @@ -99,7 +112,10 @@ def get_handlers(self, app):
'process_user': self.process_user
}
return [
('/chkclogin', CloudHarnessAuthenticateHandler, extra_settings)
('/chkclogin', CloudHarnessAuthenticateHandler, extra_settings),
('/nwbfile=.*', CloudHarnessAuthenticateHandler, extra_settings),
('/open=.*', CloudHarnessAuthenticateHandler, extra_settings),
('/query?.*', CloudHarnessAuthenticateHandler, extra_settings),
]

def login_url(self, base_url):
Expand Down
84 changes: 64 additions & 20 deletions applications/jupyterhub/src/osb_jupyter/osb_jupyter/jupyterhub.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import re
from jupyterhub.user import User
from kubespawner.spawner import KubeSpawner

from cloudharness.auth import AuthClient
from cloudharness import log
from cloudharness import applications
from cloudharness.auth.exceptions import UserNotFound
from urllib.parse import parse_qs, urlparse

allowed_chars = set(
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")


def affinity_spec(key, value):
Expand All @@ -22,9 +28,11 @@ def affinity_spec(key, value):
'topologyKey': 'kubernetes.io/hostname'
}


class CookieNotFound(Exception):
pass


def change_pod_manifest(self: KubeSpawner):
"""
Application Hook to change the manifest of the notebook image
Expand All @@ -47,7 +55,8 @@ def get_from_cookie(cookie_name):
return cookie.value

def user_volume_is_legacy(user_id):
print("User id", user_id, "max", self.config['apps']['jupyterhub'].get('legacyusermax', 0))
print("User id", user_id, "max",
self.config['apps']['jupyterhub'].get('legacyusermax', 0))
return int(user_id) < self.config['apps']['jupyterhub'].get('legacyusermax', 0)

def workspace_volume_is_legacy(workspace_id):
Expand Down Expand Up @@ -75,21 +84,20 @@ def workspace_volume_is_legacy(workspace_id):
self.volumes.append(ws_pvc)

app_user = get_app_user(self.user)


# Add labels to use for affinity
clean_username = "".join(c for c in app_user.username if c.isalnum())
clean_username = "".join(
c for c in app_user.username if c in allowed_chars)
labels = {
'workspace': str(workspace_id),
'username': clean_username,
'user': str(self.user.id),
}



self.common_labels = labels
self.extra_labels = labels
self.storage_class = f'{self.config["namespace"]}-nfs-client'
if self.config['apps']['jupyterhub'].get('nfs_volumes', False):
self.storage_class = f'{self.config["namespace"]}-nfs-client'

if not user_volume_is_legacy(self.user.id):
# User pod affinity is by default added by cloudharness
Expand All @@ -98,10 +106,11 @@ def workspace_volume_is_legacy(workspace_id):
workspace = get_workspace(workspace_id, get_from_cookie("accessToken"))
write_access = has_user_write_access(
workspace, self.user, app_user=app_user)

if workspace_volume_is_legacy(workspace_id):
# Pods with write access must be on the same node
self.pod_affinity_required.append(affinity_spec('workspace', workspace_id))
self.pod_affinity_required.append(
affinity_spec('workspace', workspace_id))
from pprint import pprint
pprint(self.volumes)
self.pod_name = f'ws-{clean_username}-{workspace_id}-{appname}'
Expand All @@ -111,7 +120,16 @@ def workspace_volume_is_legacy(workspace_id):
'mountPath': '/opt/workspace',
'readOnly': not write_access
})
except CookieNotFound:
if "image=" in self.handler.request.uri and is_user_trusted(self.user):
print("Image override")
image = parse_qs(urlparse(self.handler.request.uri).query)[
'image'][0]
print("Image is", image)
self.image = image
self.pod_name = f"{self.pod_name}--{re.sub('[^0-9a-zA-Z]+', '-', image)}"
# open external resources

except (CookieNotFound, UserNotFound):
# Setup a readonly default session
self.pod_name = f'anonymous-{self.user.name}-{appname}'
self.storage_pvc_ensure = False
Expand All @@ -122,29 +140,55 @@ def workspace_volume_is_legacy(workspace_id):
except Exception as e:
log.error('Change pod manifest failed due to an error.', exc_info=True)

# Add customized config map for jupyter notebook config
self.volumes.append({
'name': 'jupyterhub-notebook-config',
'configMap': {'name': 'jupyterhub-notebook-config'}
})
self.volume_mounts.append({
'name': 'jupyterhub-notebook-config',
'subPath': 'jupyter_notebook_config.py',
'mountPath': '/etc/jupyter/jupyter_notebook_config.py',
'readOnly': True
})
self.volume_mounts.append({
'name': 'jupyterhub-notebook-config',
'subPath': 'jupyter_notebook_config.py',
'mountPath': '/opt/conda/etc/jupyter/nbconfig/jupyter_notebook_config.py',
'readOnly': True
})




def get_app_user(user: User):
auth_client = AuthClient()
kc_user = auth_client.get_user(user.name)
return kc_user


def has_user_write_access(workspace, user: User, app_user=None):
print('Checking access, name:', user.name, "workspace:", workspace["id"])


workspace_owner = workspace["user"]["id"]
print("Workspace owner", workspace_owner, "-", workspace["user"]["username"])

if workspace_owner == user.name:
return True
print("Workspace owner", workspace_owner,
"-", workspace["user"]["username"])
return workspace_owner == user.name or is_user_trusted(user)


def is_user_trusted(user: User):
auth_client = AuthClient()
return auth_client.user_has_realm_role(app_user.id, 'administrator')
kc_user = auth_client.get_user(user.name)
return auth_client.user_has_realm_role(kc_user.id, 'administrator') or\
auth_client.user_has_realm_role(kc_user.id, 'trusted')


def get_workspace(workspace_id, token, workspace_base_url=None):
if workspace_base_url is None:
workspace_conf: applications.ApplicationConfiguration = applications.get_configuration('workspaces')
workspace_conf: applications.ApplicationConfiguration = applications.get_configuration(
'workspaces')
workspace_base_url = workspace_conf.get_service_address()
import requests
workspace = requests.get(f"{workspace_base_url}/api/workspace/{workspace_id}", headers={"Authorization": f"Bearer {token}"}).json()

return workspace
workspace = requests.get(f"{workspace_base_url}/api/workspace/{workspace_id}",
headers={"Authorization": f"Bearer {token}"}).json()

return workspace
Loading
Loading