This guide will demonstrate how to self host the Vault API on your own server or a cloud provider of your choice.
- A server running Ubuntu 18.04 or later
- A domain name that you own
- A valid SSL certificate for your domain name
- A sendgrid account with an API key
- Some knowledge of reverse proxies and DNS
- An OpenAI API key or Your own Self hosted model (more on that later)
You will need to configure your DNS to point to your server. You can do this by creating an A record for each of the subdomains you want to use.
Follow the guide here to install docker on your server: https://docs.docker.com/engine/install/ubuntu/
git clone https://github.com/devflowinc/trieve
There are 3 files you need to modify We have an example .env file in the root of the repository. You can use this as a starting point for your own configuration.
cat .env.server .env.chat .env.search .env.docker-compose > .env
The main ENV variables you will need to update are:
# FOR SERVER
# For CHAT
# For SEARCH
Everything else can be left as default but there are some passwords that may want to be hardened if this is for production.
To see a full list of ENV variables and what they do please see the env file
docker compose up -d
This docker compose file will setup the following services:
We DO NOT reccomend to run Qdrant or Postgres on the same machine as the API. You can use a managed database service such as AWS RDS or Neon (our prefernce) to host postgres. and we reccomend using a differnt machine for Qdrant (Mainly just to prevent the chance of data loss).
Install caddy using the instructions here: https://caddyserver.com/docs/install
We have an example Caddyfile in the root of the repository. You can use this as a starting point for your own configuration.
sudo cp Caddyfile /etc/caddy/Caddyfile
# Global options
# Define a site block for chat.trieve.ai
# Define a site block for api.trieve.ai
# Define a site block for search.trieve.ai
Once you have this you can run the caddy daemon using systemctl
sudo systemctl enable caddy.service
sudo systemctl restart caddy.service
Congratulations you have now self hosted the Trieve API. You can now use the API by navigating to your domain name in your browser on either chat or search.