Notebooks Hub Developing
This section documents the local deployment for the Notebooks Hub application, including the mongo database, the API, and the UI.
Local Mongo Setup
Start the Mongo database with mongo:6.0.4 on port 27017, and provide generic credentials.
docker run -p 27017:27017 -eMONGO_INITDB_ROOT_USERNAME=<your-db-username> -eMONGO_INITDB_ROOT_PASSWORD=<your-db-password> mongo:6.0.4
Local API Setup
Prerequisite:
notebooksHub mongoDb database on port 27017
Jupyterhub deployment URL
Navigate to the package/API directory, and create the packages/API/.env file according to the variables found in the Values.yaml file within the associated Helm Deployment script.
JUPYTERHUB_URL = JUPYTER_URL
JUPYTERHUB_API_KEY = JUPYTER_API_KEY
MODULE_LOCATION = 'opt/modules/'
JUPYTERHUB_TOKEN_FILE = 'opt/jupyterhubToken/'
DB_USER = '<your-db-username>'
DB_PASS = '<your-db-password>'
DB_HOST = localhost
DB_PORT = 27017
AUTH_SOURCE = 'admin'
Further, the Jupyterhub API key can be found within the corresponding Jupyterhub Secret on our Kubernetes Cluster.
Set node version to 18.20.3 with nvm with npm version set to 10.7.0 and angular CLI version set to 9.1.15 (Note: Angular CLI version may be a newer version)
source ~/.nvm/nvm.sh
nvm install 18.20.3
node -v
Install node modules and the global Angular CLI
npm install
npm install -g @angular/cli@17
Set the environment variables
set -a
source .env
Build application with npm run build with the root packages/API/package.json
Using this command will create the necessary files and folders on the filesystem for /opt/
to mimic the volume mounts for when mockFiles='false'
. This command will not affect anything when mocking the filesystem via mockFiles=true
.
npm run build:dev
If the dist folder does not get generated, delete ‘tsconfig.tsbuildinfo’ and ‘node_modules’, install node modules and build again
Start application with npm run start
npm run start
View your OpenAPI specification and test service calls at localhost:8002. If testing with postman, ‘filter’ and ‘where’ query JSON params are URL-encoded.
http://localhost:8002/explorer/
Local UI Setup
Prerequisite:
notebooksHub mongoDb database on port 27017
Jupyterhub deployment URL
local API deployment on port 8002
Navigate to the package/UI directory, and create the packages/UI/.env file according to the variables found in the Values.yaml file within the associated Helm Deployment script.
RESPONSE_TYPE = 'code'
URL = AUTH_URL
REDIRECT_URL = 'http://localhost:4200'
TENANT = 'polus-qa'
BACKEND_URL = 'http://127.0.0.1:8002'
JUPYTERHUB_URL = JUPYTER_URL
CLIENT_ID = 'test'
CLIENT_SECRET = CLIENT_SECRET
Request labshare npm access, and authenticate npm via the following command.
npm login
Set node version to 18.20.3 with nvm with npm version set to 10.7.0 and angular CLI version set to 17.3.8 (Note: Angular CLI version may be a newer version)
source ~/.nvm/nvm.sh
nvm install 18.20.3
node -v
Install node modules
npm install
Build the library and the main app, then run it
npm run build:lib
npm run build
npm run start