bl1231 / bilbomd-ui

Frontend React SPA webapp for new BilboMD
2 stars 0 forks source link
saxs

bilbomd-ui

bilbomd-ui is the frontend GUI for BilboMD. It is a Single Page Application SPA. The deploy instructions are outlined in more detail the bilbomd repo, and give instructions for deploying a production instance to https://bilbomd.bl1231.als.lbl.gov, but if you want to start a development version you can just check this code out and fire it up interactively.

Getting Started with Vite

This project uses Vite for bundling, to provide a dev server, and we are beginning to use the closly related Vitest to help us write unit tests. Have a look at the Vite documentation to see why we use it.

Available Scripts

There are a number of scripts defined in the package.json file:

  "scripts": {
    "clean": "rimraf dist/*",
    "dev": "GIT_HASH=$(git rev-parse --short HEAD) vite",
    "prebuild": "tsc",
    "build": "vite build",
    "lint": "eslint",
    "preview": "vite preview",
    "optimize": "vite optimize"
  }

npm run dev

Runs the app in the development mode, and will serve on port 3002.\

Open http://localhost:3002 to view the developemnt instance in the browser.

The page will automagically refresh if you make edits. You will also see any linting errors in the console.

npm run build

Will transpile the Typescript code using tsc then optimize for production. Output goes into dist directory.

npm run lint

Will run eslint on code.

Deploy production

The production instance is served from an ngnix Docker container. Have a look at the bilbomd-ui.dockerfile for details of the docker build. The entire production ecosystem is deployed as a single Docker compose setup. Details are in the bilbomd repo.

NERSC Notes

When deployed to NERSC/SPIN in order to develop the frontend with a simple npm run dev you must forward the backend proxy. We can expose a loadbalancing port from the Rancher K8 control plane and then use SSH tunnels.

ssh -L 3501:backend-loadbalancer.bilbomd.development.svc.spin.nersc.org:5432 perlmutter

Then you should be able to start a local development instance of bilbomd-ui with npm run dev and point your browser to localhost:3002 and you should be connected to the development backend service running on SPIN.

Authors

Version History