Skip to content

API service

The CADVault server is the central metadata service for every Viewer and add-in for SOLIDWORKS in a deployment. It runs as one Docker container that holds two processes: the API service and a file watcher that notices changes made to your CAD files outside CADVault. You fill in one compose file, start it once, and both run.

Using a Synology NAS? Read Synology NAS first: it covers the steps that differ there.

  • Docker with Compose: any Linux host, a NAS with a container app (Synology Container Manager, QNAP Container Station, Portainer), or Docker Desktop for a solo installation.
  • An x86-64 processor. The image is published for linux/amd64 only. On a Linux shell, uname -m must print x86_64.
  • Port 5080 free on the host. Workstations reach the server on this port. If something else already uses it, pick another free port in step 3.
  • Outbound internet access, to activate the license and to re-check it about once a day. Without contact, a paid license keeps working for 7 days and a trial for 48 hours. Between the workstations and the server, only the local network is used.

Create a project folder for CADVault, for example /srv/cadvault or /volume1/docker/cadvault, with one empty folder inside it:

cadvault/
├── compose.yaml (step 3)
└── cadvault-data/ (databases, identity, license state and logs)

Create cadvault-data yourself, before the first start. Some container apps, Synology’s among them, refuse to start a container whose folder does not exist yet.

Keep cadvault-data on persistent storage and include it in your backups. Your CAD files stay where they are: the container only reads them, through a read-only mount.

Save this as compose.yaml in the project folder and fill in the four marked values.

services:
cadvault:
container_name: cadvault
image: kamphuiscoding/cadvault:0
# Fetch the newest image on every build, so an update is one Build in a container app.
pull_policy: always
ports:
- "5080:8080"
volumes:
- ./cadvault-data:/data
# (1) Your CAD share, read-only. Left of the colon: the folder on this host.
- /volume1/Engineering:/watch/engineering:ro
environment:
- ASPNETCORE_ENVIRONMENT=Production
# (2) The administrator password for the server. Choose a long one.
- CADVAULT_ADMIN_PASSWORD=change-me
# (3) How workstations spell the share, mapped to the folder inside the container.
- 'WATCH_ROOT_MAP=\\nas\Engineering=/watch/engineering'
- WATCH_SCAN_INTERVAL_SECONDS=300
# (4) Optional: run as one of your host's accounts (see below).
# - PUID=1030
# - PGID=100
restart: unless-stopped

The port. 5080:8080 means host port 5080, container port 8080. Change only the left number if 5080 is taken on your host; 8080 is where the server listens inside the container. Workstations connect to http://<host>:5080, or the port you chose.

The CAD share (1) and its mapping (3). Mount the folder that holds your CAD files under /watch/<name>, always with :ro. Then tell the watcher how your workstations spell that folder: WATCH_ROOT_MAP maps the path a workstation uses to the folder inside the container. That path is the one you will use for the Managed Root in the Viewer: the UNC path of the share for a team, or a full local path such as D:\Engineering for a solo installation, never a mapped drive letter. Keep the single quotes around the line so the backslashes stay as they are. Several shares are separated by ;.

The network. Leave the container on Docker’s default bridge network. Do not add network_mode: host, and on a NAS leave options like “Use the same network as Docker Host” off. The API and the watcher talk to each other on a port that must stay inside the container.

The password (2). This is the break-glass admin password, at least 6 characters. On a new installation it is the only way into Settings → Admin in the Viewer, where you create the first administrator. It keeps working after that, as a way back in when no administrator is available. A changed password takes effect when the container is recreated (docker compose up -d); a plain restart keeps the old settings. Because of pull_policy: always, recreating it also installs the newest release.

The compose file holds this password, so make sure only administrators can read the project folder. If you prefer, put it in a .env file next to the compose file (CADVAULT_ADMIN_PASSWORD=...) and write CADVAULT_ADMIN_PASSWORD=${CADVAULT_ADMIN_PASSWORD} in the compose file instead.

Which account the server runs as (4). By default the server runs as user and group 1654, an account that exists only inside the container. That works, but folder rights on the host can then only reach it through a rule for everyone. With PUID and PGID the server runs as an account of your own host instead, so you grant rights to exactly that account:

  • PUID is the user id and PGID the group id of that account. On a Linux shell, id <name> prints both (uid=1030(cadvault) gid=100(users)).
  • The account needs read and write access to cadvault-data, and read access to the CAD share.
  • On the first start with these values, the server makes the account the owner of cadvault-data. Leave both lines out to keep 1654.
  • 0 is refused: the server never runs as root.

In the project folder:

Terminal window
docker compose up -d

