langbrain/Weaviate.md

2.6 KiB

collection type
tech database

Intro

Weaviate is an open-source vector database. It allows you to store data objects and vector embeddings from your favourite ML-models, and scale seamlessly into billions of data objects.

Docker install

Prerequisite

You must have Docker installed on the server you're gonna run.

Configuration

API key

services:
  weaviate:
    ...
    environment:
      ...
      # Enables API key authentication.
      AUTHENTICATION_APIKEY_ENABLED: 'true'

      # List one or more keys, separated by commas. 
      # Each key corresponds to a specific user identity below.
      AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'jane-secret-key,anon-secret-key'

      # List one or more user identities, separated by commas. 
      # Each identity corresponds to a specific key above.
      AUTHENTICATION_APIKEY_USERS: 'jane,anon'

source

Authorization

services:
  weaviate:
    ...
    environment:
      ...
      # Enables API key authentication.
      AUTHENTICATION_APIKEY_ENABLED: 'true'

      # List one or more keys, separated by commas. 
      # Each key corresponds to a specific user identity below.
      AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'jane-secret-key,anon-secret-key'

      # List one or more user identities, separated by commas. 
      # Each identity corresponds to a specific key above.
      AUTHENTICATION_APIKEY_USERS: 'jane,anon'
      AUTHORIZATION_ADMINLIST_ENABLED: 'true'
      AUTHORIZATION_ADMINLIST_USERS: 'jane'
      AUTHORIZATION_ADMINLIST_READONLY_USERS: 'anon'

source

Persistence

services:  
  weaviate:  
    volumes:  
      - /path/to/weaviate/data:/var/lib/weaviate

Replace /path/to/weaviate/data to the path where you want to store the weaviate data on your server

Running the Docker container

Manual start

Once the Weaviate docker-compose.yml is all set, you can simply start it by running docker compose -f /path/to/weaviate/docker-compose.yml up

Systemd service file

[Unit]

Description=Weaviate
After=network.target

[Service]

Type=simple
User=weav
ExecStart=/usr/bin/docker compose -f /path/to/weaviate/docker-compose.yml up
ExecStop=/usr/bin/docker compose -f /path/to/weaviate/docker-compose.yml down
Restart=on-failure
RestartSec=5

[Install]

WantedBy=multi-user.target

CUDA GPU support

In order to enable the GPU support, you must install the NVIDIA Container Toolkit https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html