commit 686445e0704511c66b7d771dffc318a675780913 Author: AmirAli Angha Date: Fri Jun 12 20:14:21 2026 +0330 create project diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..a8b55fd --- /dev/null +++ b/.env.example @@ -0,0 +1,20 @@ +# Open WebUI Configuration for aichat.zoneco.org +# Copy this to .env and fill in your values + +# OpenAI API Key +OPENAI_API_KEY=your_openai_api_key_here + +# Optional: Additional configuration +# WEBUI_NAME=AI Chat Zoneco +# WEBUI_URL=https://aichat.zoneco.org +# WEBUI_SECRET_KEY=your_secret_key_here +# DEFAULT_USER_ROLE=user +# ENABLE_SIGNUP=true +# ENABLE_LOGIN=true +# ENABLE_OAUTH_SIGNUP=false +# DEFAULT_MODELS=gpt-4 + +# DOCKER_IMAGE_TAG=ghcr.io/open-webui/open-webui:main +# CONTAINER_NAME=funzone_aichat +# HOST_PORT=3005 +# CONTAINER_PORT=8080 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..db37508 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Environment +.env +.env.local + +# Docker volumes +data/ +volumes/ + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f8cf733 --- /dev/null +++ b/README.md @@ -0,0 +1,78 @@ +# AI Chat - Open WebUI for aichat.zoneco.org + +This folder contains the configuration for deploying [Open WebUI](https://github.com/open-webui/open-webui) at `aichat.zoneco.org`. + +## Quick Start + +### 1. Configure Environment + +```bash +cp .env.example .env +``` + +Edit `.env` and set your OpenAI API key: + +``` +OPENAI_API_KEY=sk-your-actual-api-key-here +``` + +### 2. Deployment Options + +#### Option A: Deploy with the main infrastructure (recommended) + +The aichat service is already included in `funzone-infrastructure/docker-compose.yml`. Simply deploy from the infrastructure folder: + +```bash +cd ../funzone-infrastructure +docker-compose up -d --build +``` + +#### Option B: Deploy standalone + +```bash +docker-compose -f docker-compose.aichat.yml up -d +``` + +This requires the `funzone-net` Docker network to exist. If it doesn't, create it: + +```bash +docker network create funzone-net +``` + +## How It Works + +- The container `funzone_aichat` runs Open WebUI on port 8080 (mapped to `127.0.0.1:3005`) +- Nginx proxies `https://aichat.zoneco.org` → `http://funzone_aichat:8080` +- WebSocket connections are supported for streaming AI responses +- Data is persisted in the `open-webui-data` Docker volume + +## Environment Variables + +| Variable | Required | Description | +|----------|----------|-------------| +| `OPENAI_API_KEY` | Yes | Your OpenAI API key | +| `WEBUI_NAME` | No | Display name for the UI | +| `WEBUI_URL` | No | Public URL of the instance | +| `WEBUI_SECRET_KEY` | No | Secret key for authentication | +| `DEFAULT_USER_ROLE` | No | Default role for new users | +| `ENABLE_SIGNUP` | No | Allow user registration | +| `ENABLE_LOGIN` | No | Allow user login | +| `DEFAULT_MODELS` | No | Default models to use | + +## Files + +| File | Description | +|------|-------------| +| `.env.example` | Example environment variables | +| `.env` | Your actual environment variables (gitignored) | +| `docker-compose.aichat.yml` | Standalone docker-compose for aichat | +| `README.md` | This file | + +## Infrastructure Files Modified + +| File | Change | +|------|--------| +| `funzone-infrastructure/nginx/sites-available/aichat.zoneco.org.conf` | Nginx server block for aichat subdomain | +| `funzone-infrastructure/nginx/nginx.conf` | Added upstream `aichat-service` pointing to `funzone_aichat:8080` | +| `funzone-infrastructure/nginx/Dockerfile` | Added symlink for aichat config | +| `funzone-infrastructure/docker-compose.yml` | Added aichat service and `open-webui-data` volume | \ No newline at end of file diff --git a/docker-compose.aichat.yml b/docker-compose.aichat.yml new file mode 100644 index 0000000..9936b81 --- /dev/null +++ b/docker-compose.aichat.yml @@ -0,0 +1,47 @@ +version: '3.8' + +# Standalone docker-compose for aichat.zoneco.org (Open WebUI) +# This can be used independently or the service can be added to the main docker-compose.yml +# +# Deployment command (standalone): +# docker-compose -f docker-compose.aichat.yml up -d +# +# Or with the main infrastructure, just deploy the main docker-compose.yml +# which already includes this service. + +networks: + funzone-net: + external: true + +services: + # Open WebUI - AI Chat Interface + # https://github.com/open-webui/open-webui + aichat: + image: ghcr.io/open-webui/open-webui:main + container_name: funzone_aichat + ports: + - "127.0.0.1:3005:8080" # Only localhost access (proxied through nginx) + environment: + - OPENAI_API_KEY=${OPENAI_API_KEY:-your_openai_api_key_here} + # Optional: Uncomment and configure as needed + # - WEBUI_NAME=AI Chat Zoneco + # - WEBUI_URL=https://aichat.zoneco.org + # - WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY} + # - DEFAULT_USER_ROLE=user + # - ENABLE_SIGNUP=true + # - ENABLE_LOGIN=true + # - DEFAULT_MODELS=gpt-4 + volumes: + - open-webui-data:/app/backend/data + networks: + - funzone-net + restart: unless-stopped + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/health" ] + interval: 30s + timeout: 10s + start_period: 40s + retries: 3 + +volumes: + open-webui-data: \ No newline at end of file