The first start takes a little longer while the databases are created. Then check, from a workstation:

Terminal window
Invoke-RestMethod http://<host>:5080/api/v1/health

The answer shows healthy, the version and Production. Your container app shows the container as healthy once both the API and the watcher answer their health checks.

If the container keeps restarting, its log names the cause: an invalid PUID/PGID, a data folder the server cannot write, or a missing admin password.

The server is running but empty: no users, no license and no vault yet. You set all three up from the Viewer.

  1. Install CADVault on a workstation: see Workstation installer. On a solo installation with Docker Desktop on the same PC, the Viewer finds the server at http://localhost:5080 by itself. Elsewhere you enter http://<host>:5080, or the port you chose.
  2. Follow Set up your first vault: create your administrator account, activate a license or request the trial, and create the vault.

Every 0.x release lands on the image tag kamphuiscoding/cadvault:0. In the project folder:

Terminal window
docker compose pull && docker compose up -d

Your data stays in cadvault-data. During the restart the server is unavailable for about half a minute, so pick a quiet moment. The Viewer tells an administrator when the server runs behind the latest release, under Settings → Admin → Server updates.

Before the server updates the database of a vault, or the user database, it writes a copy of it to cadvault-data/backups (the user database to cadvault-data/backups/_identity). The file name holds the vault name and the moment of the backup in UTC, for example Engineering-20260915195203_AddDocumentSourceMetadataPending-20261017T093127Z.db. The newest three per database are kept. A release that does not change the databases makes no backup.

If a backup or an update fails, the server does not open that vault and leaves it as it was. The container then shows as unhealthy, and Settings → Admin → Server updates names the vault and the reason.

If a new release causes trouble, you can go back to the version you had, with your data as it was just before the update. Anything changed in CADVault after the update is lost, so go back soon after you notice the problem.

  1. Close CADVault on every workstation. A Viewer that stays open keeps showing what it read before, and saving from there would write it back over the restored data.
  2. Stop the server: docker compose down in the project folder.
  3. Put the backups back. Use only the backups this update made: the time at the end of the file name, in UTC, matches the moment you updated. An older backup belongs to an earlier update, and putting it back would throw away everything changed since then. For each vault with a backup of that moment in cadvault-data/backups, copy it over cadvault-data/<vault>.db. A vault without one was not changed by the update: leave its file as it is. Do the same for the user database, with a backup of that moment in cadvault-data/backups/_identity over cadvault-data/_identity/identity.db. Next to every database you replace, delete the .db-wal and .db-shm files with the same name if they are there: left behind, they can damage the restored database. Leave cadvault-data/_license as it is.
  4. Start the previous version. In compose.yaml, change the image line to the version you had, for example image: kamphuiscoding/cadvault:<previous version>, and run docker compose up -d.
  5. Open CADVault again and check under Settings → Admin → Server updates that the server runs the previous version.

Never skip step 3 for a database the update changed: an older server does not know what the update changed, so it refuses to open that vault and names it under Settings → Admin → Server updates. When you are ready to update again, put the image line back on kamphuiscoding/cadvault:0.

The standard compose file never updates by itself: a new release can migrate the databases on start, and you choose when that happens. If you prefer hands-off updates and a restart at night is acceptable, add Watchtower. Save this next to compose.yaml as compose.watchtower.yaml:

services:
cadvault:
labels:
- "com.centurylinklabs.watchtower.scope=cadvault"
watchtower:
container_name: cadvault-watchtower
image: containrrr/watchtower:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
- "com.centurylinklabs.watchtower.scope=cadvault"
command: --scope cadvault --schedule "0 0 3 * * *" --cleanup
restart: unless-stopped

Start both files together:

Terminal window
docker compose -f compose.yaml -f compose.watchtower.yaml up -d

Every night at 03:00 Watchtower checks kamphuiscoding/cadvault:0. Only when a new image is there does it recreate the CADVault container, and it then removes the old image. Your data stays in cadvault-data. The scope label keeps Watchtower away from every other container on the host.

Tested on DSM 7.3 with Container Manager. Follow steps 1 to 5 above, with these differences.

