How to self-host Chathouse
Get Chathouse running on your own server with Docker Compose.
Chathouse supports self-hosting via Docker. You can run Chathouse on your own server or on a cloud provider of your choice. It's easy to set up and maintain, no need to be a Docker expert.
Prerequisites
- A server (or local machine) with Docker and Docker Compose installed
- At least 2 GB of RAM is recommended for the best performance
- An API key from at least one provider: OpenAI, Anthropic, or Google
You don't need API keys to deploy, but you'll need to add them through the web UI after your first login in order to use the chat.
Installation
Clone the self-hosting repository
Download the self-hosting repository from GitHub.
git clone https://github.com/ChathouseHQ/selfhosting
cd selfhostingThe repository contains a compose.yaml file with all the necessary configuration to run Chathouse.
Create your environment file
cp .env.example .envConfigure required variables
Open .env and set the two required variables:
SECRET_KEY_BASE — a master secret used to derive encryption keys. Generate one with:
openssl rand -base64 32CLIENT_URL — the public URL where Chathouse will be accessible:
SECRET_KEY_BASE="paste-generated-value-here"
CLIENT_URL="https://chat.yourdomain.com"If you're running locally, use http://localhost (or whichever port you've configured).
Both variables are required. docker compose up will refuse to start without them.
You can also configure the database, SMTP server, and other optional services by following the configuration reference.
Start Chathouse
docker compose up -dThis pulls the images and starts five containers:
| Container | Purpose |
|---|---|
nginx | Reverse proxy (port 80) |
app | The web application |
worker | Background job processor for AI responses |
mariadb | MariaDB database |
redis | Redis for sessions and job queuing |
First startup takes a few minutes while Docker pulls the application images. Subsequent starts are near-instant.
Create your account
Open http://your-server-ip in your browser and register your account.
Registration automatically closes after the first user signs up. Chathouse is designed as a single-user (or small team) application.
Connect your AI providers
Navigate to Settings > Connections and add API keys for the providers you want to use:
- OpenAI — get a key at platform.openai.com/api-keys
- Anthropic — get a key at console.anthropic.com/settings/keys
- Google Gemini — get a key at aistudio.google.com/app/apikey
Your API keys are encrypted at rest using a key derived from SECRET_KEY_BASE before being stored in the database.
Updating
To update to the latest version:
cd selfhosting
git pull
docker compose pull
docker compose up -dYour data is persisted in Docker volumes (mariadb_data, redis_data, uploads_data) and survives container updates.
Backups
The important data lives in two Docker volumes:
mariadb_data— all your chats, user data, and settingsuploads_data— uploaded files
To back up the database:
docker compose exec mariadb mariadb-dump -u chathouse -pchathouse chathouse > backup.sqlTo restore:
docker compose exec -T mariadb mariadb -u chathouse -pchathouse chathouse < backup.sqlTroubleshooting
Containers won't start
Check the logs:
docker compose logs -fThe most common issue is a missing SECRET_KEY_BASE in your .env file.
Database connection errors
Make sure the MariaDB container is healthy before the app starts. The compose file handles this automatically with healthchecks, but if you're seeing connection errors, wait a moment and try again:
docker compose restart app workerResetting everything
To wipe all data and start fresh:
docker compose down -v
docker compose pull
docker compose up -dThe -v flag deletes all Docker volumes, including your database and uploads. This is
irreversible.