openwebui_demo

0
5 месяцев назад
5 месяцев назад
5 месяцев назад
5 месяцев назад
5 месяцев назад
5 месяцев назад
5 месяцев назад
5 месяцев назад
5 месяцев назад
5 месяцев назад
5 месяцев назад
5 месяцев назад
5 месяцев назад
5 месяцев назад
README.md

AI Chat Platform on Cloud.ru

A fully automated infrastructure for deploying an AI-powered chat interface using Open WebUI, backed by PostgreSQL, Redis, and S3 storage on Cloud.ru.

Setup & Deployment

Prerequisites

  • Cloud.ru account with API access
  • Terraform CLI installed
    • Cloud.ru API credentials (Access Key, Secret Key, Project ID)
    • .terraformrc
      file should be created in
      HOME
      directory for your user
      provider_installation { filesystem_mirror { path = "<HOME>/.terraform.d/plugins" include = ["cloud.ru/cloudru/cloud"] } network_mirror { url = "https://terraform.cloud.ru/" include = ["registry.terraform.io/*/*"] } }

Configuration

  1. Edit
    terraform.tfvars
    with your credentials:

⚠️ Security Note: Never commit

terraform.tfvars
to version control. Use environment variables or a secrets manager in production.

Deployment Steps

  1. Initialize Terraform:

  2. Plan the infrastructure:

  3. Apply the configuration:

Configure Load balancer

  • Create load balancer using Cloud.ru console
  • Place load balancer only in
    ru.AZ-1
    using subnet
    ai-chat-subnet-az1-lb
  • Configure ONLY
    ai-chat-openwebui-vm-1
    as backend
  • Add ports: 80 -> 80, 443 -> 443
  • Get the public IP address of the load balancer

Configure output inventory.ini file

After terraform deployment, the Ansible inventory (

inventory.ini
) is automatically generated

  • Copy the public IP of Load Balancer and then run the following command in the terraform directory:
  • Change
    <URL_encoded_password>
    for two Redis variables - copy the password, encode it with URL encoding (e.g. with CyberChef — you need to encode all special chars)
  • Replace
    <postgresql_password>
    and
    <postgresql_IP>
    in the configuration files

Open WebUI configuration

For ai-chat-openwebui-vm-1 configuration:

  • Connect to virtual machine
    ai-chat-openwebui-vm-1
    via serial console and install ansible:
    sudo apt update sudo apt install software-properties-common sudo add-apt-repository --yes --update ppa:ansible/ansible sudo apt install ansible -y
  • Create
    inventory.ini
    and
    vm1-playbook.yaml
    in home directory and copy content of corresponding files from terraform project (generated
    inventory.ini
    and
    vms/vm1-playbook.yaml
    )
  • Apply ansible playbook with its inventory:

For ai-chat-openwebui-vm-2 configuration:

  • Now reconfigure target group of load balancer and add
    ai-chat-openwebui-vm-2
    as backend, too
  • Connect to virtual machine
    ai-chat-openwebui-vm-2
    and install ansible:
    sudo apt update sudo apt install software-properties-common sudo add-apt-repository --yes --update ppa:ansible/ansible sudo apt install ansible -y
  • Create
    inventory.ini
    and
    vm2-playbook.yaml
    in home directory and copy content of corresponding files from terraform project (generated
    inventory.ini
    and
    vms/vm2-playbook.yaml
    )
  • Generate SSH key pair with command
    ssh-keygen -t ed25519 -C "your_email@example.com"
  • Copy public key to
    /home/user1/.ssh/authorized_keys
    of
    ai-chat-openwebui-vm-1
  • Copy directory
    /home/user1/letsencrypt
    from
    ai-chat-openwebui-vm-1
    using scp:
    scp -i /home/user1/.ssh/id_ed25519 -r user1@<vm1_ip>:/home/user1/letsencrypt /home/user1/letsencrypt
  • Apply ansible playbook with its inventory:

Usage

Once deployed:

  1. Access Open WebUI at:
    http://<public-ip-of-load-balancer>
    (Note: Public IP is not explicitly exposed in this configuration; use Cloud.ru Load Balancer or DNS to route traffic)
  2. Check that models from Cloud.ru Foundation Models are available
  3. Check that uploaded files are stored in the configured S3 bucket