Files

23 KiB
Raw Permalink Blame History

Deployment and releases

Web Slicer runs as an application container and a small web proxy. Both use the same release tag. The root Compose file pulls images; it never starts a compiler as a side effect of installation. Alpha images in the karol namespace are public and can be pulled without registry authentication.

Runtime installation

Install Docker Engine and Compose v2 with up --wait support. For released Linux x86-64 images, only compose.yaml and .env are needed in the same directory. Copy compose.yaml and .env.example from the repository, rename .env.example to .env, create the data directory, and run:

mkdir -p data
docker compose up -d --wait
docker compose ps
curl --fail http://localhost:8080/api/v1/liveness

The app health check verifies API liveness. Authenticated /api/v1/health also exercises the native worker protocol. The web health check checks Nginx independently. docker compose logs --tail=100 app web shows recent logs; each container rotates three files of at most 10 MiB.

The host directory ./data, relative to compose.yaml, is bind-mounted at /data and contains project files, revisions, job artifacts, SQLite state, saved connections and backups. Create it before starting. The image runs as UID/GID 1000:1000; on Linux, if the directory is not writable by that user, run sudo chown 1000:1000 data. Compose does not create a missing host directory. Container replacement, project-name changes and docker compose down -v do not remove this directory. Two Compose projects using the same Compose file share the same data path; a different project name does not isolate storage. Do not mount a temporary or in-memory directory at /data.

Existing installations using a named volume are not migrated automatically. Stop the old application and copy its complete /data, including ownership, into the new host directory before switching. Preserve the original volume until the migrated installation and its accounts have been verified.

Only the web service publishes a port. Local authentication is required by default; without accounts the application stays locked. Create the first administrator from a trusted terminal (the password is prompted, never passed as a command argument):

docker compose exec app python -m orca_web.auth_cli create-admin admin

Use Users in the administration menu to create accounts, grant or remove administrator privileges, disable accounts and reset passwords. Users can change their own password. Blocking an account, changing its role or resetting/changing its password invalidates all its sessions. The last active administrator cannot be disabled or demoted through the API. Terminal access permits recovery:

docker compose exec app python -m orca_web.auth_cli reset-password admin
docker compose exec app python -m orca_web.auth_cli list-users
docker compose exec app python -m orca_web.auth_cli revoke-sessions

Projects and physical printers have separate owners and permissions. New ordinary accounts cannot add printers until an administrator grants that capability. Before enabling account permissions on existing shared data, assign the unowned projects and physical printers to the intended administrator:

docker compose exec app python -m orca_web.auth_cli assign-existing admin

This command is retryable and preserves resources which already have owners. New projects belong to their creator; copying a shared project gives ownership of the independent copy, without granting access to its physical printer. Backups, executable-plugin changes, instance diagnostics and cloud-account mutations require an administrator. Authentication does not sandbox native parsers or installed plugins; keep the application and dependencies updated.

Internet-facing installations must use HTTPS. Keep ORCA_AUTH_REQUIRED=true and ORCA_AUTH_SECURE_COOKIE=true, set the exact HTTPS browser origin in ORCA_ALLOWED_ORIGINS, and expose only the TLS reverse proxy. Bind the web port to loopback when that proxy runs on the host. Enable HSTS at the TLS proxy after verifying HTTPS works for the chosen hostname. Do not publish the app container's port or unauthenticated alternate ingress paths. Device-panel subdomains also need HTTPS and must reach the same protected backend.

For HTTP development on a trusted LAN only, explicitly set ORCA_AUTH_SECURE_COOKIE=false. ORCA_AUTH_REQUIRED=false restores the previous unauthenticated mode and is unsuitable for internet exposure. There is no public registration or web-based first-administrator setup.

Sessions expire after 12 hours and after one hour without authenticated requests. Login attempts are persistently limited per normalized account, network peer and instance, with a separate bound on concurrent password hashes. The peer is the ASGI client address; the app does not parse caller-supplied forwarding headers. If configuring Uvicorn proxy trust, trust only the actual proxy addresses, never an unrestricted source. Users behind the same proxy may share its rate limit. Revocation closes existing API streams and panel WebSockets within ten seconds; new requests fail immediately. Public /api/v1/liveness reports liveness without starting a native worker; authenticated /api/v1/health requests perform the full worker check.

LAN printer discovery runs in the app container's network namespace. Bambu searches listen for announcements on UDP 2021; those LAN broadcasts must reach that namespace. Docker bridge networking and VLAN boundaries can prevent their arrival. Use direct IP configuration when broadcasts cannot reach the app.

Prusa Connect Local

