This guide explains how to deploy the askUOS chatbot using Docker Compose. Caddy is provided as a suggested reverse proxy, but you can use any reverse proxy of your choice (e.g., Nginx).
- Prerequisites
- Directory Structure
- Environment Variables (
.env.prod) - Backend Configuration (
backend_config.yaml) - UI Configuration (
ui_config.yml) - Streamlit Configuration (
config.toml) - Prompts Configuration (
prompt_text.py) - Docker Compose Configuration
- Caddy Configuration (
Caddyfile) - Optional - Deployment Steps
- Access Points
- Troubleshooting
- Updating
- Docker and Docker Compose installed on the server
- A domain name pointing to the server (e.g.,
chat.your-university.de) - SSL/TLS certificate (Caddy auto-provides via Let's Encrypt; configure separately for other proxies)
- Access to required API keys (see Environment Variables section)
- A RAGFlow instance
Create the installation directory:
sudo mkdir -p /opt/chatbot
cd /opt/chatbotThe following files and directories should be placed in /opt/chatbot/:
/opt/chatbot/
├── .env.prod # Environment variables (see below)
├── backend_config.yaml # Backend configuration
├── ui_config.yml # UI configuration
├── config.toml # Streamlit configuration
├── Caddyfile # Caddy reverse proxy config (optional)
├── datenschutz.html # Privacy policy page
├── impressum.html # Imprint/legal notice page
├── promtail-config.yml # Log collection config (optional)
├── config_loki.yml # Loki log storage config (optional)
Create the .env.prod file with the following variables:
#============#
# OpenAI #
#============#
# IF using OpenAI
OPENAI_API_KEY=""
#============#
# Self-hosted#
# LLMs #
#============#
# If models are hosted locally
API_KEY_SELF_HOSTED_MAIN=""
API_KEY_SELF_HOSTED_HELPER=""
#============#
# RAGFlow #
#============#
RAGFLOW_API_KEY=""
#============#
# Google API #
#============#
# Required for Gemini models
GEMINI_API_KEY=""
# Google Search URL (REQUIRED)
# Replace YOUR-KEY and YOUR-CX with actual values from Google Cloud Console
# https://developers.google.com/custom-search/v1/using_rest
SEARCH_URL = "https://www.googleapis.com/customsearch/v1?key=YOUR-KEY&cx=YOUR-CX&q="
#============#
# askUOS #
#============#
# Generate secure random strings
# The STREAMLIT_API_KEY must match one of the keys in API_KEYS
API_KEYS = "<generate-secure-random-string>"
STREAMLIT_API_KEY = "<generate-secure-random-string>"The Google API key must have access to:
- Custom Search API
- You need to configure a Programmable Search Engine and index the sites you want to search (e.g., the Website of your University). The engine endpoint should be configured in the
.env.prodfile asSEARCH_URL.
- You need to configure a Programmable Search Engine and index the sites you want to search (e.g., the Website of your University). The engine endpoint should be configured in the
- Generative Language API (If using Google as LLM provider)
- Vertex AI API (If using Google as LLM provider)
- The
STREAMLIT_API_KEYmust match one of the keys listed inAPI_KEYS. - Generate secure random strings for all API keys.
This file, backend_config.yaml, configures the models and other backend settings. See the example: backend_config_example.yaml.
To use the example configuration:
cp docs/backend_config_example.yaml ./backend_config.yaml
# Edit backend_config.yaml with your specific settingsThis file, ui_config.yml, configures the user interface settings. Follow this example: ui_example_config.yml.
To use the example configuration:
cp docs/ui_example_config.yml ./ui_config.yml
# Edit ui_config.yml with your specific settingsNote: For the icons, mount (to the container) your own custom icons to the /app/ui/static/icons/ directory with the same filenames: Icon-User.svg, Icon-chatbot.svg, Icon-chatbot.png.
[server]
enableStaticServing = true
[theme]
primaryColor = "#ad1034"
[client]
showErrorDetails = "none"
toolbarMode = "minimal"
showSidebarNavigation = false
[browser]
gatherUsageStats = falseThe prompt configuration file (src/chatbot/prompt/prompt_text.py) contains pyhton dictionaries (prompt_text_english and prompt_text_deutsch) that specifiy the system messages and instructions that define the chatbot's behavior, personality, and knowledge scope. This file must be mounted to the container (container_name: ask_uos) during installation at the path /app/src/chatbot/prompt/prompt_text.py.
When deploying askUOS at a different university, you must customize the prompts to reflect your institution's specific information. Copy and modify this file: src/chatbot/prompt/prompt_text.py.
Here are the key areas to modify:
- What to change: Replace "Osnabrück University" with your university's name
- Example:
# AI Assistant of [Your University Name]
- Location: Lines (around) 12-14, 193-212 (English), 366-368, 551-574 (German)
- What to change:
- Update tool names to match your university's systems (e.g., replace "HISinOne" with your application portal name)
- Update tool descriptions to reflect your university's software and processes
- Modify the
custom_university_web_searchdescription to point to your university's website
- Location: Lines 77-186 (application process), 272-352 (teaching degrees)
- What to change:
- Update admission requirements and procedures
- Modify degree program structures (Bachelor/Master types)
- Adjust application deadlines and processes
- Update examination regulations references
- Location: Throughout the file
- What to change:
- Replace German-specific terms (e.g., "Zulassungsbeschränkungen", "NC-Fächer") with your local terminology
- Update program names and combinations
- Modify any culturally-specific references
- Location: Line (around) 174 (FAQ link)
- What to change: Replace with your university's FAQ page and other relevant resources
- What to change: Update language settings based on your university's primary languages
Before mounting the file to the container make sure that the python script is correct, e.g, pay close attention to the script syntax: this file should contain valid python dictionaries.
Add the following volume mount to your docker-compose.yml:
volumes:
- ./prompt_text.py:/app/src/chatbot/prompt/prompt_text.pyThis ensures your customized prompts are used instead of the default ones.
- Keep the structure: Maintain the overall structure and format of the prompts
- Preserve tool usage instructions: The chatbot relies on tools for accurate information
- Update both languages: Ensure both English and German sections are updated
- Test thoroughly: After customization, test the chatbot with common queries
Create docker-compose.yml:
The easiest way to install askUOS is using Docker Compose. Follow this example: docker-compose.prod.example.yml.
To use the example configuration:
cp docs/docker-compose.prod.example.yml ./docker-compose.yml
# Edit docker-compose.yml with your specific settings (e.g., image tag)If using Caddy as your reverse proxy, follow this example: Caddy.example.
To use the example configuration:
cp docs/Caddy.example ./Caddyfile
# Edit Caddyfile with your domain nameIf you prefer Nginx, Traefik, or another reverse proxy, configure it to:
- Forward
/v1/*and/healthtolocalhost:8000(FastAPI backend) - Forward all other requests to
localhost:8501(Streamlit UI) - Handle SSL termination
- Serve static files (
datenschutz.html,impressum.html)
-
Clone or copy all configuration files to
/opt/chatbot/ -
Update environment variables in
.env.prodwith your actual API keys -
Generate secure authentication keys: Set
API_KEYSandSTREAMLIT_API_KEYin.env.prod. -
Customize prompts for your university (see Prompts Configuration):
- Edit
prompt_text.pywith your university's name and processes - Mount the file in
docker-compose.ymlas shown in the Prompts section
- Edit
-
Configure your reverse proxy:
- If using Caddy, update the
Caddyfilewith your domain name - If using another proxy, configure it according to the routing rules above
- If using Caddy, update the
-
Start the services:
cd /opt/chatbot docker compose up -d -
Check service status:
docker compose ps
-
View logs:
docker compose logs -f app
| Service | URL |
|---|---|
| Chatbot UI | https://your-domain.de |
| API | https://your-domain.de/v1/* |
| Health Check | https://your-domain.de/health |
| Issue | Solution |
|---|---|
| Container won't start | Check .env.prod for missing or invalid API keys |
| SSL certificate issues | Ensure port 80 and 443 are open for Let's Encrypt (Caddy) |
| Slow responses | Check recursion_limit and consider reducing it |
To update to a new version:
cd /opt/chatbot
docker compose pull
docker compose up -dTo rollback, specify a previous image tag in the docker-compose.yml file:
image: ghcr.io/virtuos/askuos:previous-version
- Explore architecture in Architecture Overview