Skip to content

NTUEELightDance/LightDance-Editor

Repository files navigation

Logo

NTUEE LightDance Editor

Release Contributors License

An online editor to design, simulate and control the lights

Architecture

image

Services

http://localhost:4000 - editor-server
http://localhost:8081 - file-server
http://localhost:8082 - controller-server

Development

Local

Install Pre-Commit

# in Lightdance-Editor
pre-commit install

Configure node environment

# in Lightdance-Editor
nvm install
corepack enable
corepack install

Then by executing nvm use you can choose the specified version of node and pnpm

Start database

copy the environment variables for development

# in Lightdance-Editor/editor-server
cp .env.development .env

start mySQL and redisDB

# in Lightdance-Editor
docker compose -f dev.docker-compose.yml up -d

migrate the database

# in Lightdance-Editor/editor-server
cargo prisma migrate dev --skip-generate --name init

Install the dependencies

This will install all dependencies for the app.

# in Lightdance-Editor
pnpm install:all

This will setup a venv for python (>3.10 recommended), remember to select it as interpreter before developing frontend.

Run all services

There are the services you'll need to run if you are developing editor-server. You need to start all of them manually. Run these commands in different terminals respectively, in the order shown below:

pnpm dev:file-server
pnpm dev:editor-server

If you are developing the command center, you may also need to run:

# in Lightdance-Editor/controller-server
cp .env.defaults .env

# in Lightdance-Editor
pnpm dev:controller-server

To pack the frontend blender add-on, run:

pnpm dev:pack # For local development
pnpm prod:pack # For production

The packed file will be stored at ./editor-blender.zip , to install the add-on, see Blender Add-ons Documentation.

Run all services in parallel

This command runs all services in parallel. This is useful for demo, yet not recommended in development.

pnpm dev

Initialize Database: Development

If you are running this for the first time, you need to initialize the database for things to work.

# Lightdance-Editor/utils
pnpm install
node initDB.js jsons/exportDataEmpty.json

Production

Start all services

docker compose -f prod-support/prod.docker-compose.yml up -d

Editor-server will run on http://localhost:4000.

Initialize Database: Production

After starting all services, one must initialize the database.

# Lightdance-Editor/utils
export NODE_OPTIONS="--max-old-space-size=8192"
pnpm install
node initDB.js jsons/exportDataEmpty.json

Configurations and Utilities

Refer to utils/README.md for editor configurations and utility usage.