Before you start

  1. Check the port. Port 5000 belongs to DSM itself, which is why CADVault uses 5080. Open Control Panel > Info Center > Service and check that no service lists 5080 under Local Port.

  2. Create a DSM user for CADVault in Control Panel > User & Group > Create:

    • Name: cadvault. Give it a long random password; nobody ever logs in with it.
    • Group: only users.
    • Shared folder permissions: No access everywhere for now. You give it exactly the rights it needs in step 4.
    • Application permissions: Deny for every application.
  3. Look up the user’s two numbers. The compose file needs the user id and group id of cadvault, and DSM does not show them anywhere in its screens. You read them once, through a short SSH session from a Windows PC. This takes about five minutes, and you only type one command on the NAS.

    1. In DSM, open Control Panel > Terminal & SNMP, tick Enable SSH service, leave the port on 22 and choose Apply.

    2. On a Windows PC on the same network, open the Start menu, type PowerShell and open Windows PowerShell. SSH is built into Windows 10 and 11; you install nothing.

    3. Type the line below, with the name of your own DSM administrator account and the address of your NAS (the one you use to open DSM in the browser, without http:// and without the port), and press Enter:

      Terminal window
      ssh your-admin-name@192.168.1.20
    4. The first time, Windows asks Are you sure you want to continue connecting? Type yes and press Enter. This only happens once per NAS.

    5. Type the password of that DSM administrator account and press Enter. Nothing appears while you type, not even dots. That is normal. If the password was wrong, it simply asks again.

    6. You now see a prompt that ends in $. Type this and press Enter:

      Terminal window
      id cadvault

      The answer looks like uid=1030(cadvault) gid=100(users) groups=100(users). Write down the number after uid= (here 1030) and the number after gid= (here 100). These are your PUID and PGID.

    7. Type exit and press Enter, then close PowerShell.

    8. Back in Control Panel > Terminal & SNMP, untick Enable SSH service and choose Apply.

    If the ssh line answers Connection refused or timed out, SSH is not enabled yet or the address is wrong: check sub-step 1 and the address. If it answers Permission denied, the account is not a DSM administrator; only administrators may log in over SSH. If id cadvault answers no such user, check the spelling of the user from step 2.

  4. Give that user its rights, and no one else:

    • On the CAD share: Control Panel > Shared Folder > (your share) > Edit > Permissions, read only for cadvault.
    • Create the project folder docker/cadvault and, inside it, cadvault-data in File Station. On cadvault-data: read and write for cadvault.
    • On docker/cadvault: open Properties > Permission, make the inherited rules explicit and remove Everyone. The docker share can give Everyone read access, and this folder holds the compose file with the admin password. Administrators keep access, which is all Container Manager needs.

Creating the project

  1. In Container Manager, open Project > Create. Name it cadvault, choose the path /volume1/docker/cadvault, and as source Create docker-compose.yml.
  2. Paste the compose file from step 3 with all four values filled in, including PUID and PGID. Mount the share by its full path, for example "/volume1/Engineering:/watch/engineering:ro"; use double quotes if the folder name has a space.
  3. Finish the wizard. Container Manager downloads the image and starts the container.

Changing or updating later

  • After any change to the compose file: Stop, then Build. “Save changes only” followed by Start keeps the old container with its old settings.
  • Saving the compose file under Project > (your project) > YAML Configurations builds the project right away.
  • To update to a new release: Stop, then Build. Because of pull_policy: always in the compose file, Build downloads the newest kamphuiscoding/cadvault:0 and recreates the container; the data stays.
  • Installed before this line was in the compose file? Add pull_policy: always under the image: line in YAML Configurations and save. Without it, Build keeps the image it already has. Until you add it, update by deleting the CADVault image on the Image tab first, then choose Build.
  • To go back to the previous version (see Going back to the previous version for what it does):
    1. Close CADVault on every workstation. In Container Manager, open Project, select the project and choose Stop.

    2. In File Station, open docker/cadvault/cadvault-data/backups. Use only the backups whose time at the end of the name (UTC) matches the moment you updated; older files belong to an earlier update. A vault without such a backup stays as it is. For each vault with one:

      • In cadvault-data, delete <vault>.db, and <vault>.db-wal and <vault>.db-shm if they are there.
      • Right-click the backup, choose Copy to, and pick cadvault-data.
      • In cadvault-data, right-click the copy, choose Rename and name it <vault>.db.

      If backups/_identity holds a backup of the same moment, do the same for the user database in cadvault-data/_identity: delete identity.db, identity.db-wal and identity.db-shm, copy the backup there and rename it to identity.db.

    3. Open Project > (your project) > YAML Configurations, change the image line to the version you had, for example image: kamphuiscoding/cadvault:<previous version>, and choose Save. Saving builds and starts the project, which is why the backups go back first.

    4. Open CADVault on the workstations again.

  • If Container Manager afterwards shows the container under a temporary name like 1a2b3c4d_cadvault and its buttons fail with “Container undefined does not exist”, restart Container Manager: Package Center > Container Manager > Stop, then Run.