Pair the printer with your self-hosted Prusa Connect server. In Prusa Connect, open Settings → API credentials and create a token. The token acts within the permissions of the Prusa account that issued it. Use read for printer status, firmware, history and camera viewing. Use operate for browsing printer storage, uploading and starting G-code, and controlling a running print. Configure a writable storage resource on the Prusa Connect server for uploads and keep a writable USB drive in the printer for transferring an upload to it.

In Web Slicer, open the connection settings of the physical printer and choose Prusa Connect Local. Enter the server URL as reachable from the Web Slicer backend and paste the token in API token. Save, select the printer from the server's list, and save the selection. For a local HTTPS certificate, provide the issuing CA in the connection settings.

Prusa Connect cloud sign-in

Use the public HTTPS address of your Web Slicer deployment for the OAuth callback. Register a public OAuth client for that exact callback using Prusa MCP's OAuth server metadata. For an installation without an existing client ID, the published registration endpoint accepts a dynamic client registration:

curl --fail-with-body https://mcp.prusa3d.com/register \
  -H 'Content-Type: application/json' \
  -d '{
    "client_name": "Web Slicer",
    "redirect_uris": ["https://slicer.example.com/api/v1/oauth/prusaconnect/callback"],
    "grant_types": ["authorization_code", "refresh_token"],
    "response_types": ["code"],
    "token_endpoint_auth_method": "none"
  }'

Set ORCA_PRUSACONNECT_OAUTH_CLIENT_ID to the returned client_id and ORCA_PRUSACONNECT_OAUTH_REDIRECT_URI to the registered callback. Restart the application. In the settings of a saved Prusa Connect printer, sign in with your Prusa account. The connection's Diagnostics can then show the MCP tools that the authorized account can access. File upload continues to use the printer's own Prusa Connect key.

Reverse proxies

Set the complete public browser origins in .env, for example:

ORCA_ALLOWED_ORIGINS=https://slicer.example.com,https://slicer.home.example.com

Forward the whole site, including /api/, to the web container. Preserve Host, disable response buffering for job events and long previews, allow model uploads of up to 520 MiB including multipart overhead, and use suitable timeouts for large downloads. A proxy on the Docker host can use LAN_BIND=127.0.0.1; a proxy in a different container cannot reach that host loopback unless explicitly configured.

Do not record authorization callback query strings or tokens in proxy logs. TLS termination does not automatically add an origin to the allowlist.

For an independent web-client host, build the client with VITE_ORCA_API_URL=https://api.example.com/api/v1, add its browser origin to ORCA_ALLOWED_ORIGINS, and serve the generated assets on that host. The default same-origin deployment does not require this build setting. With local login, use HTTPS hosts within the same site (for example slicer.example.com and api.example.com). Session cookies use SameSite=Lax; cross-site XHR authentication is intentionally unsupported. A same-origin proxy is the recommended deployment. Do not configure a wildcard cookie domain: device panels and untrusted sibling subdomains must not receive application cookies.

Building a release

This is a maintainer operation, not a user installation requirement. Images are not published by pushing Git alone. No registry credentials are stored in this repository. Inherited upstream workflows have been removed from the active Actions directories; this fork currently has no automatic Actions pipeline.

The source Dockerfiles build native dependencies, the C++ worker, Emscripten preview, client and Python API. Cold builds are expensive; the publication cleanup did not rerun a full cold build or establish a minimum disk budget. Use a dedicated builder, preserve its dependency cache, and do not build on a busy host. Native and WebAssembly compilation uses up to six jobs. Dependency superbuilds run one outer operation at a time, with six jobs inside CMake dependencies. Build work runs at CPU weight 20 against the default 100, so host services keep priority under contention while idle CPU remains available to the build. Make-based libtool/assembler dependencies use one job because their wrappers otherwise exceed the 64-task budget. OpenSSL's processor detection is constrained to the requested job count during configuration.

Commit the release source first. Prepare metadata from that exact clean commit:

python3 web/scripts/check-publication.py
python3 web/scripts/prepare-release.py --version 0.2.0-alpha \
  --image-prefix gitea.labus.uk/karol/web-slicer

This writes ignored .release/release.json and .release/build.env. It records the full commit SHA, corresponding Gitea source URL and matching image tag. It does not tag, publish, upload, or change the working tree's source files. The image owner may differ from the source repository owner; images and source both belong to karol on the same registry host, so the packages can be linked to the repository. ORCA_IMAGE_PREFIX overrides the image prefix in build-release.sh.

Install Docker Buildx first (docker buildx version must succeed). Provision a dedicated, explicitly resource-limited BuildKit docker-container builder once:

python3 web/scripts/prepare-builder.py
sudo -v
python3 web/scripts/prepare-builder.py --configure-swap

