Deploying the Go-ChatGPT Service Stack with Docker Compose

Service Deployment Structure

The go-ChatGPT project relies on multiple middleware services. The deployment directory layout is shown below:

|-- chat-api
|   |-- etc
|   |   `-- config.yaml
|   `-- logs
|-- chat-rpc
|   |-- etc
|   |   `-- config.yaml
|   `-- logs
|-- docker-compose.yaml
|-- mysql
|   `-- data
|-- nginx
|   |-- conf
|   |   `-- conf.d
|   `-- data
|       `-- front
|-- ollama
|   |-- history
|   |-- id_ed25519
|   `-- id_ed25519.pub
|-- redis
|   `-- data
|       `-- dump.rdb
|-- user-api
|   |-- etc
|   |   `-- config.yaml
|   `-- logs
`-- user-rpc
    |-- etc
    |   `-- config.yaml
    `-- logs

Docker Compose Configuration

The docker-compose.yaml file defines all services and their interconnections:

version: '3.8'

services:
  user-rpc:
    image: eilinge/open-ui-user-rpc
    container_name: user-rpc
    ports:
      - "9001:9001"
    volumes:
      - ./user-rpc/etc/config.yaml:/app/etc/config.yaml
      - ./user-rpc/logs:/app/logs
    networks:
      - default
    depends_on:
      - mysql
      - redis
      - etcd

  user-api:
    image: eilinge/open-ui-user-api
    container_name: user-api
    ports:
      - "8081:8081"
    volumes:
      - ./user-api/etc/config.yaml:/app/etc/config.yaml
      - ./user-api/logs:/app/logs
    networks:
      - default
    depends_on:
      - mysql
      - redis
      - etcd

  chat-rpc:
    image: eilinge/open-ui-chat-rpc
    container_name: chat-rpc
    ports:
      - "9002:9002"
    volumes:
      - ./chat-rpc/etc/config.yaml:/app/etc/config.yaml
      - ./chat-rpc/logs:/app/logs
    networks:
      - default
    depends_on:
      - mysql
      - redis
      - etcd

  chat-api:
    image: eilinge/open-ui-chat-api
    container_name: chat-api
    ports:
      - "8082:8082"
    volumes:
      - ./chat-api/etc/config.yaml:/app/etc/config.yaml
      - ./chat-api/logs:/app/logs
    networks:
      - default
    depends_on:
      - mysql
      - redis
      - etcd

  redis:
    image: redis:7.2.4
    container_name: openui-redis
    volumes:
      - ./redis/data:/data
    restart: always
    ports:
      - 6379:6379
    privileged: true
    networks:
      - default

  mysql:
    image: mysql:8.2.0
    container_name: openui-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=123456
    volumes:
      - ./mysql/data:/data
    restart: always
    ports:
      - 3306:3306
    privileged: true
    networks:
      - default

  etcd:
    image: "bitnami/etcd:latest"
    container_name: openui-etcd
    environment:
      - ALLOW_NONE_AUTHENTICATION=yes
      - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
      - ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
    ports:
      - 2379:2379
      - 2380:2380
    networks:
      - default

  etcdkeeper:
    container_name: openui-etcdkeeper
    image: evildecay/etcdkeeper:v0.7.6
    ports:
      - "8099:8080"
    networks:
      - default

  nginx:
    image: nginx:latest
    container_name: openui-nginx
    ports:
      - "8080:80"
      - "8443:443"
    volumes:
      - ./nginx/conf/conf.d:/etc/nginx/conf.d
      - ./nginx/logs:/var/log/nginx
      - ./nginx/data/front:/data/front
      - /etc/nginx/ssl:/etc/nginx/ssl
    networks:
      - default

  ollama:
    volumes:
      - ./ollama:/root/.ollama
    container_name: ollama
    tty: true
    restart: unless-stopped
    image: ollama/ollama
    environment:
      - name=value
    ports:
      - 11434:11434
    networks:
      - default
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

networks:
  default:
    external: true
    name: openui-net

Nginx Routing

The user-api and chat-api are separate services running on different ports with distinct route prefixes. To provide a unified entry point, Nginx acts as a reverse proxy. The configuration file default.conf (placed in nginx/conf/conf.d) routes requests based on URI patterns:

server {
    listen       80;
    listen       443 ssl; 
    server_name  _;

    ssl_certificate     /etc/nginx/ssl/server.pem;
    ssl_certificate_key /etc/nginx/ssl/server.key;

    location /static/ {
        root /data/front;
    }

    location / {
        proxy_pass http://chat-api:8082;
        proxy_set_header X-Forwarded-Proto  $scheme; 
    }

    location /api/v1/auths {
        proxy_pass http://user-api:8081;
        proxy_set_header X-Forwarded-Proto  $scheme;
    }
}

Requests starting with /api/v1/auths are forwarded to the user service, while all other traffic goes to the chat service. This design allows both services to be accessed through a single domain or IP adddress.

Source Code Repositories

The project source and deployment configuration can be found at:

Tags: Go chatgpt deployment docker-compose nginx

Posted on Mon, 11 May 2026 05:33:29 +0000 by Hilitec