|
|
3 weeks ago | |
|---|---|---|
| .. | ||
| .env.example | 3 weeks ago | |
| .gitignore | 3 weeks ago | |
| Dockerfile | 3 weeks ago | |
| README.md | 3 weeks ago | |
| docker-compose.yml | 3 weeks ago | |
| entrypoint.sh | 3 weeks ago | |
| fetch-debs.sh | 3 weeks ago | |
| run-tests.sh | 1 month ago | |
Runs smartbotic-database + smartbotic-vectorapi from release .debs in a
Debian 13 container, so the web UI can be developed against a real backend.
Why this exists: the Void dev host cannot build the stack natively any more.
Void moved to protobuf 35, which removed google/protobuf/map_field_inl.h; the
database's generated protos include it, so libsmartbotic-db-client no longer
compiles or links there. Debian 13 pins the versions the code expects.
# 1. put the .debs here (server from dist/debian13, DB + client from the deb repo)
mkdir -p debs && cp ../../dist/debian13/smartbotic-vectorapi_*_amd64.deb \
"$DEB_REPO_DIR"/dist/smartbotic-database_2.11.3-1_amd64.deb \
"$DEB_REPO_DIR"/dist/libsmartbotic-db-client_2.11.3-1_amd64.deb debs/
# 2. build and run; the admin key is whatever you seed here
docker build -t svapi-devstack .
docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svapi-devstack
# 3. the Vite dev server already proxies /api and /ui to localhost:8080
cd ../../webui && npm run dev # http://localhost:3000
docker logs svapi-dev shows both services. The container has no systemd, so the
entrypoint starts the database, waits for :9004, then execs the API; systemctl
is a no-op shim purely so the packages' postinst scripts configure cleanly.
docker-compose.yml runs the same image with the RAM and CPU count as the two
things you turn, so "would more memory fix this" becomes a measurement instead
of an argument. Everything machine-specific lives in .env (gitignored, because
DEVSTACK_DATA_DIR points at a copy of real tenant data) - the committed files
contain no paths, hostnames or versions of their own.
cp .env.example .env && $EDITOR .env # versions, limits, data dir
./fetch-debs.sh # stage exactly those deb versions
docker compose build && docker compose up -d
curl -fsS localhost:"${DEVSTACK_PORT:-8099}"/healthz
Modelling a specific box takes BOTH cpu settings, and this is the part that is
easy to get wrong. cpus is a CPU-time quota: it bounds throughput
correctly, but the container still sees every host core. Measured here:
cpus: 2 on a 32-core host still reported nproc=32, and cpp-httplib sizes its
request pool from hardware_concurrency, so vectorapi would have run 31
request threads where a real 2-core box runs 8. cpuset fixes the count as
well as the quota. Verify both from inside rather than trusting the file:
docker compose exec devstack sh -c 'nproc; cat /sys/fs/cgroup/cpu.max /sys/fs/cgroup/memory.max'
Swap is not controlled by this file. memswap_limit equal to mem_limit
asks for none, and docker inspect --format '{{.HostConfig.MemorySwap}}'
reported -1 (unlimited) anyway. What actually guaranteed no swapping was the
host having no swap device. Read swapon --show on the host before quoting
any memory figure from this container, because a result measured with swap
available is a result about swap.
DEVSTACK_DATA_DIR must be a copy, never a live directory. Copy the whole
data directory: a snapshot plus the WAL is the server's own recovery input,
not a copy of the dataset, so projects/ (the authoritative LMDB store) has to
come too. Superseded snapshots can be left behind - the server loads only the
newest - which is usually most of the bytes.
# streamed, so nothing is staged on the source box's disk
ssh HOST 'sudo tar -cf - -C /var/lib/smartbotic-database \
storage.key encryption-at-rest.v1 files projects history wal \
snapshots/<newest>.dat' | tar -xf - -C "$DEVSTACK_DATA_DIR"
Also bind-mount that box's own config.json and conf.d/
(DEVSTACK_DB_CONFIG, DEVSTACK_DB_CONFD), or the stack under test runs on
the package's default memory budget rather than the deployment's.
Verify the copy loaded before believing any timing from it. The boot line
Recovery complete (...): N docs in M collections must match the source box's
own document count - and for a vector collection, run one search and check the
ranking, because a document count cannot see a vector stored in the wrong field
or lost in transit.
The data directory is encrypted at rest, so storage.key travels with it. That
makes the copy as sensitive as the original: keep it mode 700 and delete it when
the measurement is done.