Task and I/O limits are applied before the container's first start. CPU and RAM are uncapped. The one-time --configure-swap step uses local sudo to set MemorySwapMax=0 on this builder's systemd scope and verifies the actual kernel limit. Repeat it after restarting/recreating the builder or rebooting the host. build-release.sh verifies that policy before building; an already configured builder requires no sudo. This requires a local Linux daemon with systemd and cgroup v2, because Docker's CLI cannot express unlimited RAM together with disabled swap. The script resolves the devices behind Docker storage (including Btrfs and partition-to-disk mapping), limits BuildKit to one concurrent operation, and preserves its named cache volume. It refuses existing builders instead of replacing their configuration or cache. Buildx uses a privileged BuildKit container; use a trusted build host.

A host whose containers see no block device nodes (for example an LXC container running Docker) cannot express the two disk throughput limits. With the maintainer's consent, set ORCA_BUILDER_UNTHROTTLED_IO=1 for prepare-builder.py and build-release.sh: the builder keeps its task limit, CPU weight, no-swap policy and single BuildKit operation, and only disk I/O is left unthrottled.

The builder runs six compiler jobs. Make-based dependencies start one compiler pipeline per job inside the builder's 64-task budget together with BuildKit itself; if a step fails with vfork: Resource temporarily unavailable, set ORCA_BUILD_JOBS (1–6) for build-release.sh, for example ORCA_BUILD_JOBS=4.

Build the prepared release from an interactive terminal:

bash web/scripts/build-release.sh 0.2.0-alpha

This checks publication hygiene and the clean source revision, prepares metadata, verifies builder policy, and runs build-images.py followed by verify-release.py through run-bounded.py. The guard runs each command in a transient systemd unit. It uses systemd --user when that manager has delegated memory, I/O and process controllers, and otherwise the system manager through non-interactive sudo (containers often do not delegate the I/O controller). Before the command starts, the unit checks its own cgroup for the swap, task and disk limits and refuses to run if any is missing; it never falls back to running commands outside the guard. The logs are .release/build.log and .release/verify.log; .release/build.exit-code contains running during the build and the exit code after completion. These files are local, ignored output. Nothing is pushed, tagged or published.

The script verifies no swap, at most 64 tasks and disk read/write limits of at most 20/10 MiB/s on the Linux homelab. CPU and RAM are uncapped, as authorized by the maintainer. It serializes app/client/demo builds, uses a three-hour overall deadline, and does not retry outside the limits. A cold build that exceeds the deadline is incomplete; diagnose it before changing the build process. The ordinary run-bounded.py wrapper alone does not constrain Docker daemon work. Its disposable files live under ignored .work-tmp/ in the disk-backed checkout, because /tmp may be a memory filesystem. It refuses a memory-backed checkout.

Provisioning the builder is an explicit administrator task. Docker's docker-container driver supports memory, swap and CPU limits. Its container/cgroup must also have the task and device-I/O limits above. Do not silently fall back to the default builder. Existing live containers and volumes are unrelated to build caches.

After a successful build, validate the loaded images before publication:

python3 web/scripts/run-bounded.py -- python3 web/scripts/verify-release.py

This checks source/version labels, native health, creating a physical-machine library entry, model import, slicing, preview/G-code/3MF artifacts, static web/demo delivery and persistence across an application restart. It uses a unique network and disposable volume, applies explicit container resource limits, and connects to no physical printer. It removes its containers and data afterwards, preserving .release/validation-receipt.json and service logs. The receipt records exact image IDs. Browser rendering and physical-printer checks are separate verification.

Start the locally loaded images with the generated version explicitly:

docker compose --env-file .env --env-file .release/build.env up -d --wait

For an alpha release use the same version (for example 0.2.0-alpha) for all images and a Git tag such as v0.2.0-alpha. Keep the verification receipt and describe the verification actually completed. A Gitea release is not required.

Publishing images to the registry

Run these commands from the repository root after build-release.sh VERSION finishes successfully. Building images and pushing Git do not upload images; publication is a separate docker compose push operation. Before publishing, check that .release/validation-receipt.json has status: "passed", that its revision matches .release/release.json and the clean source commit, and that its image IDs match the local images. .release/build.exit-code alone only records the image build result, not the subsequent validation result.

The current registry is gitea.labus.uk. Images belong to the karol account:

  • gitea.labus.uk/karol/web-slicer-app:VERSION — API and native slicing engine.
  • gitea.labus.uk/karol/web-slicer-web:VERSION — web client and API proxy.
  • gitea.labus.uk/karol/web-slicer-demo:VERSION — optional static demo.

Use the version from the validated build, including an alpha suffix when applicable. The generated .release/build.env selects the exact image prefix and tag for all three services. Do not replace it with a new version after validation or overwrite an existing published tag.

Push the validated source commit to the source repository first. Authenticate with an account/token allowed to write packages in the karol namespace; repository collaborator permissions alone do not grant that package access. Enter the password or token at the Docker prompt, never in a committed file:

