Self-Hosting Honcho
Running a local version of the Honcho API Server
This guide was made using a M1 Macbook Pro. For any compatibility issues on different platforms please raise an Issue.
Prerequisites and Dependencies
Honcho is developed using python and poetry.
The minimum python version is 3.9
The minimum poetry version is 1.4.1
Setup
Once the dependencies are installed on the system run the following steps to get the local project setup.
- Clone the repository
git clone https://github.com/plastic-labs/honcho.git
- Enter the repository and install the python dependencies
We recommend using a virtual environment to isolate the dependencies for Honcho
from other projects on the same system. With poetry
a virtual environment can
be generated using the poetry shell
command. Once the virtual environment is
created and activated install the dependencies with poetry install
Putting this together:
cd honcho
poetry shell
poetry install
- Set up a database
Honcho utilized Postgres for its database with pgvector. An easy way to get started with a postgresdb is to create a project with Supabase
A docker-compose
template is also available with a database configuration
available.
- Edit the environment variables.
Honcho uses a .env
file for managing runtime environment variables. A
.env.template
file is included for convenience. Several of the configurations
are not required and are only necessary for additional logging, monitoring, and
security.
Below are the required configurations
CONNECTION_URI= # Connection uri for a postgres database
OPENAI_API_KEY= # API Key for OpenAI used for insights
Note that the
CONNECTION_URI
must have the prefixpostgresql+psycopg
to function properly. This is a requirement brought bysqlalchemy
The template has the additional functionality disabled by default. To ensure that they are disabled you can verify the following environment variables are set to false.
USE_AUTH_SERVICE=false
OPENTELEMETRY_ENABLED=false
SENTRY_ENABLED=false
- Launch the API
With the dependencies installed, a database setup and enabled with pgvector
,
and the environment variables setup you can now launch a local instance of
Honcho. The following command will launch the storage API for Honcho
python -m uvicorn src.main:app --reload --port 8000
This is a development server that will reload whenever code is changed. When first launching the API with a connection the database it will provision the necessary tables for Honcho to operate.
Docker
As mentioned earlier a docker-compose
template is included for running Honcho.
As an alternative to running Honcho locally it can also be run with the compose
template.
Copy the template and update the appropriate environment variables before launching the service.
cd honcho
cp docker-compose.yml.example docker-compose.yml
[ update the file with openai key and other wanted environment variables ]
docker compose up