# How to Deploy a Weaviate Vector Database
Weaviate is an open-source vector database with a flexible schema model, hybrid search (combining vector and keyword), and optional built-in vectorizer modules. It's a strong choice when you want more than pure ANN search. This guide self-hosts Weaviate for production and explains the decisions that shape your deployment.
Two ways to use Weaviate
The first decision determines everything else:
- 1Bring your own vectors — you compute embeddings (OpenAI, Cohere, local model) and send them in. Weaviate just stores and searches. Simplest to deploy; no GPU needed.
- 2Built-in vectorizer modules — Weaviate calls an embedding model for you (e.g.
text2vec-openai, or a local transformers module). Convenient, but local modules add compute and complexity.
For most deployments, bring your own vectors is the cleaner path: you control the embedding model and Weaviate stays lightweight.
Persistent storage and auth
Weaviate persists data to /var/lib/weaviate. As with any stateful service in a container, that path must be backed by persistent storage or a redeploy wipes your data. And never run it open — enable API-key auth:
# Authentication
AUTHENTICATION_APIKEY_ENABLED=true
AUTHENTICATION_APIKEY_ALLOWED_KEYS=<your-secret-key>
AUTHENTICATION_APIKEY_USERS=admin@example.com
AUTHORIZATION_ADMINLIST_ENABLED=true
AUTHORIZATION_ADMINLIST_USERS=admin@example.com
# Persistence
PERSISTENCE_DATA_PATH=/var/lib/weaviate
# Disable anonymous access
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=falseContainerize
FROM semitechnologies/weaviate:latest
EXPOSE 8080 50051
ENV PERSISTENCE_DATA_PATH=/var/lib/weaviate
ENV AUTHENTICATION_APIKEY_ENABLED=true
ENV AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=falseWeaviate serves REST/GraphQL on 8080 and gRPC on 50051 (used by newer clients for performance).
Deploy on PandaStack
- 1Push the repo to GitHub and create a container app in the [dashboard](https://dashboard.pandastack.io). It builds via rootless BuildKit and serves an HTTPS URL with automatic SSL.
- 2Set the auth env vars (including your API key) as encrypted environment variables.
- 3Attach persistent storage to
/var/lib/weaviate. - 4Choose a memory-optimized (m1/m2) tier — like all vector DBs, Weaviate's search latency depends on keeping the index in RAM.
Define a schema (collection)
import weaviate
from weaviate.classes.init import Auth
client = weaviate.connect_to_custom(
http_host="<app-host>", http_port=443, http_secure=True,
grpc_host="<app-host>", grpc_port=443, grpc_secure=True,
auth_credentials=Auth.api_key("<your-secret-key>"),
)
client.collections.create(
name="Article",
vectorizer_config=weaviate.classes.config.Configure.Vectorizer.none(), # BYO vectors
properties=[
weaviate.classes.config.Property(name="title", data_type=weaviate.classes.config.DataType.TEXT),
weaviate.classes.config.Property(name="url", data_type=weaviate.classes.config.DataType.TEXT),
],
)
articles = client.collections.get("Article")
articles.data.insert(properties={"title": "Intro", "url": "/intro"}, vector=embedding)Hybrid search: Weaviate's standout feature
Weaviate can blend keyword (BM25) and vector search in one query, which often beats either alone for real-world relevance:
results = articles.query.hybrid(
query="how to reset my password",
vector=query_embedding,
alpha=0.5, # 0 = pure keyword, 1 = pure vector
limit=5,
)Tuning alpha per use case is one of the highest-leverage things you can do for relevance — pure vector search misses exact-match terms (product codes, names) that BM25 nails.
Tuning for production
| Lever | Effect |
|---|---|
| Vector index type (HNSW/flat) | HNSW for large collections; flat for small/exact |
| Product quantization (PQ) | Shrinks RAM footprint for big datasets |
alpha in hybrid | Balances keyword vs. semantic relevance |
| Replication/sharding | Throughput and resilience at scale |
Weaviate vs. Qdrant vs. pgvector
- pgvector: zero extra infra, great for small/medium corpora already on Postgres.
- Qdrant: lean, fast, advanced quantization; pure-vector focus.
- Weaviate: rich schema, first-class hybrid search, modular vectorizers — pick it when hybrid relevance and a structured data model matter.
There's no universal winner; match the tool to your scale and relevance needs.
Operational notes
- Backups: Weaviate supports a backup API to object storage — configure and schedule it; persistent disk alone is not a backup.
- Don't scale-to-zero a primary DB: run on a paid tier so the index stays warm and the service is always reachable.
- Watch memory: OOM kills in the logs mean you need a bigger memory tier or quantization.
- gRPC: use a client that speaks gRPC for bulk ingestion performance.
References
- [Weaviate documentation](https://weaviate.io/developers/weaviate)
- [Weaviate: Authentication](https://weaviate.io/developers/weaviate/configuration/authentication)
- [Weaviate: Hybrid search](https://weaviate.io/developers/weaviate/search/hybrid)
- [Weaviate: Backups](https://weaviate.io/developers/weaviate/configuration/backups)
Weaviate shines when you need hybrid search and a real schema — and self-hosting it is mostly persistence, auth, and memory sizing. PandaStack supplies HTTPS, encrypted keys, persistent storage, and memory-optimized tiers, plus managed pgvector Postgres if you'd rather start simpler. Deploy at [dashboard.pandastack.io](https://dashboard.pandastack.io).