Deployment guide

LibreChat

Overview

LibreChat is a popular open-source, self-hosted AI chat interface: a feature-rich, ChatGPT-style web front end for large language models. It brings many providers together in one place. You connect your own OpenAI, Anthropic, Google or Azure OpenAI keys, or point at any OpenAI-compatible endpoint, including a local model server, and switch between models inside a single conversation. It adds conversation search, prompt and preset management and multi-user accounts on top.

This SecureAnyCloud image ships LibreChat as a three-service Docker Compose project under /opt/librechat. The project has the LibreChat web app bound to loopback 127.0.0.1:3080, a MongoDB database for users and conversations, and Meilisearch for fast conversation search. nginx fronts all three on port 80. It is configured for the streamed, server-sent responses that the chat relies on and is ready for your TLS certificate.

Secure by default, no default login. The image ships with no administrator and no user rows. Registration is open, so your first visit lands on the sign-up screen and the first account you create is yours.

A librechat-firstboot.service oneshot runs on first boot and then disables itself. It generates the per-instance secrets, pulls the newest images, brings the stack up, resolves the instance URL and writes a root-only instance info note.

Per-instance secrets. The JWT signing keys and the credential encryption keys are generated uniquely on first boot into /opt/librechat/.env, which is readable only by root. No two instances share a signing key, and nothing secret ships inside the image.

Bring your own model. No provider key ships in the image. The app boots and serves the full interface with no external key required. After you sign up, you add a provider key or connect a local endpoint from the interface.

Always current. AI tooling moves fast, so the image does not pin a stale version. On first boot, the stack runs docker compose pull to fetch the newest LibreChat, MongoDB and Meilisearch images. Every launch therefore runs current software rather than the version frozen at build time.

What you get:

  • LibreChat (rolling release) as ghcr.io/danny-avila/librechat:latest
  • MongoDB (mongo:8.0.20) and Meilisearch (getmeili/meilisearch:v1.35.1) on the private Docker network
  • Docker Engine with the Compose plugin from the official Docker repository
  • librechat.service managing the Compose stack, the app bound to 127.0.0.1:3080
  • An nginx reverse proxy on port 80, aware of streamed responses and ready for TLS
  • librechat-firstboot.service, which generates secrets, pulls images, starts the stack and writes the info note on first boot
  • Ubuntu 24.04 LTS base, patched at build time
  • 24/7 SecureAnyCloud support with a 24-hour response SLA

Prerequisites

You need an active Azure subscription, an SSH key pair, and a VNet with a subnet.

LibreChat and its data stores are lightweight, so a general-purpose VM is plenty. Use Standard_D2s_v5 (2 vCPU, 8 GB RAM) for comfortable multi-user use. The models themselves run at your chosen provider or a separate endpoint, so this VM does not need a GPU.

1

Deploy from the Azure Portal

Search the Azure Marketplace for LibreChat on Ubuntu 24.04 and choose your VM size.

Attach a network security group (NSG) that allows TCP 22 (SSH) from your management network. Also allow TCP 80 / 443 (the interface) from the networks that need it. In production, front port 80 with TLS (see Step 10).

2

Deploy from the Azure CLI

RG="librechat-prod"; LOCATION="eastus"; VM_NAME="librechat-01" IMAGE_URN="sac1647283583153:librechat-ubuntu-24-04:default:latest" SSH_KEY="$(cat ~/.ssh/id_rsa.pub)" az group create --name "$RG" --location "$LOCATION" az network vnet create -g "$RG" --name lc-vnet --address-prefix 10.90.0.0/16 --subnet-name lc-subnet --subnet-prefix 10.90.1.0/24 az network nsg create -g "$RG" --name lc-nsg az network nsg rule create -g "$RG" --nsg-name lc-nsg --name allow-ssh --priority 100 \
  --source-address-prefixes "<your-mgmt-cidr>" --destination-port-ranges 22 --access Allow --protocol Tcp az network nsg rule create -g "$RG" --nsg-name lc-nsg --name allow-web --priority 110 \
  --source-address-prefixes "<your-mgmt-cidr>" --destination-port-ranges 80 443 --access Allow --protocol Tcp
# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:librechat-ubuntu-24-04:default:latest
az vm create -g "$RG" --name "$VM_NAME" --image "$IMAGE_URN" \
  --size Standard_D2s_v5 --storage-sku StandardSSD_LRS \
  --admin-username azureuser --ssh-key-values "$SSH_KEY" \
  --vnet-name lc-vnet --subnet lc-subnet --nsg lc-nsg --public-ip-sku Standard
3

