Docker Compose Setup
Learn how to self-host Trieve with Docker Compose
Docker Compose
The Docker Compose self hosted option is the easiest way to get started self hosting Trieve.
Things you need
- Domain name
- System with at least 4 CPU cores and 8GB of RAM (excluding the cpu embedding servers)
- System with at least 4 CPU cores and >25GB of RAM (including the cpu embedding servers)
Install Docker
curl https://get.docker.com | sh
Clone Trieve repository
git clone https://github.com/devflowinc/trieve
cd trieve
Create .env
file
cp .env.example .env
Start Trieve Services
docker compose up -d
Start Embedding servers
We offer 2 docker-compose files for embedding servers. One for GPU and one for CPU.
docker compose -f docker-compose-cpu-embeddings.yml up -d
or
docker compose -f docker-compose-cpu-embeddings.yml up -d
* Note on embedding servers. If you want to use a separate GPU enabled device for embedding servers you will need to update the following parameters
SPARSE_SERVER_QUERY_ORIGIN
SPARSE_SERVER_DOC_ORIGIN
EMBEDDING_SERVER_ORIGIN
SPARSE_SERVER_QUERY_ORIGIN
Setup Caddy reverse proxy
Install Caddy
Edit the Caddyfile
nano /etc/caddy/Caddyfile
Add the following configuration
dashboard.yourdomain.com {
reverse_proxy localhost:5173
}
chat.yourdomain.com {
reverse_proxy localhost:5175
}
search.yourdomain.com {
reverse_proxy localhost:5174
}
api.yourdomain.com {
reverse_proxy localhost:8090
}
auth.yourdomain.com {
reverse_proxy localhost:8080
}
Start Caddy, you may also need to reload the service
sudo systemctl reload caddy.service
Set the following A records for your domain to point to the server IP address.
A dashboard.yourdomain.com your-server-ip
A chat.yourdomain.com your-server-ip
A search.yourdomain.com your-server-ip
A auth.yourdomain.com your-server-ip
A api.yourdomain.com your-server-ip
Edit .env
Most values can be left as default, the ones you do need to edit are
KC_HOSTNAME="auth.yourdomain.com"
KC_PROXY=edge
VITE_API_HOST=https://api.yourdomain.com/api
VITE_SEARCH_UI_URL=https://search.yourdomain.com
VITE_CHAT_UI_URL=https://chat.yourdomain.com
VITE_ANALYTICS_UI_URL=https://analytics.yourdomain.com
VITE_DASHBOARD_URL=https://dashboard.yourdomain.com
OIDC_AUTH_REDIRECT_URL="https://auth.yourdomain.com/realms/trieve/protocol/openid-connect/auth"
OIDC_ISSUER_URL="https://auth.yourdomain.com/realms/trieve"
BASE_SERVER_URL="https://api.yourdomain.com"
Authorize keycloak redirect URLs
Go to auth.yourdomain.com and login with the default credentials (user: admin password: aintsecure)
- Change the Realm from master to trieve
- Go to Clients -> vault -> Settings
- Add the following to the Valid Redirect URIs and Valid Post Logout Redirect URIs
https://api.yourdomain.com/*
https://dashboard.yourdomain.com/*
https://chat.yourdomain.com/*
https://search.yourdomain.com/*
Testing
The fastest way to test is using the Trieve CLI
trieve login # Make sure to set the api url to http://localhost:8090
trieve dataset example
And there you have it. Your very own Trieve stack. Happy hacking 🚀