DEV Community

Cover image for Deploying LibreChat Open-Source AI Chat Platform on Ubuntu 24.04
Sanskriti Harmukh for Vultr

Posted on with Aashish Chaurasiya • Originally published at docs.vultr.com

Deploying LibreChat Open-Source AI Chat Platform on Ubuntu 24.04

LibreChat is an open-source, ChatGPT-style web UI that supports OpenAI, Anthropic, Azure OpenAI, Gemini, OpenRouter, local OpenAI-compatible endpoints, and more — with MongoDB-backed conversation history and Meilisearch-powered search. This guide deploys LibreChat using its official Compose manifest plus a Traefik override for automatic HTTPS. By the end, you'll have LibreChat running with a registration page and multi-provider chat at your domain over HTTPS.


Clone LibreChat and Prepare the Environment

1. Clone the LibreChat repository and check out a stable tag:

$ git clone https://github.com/danny-avila/LibreChat.git
$ cd LibreChat
$ git checkout tags/v0.8.3
Enter fullscreen mode Exit fullscreen mode

2. Find the Meilisearch data directory name pinned by this release:

$ grep -o 'meili_data_v[0-9.]*' docker-compose.yml | head -1
Enter fullscreen mode Exit fullscreen mode

3. Create the required data directories (replace meili_data_v1.35.1 if the previous command printed a different name):

$ mkdir -p data-node images logs meili_data_v1.35.1 uploads
$ sudo chown -R 1000:1000 meili_data_v1.35.1
Enter fullscreen mode Exit fullscreen mode

4. Copy the env template and uncomment the UID/GID lines:

$ cp .env.example .env
$ nano .env
Enter fullscreen mode Exit fullscreen mode
UID=1000
GID=1000
Enter fullscreen mode Exit fullscreen mode

Override the Compose Stack with Traefik

1. Create a Compose override that adds Traefik and wires the API to it:

$ nano docker-compose.override.yml
Enter fullscreen mode Exit fullscreen mode
services:
  api:
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.librechat.rule=Host(`librechat.example.com`)"
      - "traefik.http.routers.librechat.entrypoints=websecure"
      - "traefik.http.routers.librechat.tls.certresolver=leresolver"
      - "traefik.http.services.librechat.loadbalancer.server.port=3080"
    volumes:
      - ./librechat.yaml:/app/librechat.yaml

  traefik:
    image: traefik:v3.6.10
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./letsencrypt:/letsencrypt"
    command:
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--entrypoints.web.http.redirections.entrypoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.web.http.redirections.entrypoint.permanent=true"
      - "--certificatesresolvers.leresolver.acme.httpchallenge=true"
      - "--certificatesresolvers.leresolver.acme.httpchallenge.entrypoint=web"
      - "--certificatesresolvers.leresolver.acme.email=admin@example.com"
      - "--certificatesresolvers.leresolver.acme.storage=/letsencrypt/acme.json"
Enter fullscreen mode Exit fullscreen mode

2. Create an empty LibreChat configuration file (mounted by the override):

$ touch librechat.yaml
Enter fullscreen mode Exit fullscreen mode

Start the Stack

1. Bring everything up:

$ docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Compose starts the LibreChat API, MongoDB, Meilisearch, and Traefik. Traefik requests a TLS certificate from Let's Encrypt over the HTTP-01 challenge and routes HTTPS to LibreChat on port 3080.

2. Verify the containers are running:

$ docker compose ps
Enter fullscreen mode Exit fullscreen mode

3. Tail the logs:

$ docker compose logs --tail=50
Enter fullscreen mode Exit fullscreen mode

You should see MongoDB initialize, Meilisearch start, Traefik register the route, and the LibreChat API listening on port 3080.


Register and Sign In

1. Open the registration page in a browser:

https://librechat.example.com/register
Enter fullscreen mode Exit fullscreen mode

2. Fill in your name, username, email, and password and click **Continue.**

3. Sign in with the new credentials — the dashboard loads with the model selector and conversation interface.

To enable Google / GitHub / Discord / OpenID Connect sign-up, set ALLOW_SOCIAL_LOGIN=true and ALLOW_SOCIAL_REGISTRATION=true in .env and restart the stack.


Next Steps

LibreChat is running and served securely over HTTPS. From here you can:

  • Plug in API keys for OpenAI, Anthropic, Azure, Gemini, or OpenRouter in .env
  • Point LibreChat at a local OpenAI-compatible endpoint (Ollama, LocalAI) via librechat.yaml
  • Enable file uploads, RAG, and image generation through the dashboard settings

For the full guide with additional tips, visit the original article on Vultr Docs.

Top comments (0)