Connect via SSH

ssh azureuser@<vm-ip>
4

Verify the services are running

Docker runs the Compose stack. LibreChat listens on loopback 127.0.0.1:3080, and nginx fronts the interface on port 80 and proxies its streamed responses.

sudo systemctl is-active docker librechat nginx
sudo ss -tln | grep -E ':80 |127.0.0.1:3080' curl -s -o /dev/null -w 'GET /health -> HTTP %{http_code}\n' http://127.0.0.1/health

All three services report active, LibreChat is bound to 127.0.0.1:3080, nginx is bound to :80, and the health endpoint returns HTTP 200 through nginx.

5

Secure by default, no admin ships

Nothing sensitive ships in the image. MongoDB has zero users, so every instance starts at the sign-up screen. The per-instance info note in /root is root-only and holds no credential, only the resolved URL. The per-instance secrets file is also readable only by root.

echo "MongoDB user count: $(sudo docker exec librechat-mongodb mongosh LibreChat --quiet --eval 'db.users.countDocuments()')"
sudo grep -E '^LIBRECHAT_URL|^NOTE' /root/librechat-info.txt
sudo stat -c '%n perms=%a owner=%U:%G' /opt/librechat/.env

The user count is 0, so no admin exists. The note tells you to create your own account at the sign-up screen. The .env file that holds the per-instance secrets is 600 root:root.

6

Create your account

Open http://<vm-ip>/ in your browser. No administrator ships and registration is open, so LibreChat shows its sign-up screen.

Select Sign up, enter a Name, your Email and a strong Password, confirm the password, and submit. The first account you create is yours, so pick a real password.

After you sign up, LibreChat opens the chat workspace, with the model and endpoint selector at the top and the message box ready.

7

Connect a model provider and start chatting

LibreChat is provider-neutral, so you choose which models to use. Open the endpoint and model selector at the top of the chat. It lists providers such as OpenAI, Anthropic, Google and any custom OpenAI-compatible endpoint.

Pick a provider and add your API key when prompted. Alternatively, configure a custom endpoint that points at a hosted or local model server.

You manage your keys and account preferences from Settings, reached from the menu by your account at the bottom of the sidebar. Once a provider is connected, select one of its models in the chat and send a prompt.

8

The runtime stack

docker --version nginx -v sudo docker compose -f /opt/librechat/docker-compose.yml ps
sudo docker image ls --format '{{.Repository}}:{{.Tag}} {{.Size}}' | grep -E 'librechat|mongo|meili'

Docker runs the three-container Compose stack, nginx fronts it, and the librechat-api, librechat-mongodb and librechat-meilisearch containers all report Up.

9

Data, persistence and staying current

LibreChat data (users, conversations, uploads) lives in Docker named volumes captured into the image. The first-boot service keeps every instance current.

sudo docker volume ls --format '{{.Name}}' | grep librechat systemctl is-enabled librechat-firstboot.service apt-mark showhold

The librechat_mongodb, librechat_meili, librechat_uploads, librechat_logs and librechat_images volumes hold the data. The first-boot service has already run once and disabled itself on this instance, and there are no held packages, so the OS security baseline is intact.

The baked images are present, so the stack starts immediately while the first-boot pull fetches any newer release.

10

Enable HTTPS

nginx already fronts LibreChat on port 80 and is ready for TLS. Point a DNS record at your VM, then obtain a certificate with certbot:

sudo apt-get install -y certbot python3-certbot-nginx
sudo certbot --nginx -d <your-domain> --agree-tos -m <your-email> --redirect

certbot installs the certificate, rewrites the nginx server block for TLS, and sets up automatic renewal. LibreChat is then served over HTTPS.

Managing the service

sudo systemctl is-active librechat nginx docker

All three services report active. librechat.service manages the Compose stack.

  • Restart: run sudo systemctl restart librechat.
  • Follow the logs: run sudo docker compose -f /opt/librechat/docker-compose.yml logs -f to follow the container logs live.
  • Update: to refresh to the newest release at any time, run sudo docker compose -f /opt/librechat/docker-compose.yml pull, then sudo systemctl restart librechat.
  • Back up: snapshot the OS disk, or export the librechat_mongodb volume while the service is stopped.

Support

SecureAnyCloud provides 24/7 support for this image by email and live chat. Support covers deployment, nginx TLS termination, model provider configuration, upgrades and performance tuning. Email sales@secureanycloud.com.

This is a repackaged open-source software product, with additional charges for SecureAnyCloud support services. LibreChat is a trademark of its respective owner. All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

Deploy on Azure

Launch LibreChat on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure