Giter Site home page Giter Site logo

virtool-ui's Introduction

virtool-ui

The browser frontend for Virtool

What's Included

  • Frontend code based in React
  • A Express server that serves frontend resources, CSP headers, and nonces.
  • Dockerfile

Using in Production

The default CSP configuration expects API requests to be made to the same domain as the client is served from.

Path Description Example
/api Should route to API server https://app.virtool.ca/api
/ Should route to UI server https://app.virtool.ca/samples

Configuration

Option Env Description
-p, --port VT_UI_PORT The port the UI server should listen on
-H, --host VT_UI_HOST The host the UI server should listen on
-a, --api-url VT_UI_API_URL The URL API requests should be made to
-P, --use-proxy VT_UI_USE_PROXY Proxy API requests through the UI server
--sentry-dsn VT_UI_SENTRY_DSN The DSN that sentry will send logged errors to

API Proxy

Use the API proxy during development to avoid CORS and CSP issues due to server the UI and API servers at two different addresses.

The proxy works by proxying requests from the client to /api routes to the provided --api-url. This satisfies the CSP because all requests are sent to the UI server address (usually http://localhost:9900)

In production, use a reverse proxy like NGINX or similar solution to route requests to the appropriate service The API proxy is not suitable for production.

Development

Dependencies

  • Docker
  • Node.js
  • git

Working on virtool-ui

Use this guide when you are contributing to virtool/ui.

  1. Clone the repository onto your local machine

    git clone https://github.com/virtool/virtool-ui.git
    
  2. Install packages

    npm i
    
  3. Start backend services:

    docker-compose up -d
    
  4. Start either the development server:

    npm run startDev
    

Working with virtool/ui image

Use this guide when you are contributing to another Virtool service and need to stand up the UI server.

In this example, we are working on virtool/virtool on localhost and want to deploy ui in Docker Compose. We want ui to proxy API requests to virtool/virtool.

Use docker-compose to configure a ui service and any other services you need (eg. workflows, databases):

ui:
  image: virtool/ui:latest
   ports:
     - "9900:9900"
   environment:
     VT_UI_HOST: "0.0.0.0"
     VT_UI_PORT: 9900 # Default port
     VT_UI_API_URL: http://host.docker.internal:9950
     VT_UI_USE_PROXY: true
   extra_hosts:
     - "host.docker.internal:host-gateway"

The service (eg. Virtool API server) running on localhost must listen on 0.0.0.0 for this to work.

virtool-ui's People

Contributors

reecehoffmann avatar igboyes avatar elanjm12 avatar dependabot[bot] avatar deepsource-autofix[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.