git push origin main
docker login gitea.labus.uk --username karol
docker compose --profile demo --env-file .release/build.env -f compose.yaml push app web demo

This uploads the already built images; it does not compile or start containers. The demo profile is included so all three versioned artifacts are published. If one push fails, finish publishing the same validated image set before advertising the new version.

Verify each remote image with docker buildx imagetools inspect, using the version just published. For example, for 0.2.0-alpha:

docker buildx imagetools inspect gitea.labus.uk/karol/web-slicer-app:0.2.0-alpha
docker buildx imagetools inspect gitea.labus.uk/karol/web-slicer-web:0.2.0-alpha
docker buildx imagetools inspect gitea.labus.uk/karol/web-slicer-demo:0.2.0-alpha

Compare the registry digests with the push results and confirm all images use the intended version and source revision. The karol profile is public, so these images are intended for anonymous pulls. Verify anonymous access with a Docker client that has no saved registry credentials. Publishing to another personal namespace requires checking that owner's package visibility; source repository visibility and package visibility are separate settings.

Create and push an annotated Git tag at the validated source commit, for example v0.2.0-alpha for image version 0.2.0-alpha. Keep tags immutable. Update README, the default image tags in compose.yaml and .env.example, and any version examples in the documentation when selecting a new default version. Changes intended to be part of the published source must be committed before building; later documentation-only changes do not retag existing images.

Keep validation receipts and describe architecture, validation performed and known limitations. Users need only compose.yaml and .env. Do not create a Gitea release or upload release attachments. Do not advertise images before the registry and startup of the published images have been checked.

The web image serves portable Linux and Windows Bambu desktop helper archives under /bambu-login/. They are built from the helper source in the same revision. Bambu Cloud itself requires separately supplied native host and networking plugin binaries configured through ORCA_BAMBU_CLOUD_HOST and ORCA_BAMBU_CLOUD_PLUGIN. The standard app image does not include those binaries.

Public static demo

The optional demo image uses the same GUI build and release tag. It contains three MIT-licensed example models, prepared toolpaths and source/license links. Settings fields can change locally; prepared models and toolpaths stay fixed. There is no application API, slicing worker, live printer connection or data volume in this image. The demo service uses its own network and resource limits.

Start only the static service, without starting the application:

docker compose --profile demo pull demo
docker compose --profile demo up -d --no-deps --wait demo
curl --fail http://127.0.0.1:8082/healthz

It binds to loopback by default. Set DEMO_PORT/DEMO_BIND for the intended hosting setup and publish it through a separate HTTPS reverse-proxy host. Route that public host only to the demo port; keep the main application host separate. Updating ORCA_IMAGE_TAG and recreating demo updates its GUI together with the main release. For file-only hosting, publish web/frontend/dist-demo/ after the regular frontend build. See the static-demo design.

Updates

Wait for active slicing, transfers and downloads to finish. Back up first, set the services to the new ORCA_IMAGE_TAG, then:

docker compose pull
docker compose up -d --wait
docker compose ps

Container replacement interrupts active transfers and native operations. Saved projects remain in the volume. Keep the prior image pair and matching backup; older code may not understand newer storage migrations.

Backup and restore

Stop the application before making a complete consistent archive. Back up all of /data, not just SQLite. Backups may contain credentials and private models. Use restrictive permissions and private storage. To save an archive without temporarily duplicating it inside the data volume:

umask 077
docker compose stop
docker compose run --rm --no-deps -T --entrypoint tar app -C /data -czf - . > web-slicer-data.tar.gz
docker compose up -d --wait

Local credentials are stored separately in /data/auth/accounts.sqlite, with a private directory and database permissions on POSIX; on Windows, restrict the data directory using filesystem ACLs. Passwords use Argon2id; only session-token hashes are stored. The in-app slicer ZIP backups do not include this authentication database. The complete data archive above includes it and is required to preserve accounts. Treat full archives as credentials: do not publish them, encrypt them in your backup system, and restrict access to their storage.

Check the command's exit status and validate the archive before relying on it. Record image tags and source revision with the backup. Restore with the matching release in a separate directory. Copy compose.yaml and .env there, create an empty data directory with the ownership described above, and run these commands from that directory. A different project name alone does not isolate the bind-mounted data:

docker compose -p slicer-restore run --rm --no-deps -T --entrypoint tar app -C /data -xzf - < web-slicer-data.tar.gz
docker compose -p slicer-restore run --rm --no-deps --entrypoint python app -m orca_web.auth_cli revoke-sessions
docker compose -p slicer-restore up -d --wait

Stop the original project before restoring on the same port, or set a different WEB_PORT. Retain the original data directory until recovery has been verified.