Skip to content

clelandlab/grapher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ClelandLab Grapher

This is an open-source component of LabWeb

image

Get Started

It requires some web knowledge to config everything properly. But with AI's help, you should be able to get it done quickly.

0. Prerequisites

You need Node.js installed on your system. You can download it from nodejs.org.

1. Config

create a config.js file in the root directory with the following content:

export default {
  port: 11112, // backend server port
  dataPrefix: 'V:/path/prefix', // for permission control
  tokenPath: '.',
  // if you want to map between user-input path and data-storage path, use the following line
  pathMap: path => path.replaceAll('\\', '/').replace(/^V:/, '/mnt/V')
}

2. Start Backend

To just run the backend server, use the following command:

node .

However, you may want to use the pm2 process manager to keep the server running in the background.

pm2 start . --name grapher

When the backend starts, a token will be generated in the tokenPath specified in the config file. You will need this token to access the Grapher frontend.

3. Build Frontend

cd web

# install dependencies
npm install

# build the frontend
npm run build

Now the frontend files will be generated in web/build folder. You can use whatever static file server to serve these files, like Nginx. Make sure to config the route such that /srpc goes to the backend server. For example, to put both frontend and backend in the route /G/ in Nginx config:

location /G/srpc {
    proxy_pass http://localhost:11112/;
}

location /G/ {
    alias  /opt/grapher/web/build/;
    index  index.html;
}

Protocol

The Frontend and Backend communicate via SRPC. The interfaces are:

srpc.grapher.auth(token)
srpc.grapher.getList(token, path)
srpc.grapher.writeYML(token, path, data)
srpc.grapher.get(token, path, meta = true, lastSize = 0)
srpc.grapher.createDir(token, path, dirName)

About

An open-source component of LabWeb

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published