Install from source
Until there's a package, the PDM is built from its repository.
git clone https://github.com/awv-informatik/classcad-pdm.git
cd classcad-pdm
yarn install --frozen-lockfile # also checks out the editor, packages/buerligons
cp .env.example .env # then fill it in: see Configuration
Build the three parts:
yarn workspace @classcad/pdm-api build
yarn workspace @classcad/pdm-worker build
yarn workspace @classcad/pdm-web build
The web build reads the editor's settings (CLASSCAD_WASM_KEY, EDITOR_RUNTIME, EDITOR_CC_URL) from .env while it builds, so set those first. The result is packages/web/dist: static files for your reverse proxy.
Start
In this order: Postgres, the API, the scheduler with its engines, then the workers.
# the API: runs pending migrations, then listens on HOST:PORT
cd packages/api && node dist/main
# a job worker; start as many as you like
cd packages/worker && node dist/main.js
Both read .env from where they're started and from the repository root, and real environment variables win over both. Start the scheduler as The scheduler shows and point the workers at it with CC_URL.
Check that the API is up:
curl http://127.0.0.1:3333/api/v1/health
# {"status":"ok","database":"up","storage":{"provider":"fs","status":"up"}}
As services
On Linux, a systemd unit per part keeps them running. A template unit runs as many workers as you want:
# /etc/systemd/system/pdm-worker@.service
[Unit]
Description=ClassCAD PDM job worker %i
After=network.target
[Service]
WorkingDirectory=/srv/classcad-pdm/packages/worker
Environment=WORKER_ID=%H:%i
ExecStart=/usr/bin/node dist/main.js
Restart=always
[Install]
WantedBy=multi-user.target
systemctl enable --now pdm-worker@1 pdm-worker@2
The API's unit looks the same, with WorkingDirectory=/srv/classcad-pdm/packages/api and ExecStart=/usr/bin/node dist/main.
Updating
Stop the workers, then the API. Back up the database and the files. Pull, install and build again, then start the API (it migrates the database on start) and the workers.