Domain data (e.g., products, tax rates) is data that is mutated on Vori's servers (typically by Dashboard users). This data is consumed by the POS to facilitate shopper checkout. We use LiteFS Cloud to automatically replicate a SQLite database generated by Vori.
LiteFS requires a virtual filesystem that does not run on macOS, so we run it in a Docker container. Things get more
complicated as we need to make the data on the virtual filesystem in the Docker container visible to the host. We cannot
simply expose a host volume because it is not compatible with the virtual filesystem. Thus, we have a somewhat-hacky
solution. fswatch
polls the directory where LiteFS tracks internal state, and copies the database to a shared host
volume. This is not ideal, but it works well enough for our purposes.
This service is distributed via Homebrew.
brew tap voriteam/voripos
brew install voripos-domain-sync
brew services start voripos-domain-sync
A LiteFS Cloud token is required to set up syncing. This can be pulled from Fly.io, or ask in #engineering.
Add the token to the .env
file, and start Docker Compose with:
docker compose up
This will connect to LiteFS Cloud and download the database to ~/Library/Containers/com.vori.VoriPOS/Data/Library/Application Support/Domain.sqlite3
.
When the database is synced, a query is run to output the DB metadata and row counts. If you don't see this after a few
seconds, something may be wrong with the configuration.
You may see other database names when connecting to the vori-demo
cluster. These can be ignored.
LiteFS Cloud does not currently support complete database deletion, and we aren't copying these to the host volume.
Need to start from scratch? Kill the containers and restart.
docker compose down
The Docker image is pulled by the POS machines. If you change the image, push it!
You may need to set up a builder:
docker buildx create --name mybuilder --bootstrap --use
This command will build and push the images for both dev and production:
docker buildx build --platform linux/amd64,linux/arm64 -t us-docker.pkg.dev/vori-dev/pos/domain-data:latest -t us-docker.pkg.dev/vori-1bdf0/pos/domain-data:latest --push .
- Update
VORIPOS_DOMAIN_SYNC_VERSION
. - Create a release on GitHub.
- Follow the instructions at https://github.com/voriteam/homebrew-voripos to update the tap with the latest version.