Skip to content

Hosting TutoriaLLM

How to Host the Application

To host TutoriaLLM, you need to set up the frontend, backend, and database. Below is a guide on hosting the TutoriaLLM app using Docker Compose and a hosting service of your choice.

Hosting the Backend and Database

Use Docker Compose to host the backend and database. Follow the steps below to host the TutoriaLLM app. Prepare a server (e.g., VPS) or a computer with Docker installed.

Pulling the Backend Docker Image

The image is available on Docker Hub. While multiple versions are provided, it is recommended to use the latest version. To use the image, you need to connect to Pgvector (or PostgreSQL with vector support).

About Versions

TutoriaLLM offers multiple versions to ensure stability. For details on version changes, refer to the GitHub repository:

  • latest - Latest release
    • release_[YYYY-DDMM-BUILD_NUMBER] - Versioned releases
  • latest-preview - Latest development release
    • preview_[YYYY-DDMM-BUILD_NUMBER] - Development versions

Creating the Compose File

Below is an example of a production-ready docker-compose.yml file.

./docker-compose.yml
version: "3.8"
services:
reverse-proxy:
image: traefik:v3.1
command:
- --api.insecure=true
- --accesslog=true
- --accesslog.addinternals
- --metrics.addinternals
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --certificatesresolvers.myresolver.acme.httpchallenge=true
- --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web
- --certificatesresolvers.myresolver.acme.email=$EMAIL
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /letsencrypt:/letsencrypt
depends_on:
- api
db:
container_name: tutoriallm-db
image: pgvector/pgvector:pg14
ports:
- "5432:5432"
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
- PGDATA=/var/lib/postgresql/data/pgdata
- TZ=UTC
healthcheck:
test:
["CMD-SHELL", "sh -c 'pg_isready -U $POSTGRES_USER -d $POSTGRES_DB'"]
interval: 10s
timeout: 60s
retries: 5
start_period: 10s
volumes:
- db_data_db:/var/lib/postgresql/data
restart: always
api:
container_name: tutoriallm-api
image: soumame/tutoriallm_api:latest
labels:
- "traefik.enable=true"
- "traefik.http.routers.code-tutorial-app-prod-http.rule=Host(`$DOMAIN`)"
- "traefik.http.routers.code-tutorial-app-prod-http.entrypoints=web"
- "traefik.http.routers.code-tutorial-app-prod-https.rule=Host(`$DOMAIN`)"
- "traefik.http.routers.code-tutorial-app-prod-https.entrypoints=websecure"
- "traefik.http.routers.code-tutorial-app-prod-https.tls.certresolver=myresolver"
restart: always
env_file:
- .env
depends_on:
db:
condition: service_healthy
volumes:
- /etc/letsencrypt:/etc/letsencrypt
- ./app_data:/app_data
volumes:
db_data_db:
letsencrypt:

Setting Environment Variables

Below is an example of environment variables. Adjust them according to your deployment method:

  • OPENAI_API_KEY - Key for using the OpenAI API

  • OPENAI_API_ENDPOINT - Endpoint for OpenAI API. Defaults to the standard endpoint if not set.

  • POSTGRES_USER - Database username

  • POSTGRES_PASSWORD - Database password

  • DB_PORT=5432 - Database port

  • POSTGRES_DB - Database name

  • DB_HOST - Database host

  • DEFAULT_USER_NAME - Default username

  • DEFAULT_USER_PASSWORD - Default user password

  • SENTRY_DSN - Optional, DSN for Sentry.io to track backend errors

  • DOMAIN - App domain name, used for automatic SSL configuration

  • EMAIL - App email address, used for automatic SSL configuration

  • CORS_ORIGIN - CORS settings, set the frontend URL

Starting the App

Run the following command in the directory containing the Compose file and .env file to start the app:

Terminal window
docker compose up
## To run in the background
docker compose up -d

Hosting the Frontend

There are several ways to host the frontend. This guide explains how to host it using Vercel or Netlify.

Forking the Repository

Fork the GitHub repository.

Hosting

Set up the following configurations on your hosting service to deploy the app:

Setting Environment Variables

  • VITE_BACKEND_URL - Backend API endpoint

Build Settings

Build all packages from the root directory using the pnpm build:all command:

  • Build Command: pnpm build:all Then upload the built frontend files to the hosting service.
  • Build Directory: /apps/frontend/dist

Using Docker

As environment variables must be set when building the frontend files, Docker images for the frontend are not provided on Docker Hub. Use the Dockerfile in the repository to build the image for the frontend.