Bläddra i källkod

docs: add WSL installation runbook, WSL compose file with shifted ports, and Taiga JSON export

Lange François 1 månad sedan
förälder
incheckning
c52c6a1324
3 ändrade filer med 307 tillägg och 0 borttagningar
  1. 78 0
      INSTALL_WSL.md
  2. 190 0
      docker-compose-wsl.yml
  3. 39 0
      taiga/local-food-ai-1-36f35ff9-da1b-4eb5-9309-058448c998ad.json

+ 78 - 0
INSTALL_WSL.md

@@ -0,0 +1,78 @@
+# 🚀 WSL2 Port-Shifted Installation Guide (Local Food AI)
+
+This guide provides step-by-step instructions to install and run the **Local Food AI** system on Windows Subsystem for Linux (WSL2).
+
+To prevent port conflicts with standard local services (such as existing MySQL databases, custom Nginx web ports, Zabbix suites, or Airflow installations), all public host ports in this deployment have been increased by **+20** from their original defaults.
+
+---
+
+## 📊 Port Mapping Reference
+
+| Service Container | Original Port | Shifted Port (+20) | Type / Purpose |
+| :--- | :---: | :---: | :--- |
+| **Nginx Proxy** | `80` | **`100`** *(or `8020`)* | Main Web Gateway (Reverse Proxy) |
+| **Streamlit Application** | `8502` | **`8522`** | Direct Streamlit web port |
+| **MySQL Database** | `3306` | **`3326`** | Database external connection listener |
+| **SearXNG Search** | `8085` | **`8105`** | Anonymous meta-search gateway |
+| **Zabbix Web UI** | `8081` / `8444` | **`8101`** / **`8464`** | Monitoring dashboard (HTTP / HTTPS) |
+| **Zabbix Server Daemon** | `10051` | **`10071`** | Active telemetry monitoring trap listener |
+| **Airflow Webserver** | `8082` | **`8102`** | Airflow data workflow manager |
+
+---
+
+## 🛠️ Step-by-Step Installation Runbook
+
+### Step 1: Open Your WSL2 Ubuntu Terminal
+Ensure you have WSL2 enabled and are using an Ubuntu 24.04 shell instance.
+
+### Step 2: Clone the Git Repository
+Run the following commands inside your WSL Ubuntu home directory to clone the project:
+```bash
+git clone https://git.btshub.lu/lanfr/LocalFoodAI_lanfr144.git
+cd LocalFoodAI_lanfr144
+```
+
+### Step 3: Setup Local Environment Variables
+Create the required `.env` file at the root of the repository to feed standard local credentials to the containers:
+```bash
+cat <<EOF > .env
+MYSQL_ROOT_PASSWORD=BTSai123
+DB_READER_PASS=BTSai123
+DB_LOADER_PASS=BTSai123
+DB_APP_AUTH_PASS=BTSai123
+MYSQL_ZABBIX_PASSWORD=BTSai123
+EOF
+```
+
+### Step 4: Launch the Docker Container Stack
+Deploy the entire 10-container system in the background using the custom port-shifted WSL configuration file:
+```bash
+docker compose -f docker-compose-wsl.yml up -d
+```
+
+### Step 5: Pull the Quantized Reasoning LLM Model
+Download the high-capacity, reasoning-optimized local model **`qwen2.5:7b`** directly inside the running Ollama container instance:
+```bash
+docker exec -it $(docker ps -q -f name=ollama) ollama pull qwen2.5:7b
+```
+
+### Step 6: Ingest the OpenFoodFacts Database Records
+Initialize the database tables and trigger the ingestion pipeline to parse local dataset records:
+```bash
+docker compose -f docker-compose-wsl.yml run --rm ingest python ingest_csv.py
+```
+
+---
+
+## 🌐 Verifying and Accessing the Services
+
+Once the stack is fully running, you can connect to all system components in your web browser:
+
+*   **🍏 Streamlit Application UI**: Open `http://localhost:100` *(uses Nginx reverse proxy on Port 100)* or bypass the proxy directly at `http://localhost:8522`.
+*   **📊 Zabbix Monitoring Suite**: Open `http://localhost:8101` *(Default Credentials: Username `Admin` / Password `zabbix`)*.
+*   **🌀 Airflow Dag Orchestrator**: Open `http://localhost:8102` *(Default Credentials: Username `admin` / Password `admin`)*.
+*   **🔍 Database Server**: Connect using your preferred SQL client (DBeaver, MySQL Workbench) via Host `localhost` and Port `3326`.
+
+---
+
+*Prepared by Francois Lange for the Local Food AI Delivery.*

+ 190 - 0
docker-compose-wsl.yml

@@ -0,0 +1,190 @@
+services:
+  mysql:
+    build:
+      context: ./docker/mysql
+    ports:
+      - "3326:3306" # Shifted +20 (Original: 3306:3306)
+    volumes:
+      - mysql_data:/var/lib/mysql
+      - ./my.cnf:/etc/mysql/conf.d/custom_ai_app.cnf
+      - ./init.sql:/docker-entrypoint-initdb.d/1-init.sql
+    environment:
+      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
+    healthcheck:
+      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
+      interval: 10s
+      timeout: 5s
+      retries: 20
+    restart: always
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "50m"
+        max-file: "3"
+
+  ingest:
+    build:
+      context: .
+      dockerfile: docker/ingest/Dockerfile
+    environment:
+      - DB_HOST=mysql
+      - DB_USER=food_loader
+      - DB_PASS=${DB_LOADER_PASS}
+    volumes:
+      - ./:/app
+    profiles:
+      - manual
+
+  ollama:
+    image: ollama/ollama:latest
+    volumes:
+      - ollama_data:/root/.ollama
+    restart: always
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "50m"
+        max-file: "3"
+
+  searxng:
+    image: searxng/searxng:latest
+    ports:
+      - "8105:8080" # Shifted +20 (Original: 8085:8080)
+    volumes:
+      - ./searxng:/etc/searxng
+    environment:
+      - SEARXNG_BASE_URL=http://localhost:8080/
+    restart: always
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "50m"
+        max-file: "3"
+
+  app:
+    build:
+      context: .
+      dockerfile: docker/app/Dockerfile
+    ports:
+      - "8522:8501" # Shifted +20 (Original: 8502:8501)
+    environment:
+      - DB_HOST=mysql
+      - DB_USER=food_reader
+      - DB_PASS=${DB_READER_PASS}
+      - APP_AUTH_USER=food_app_auth
+      - APP_AUTH_PASS=${DB_APP_AUTH_PASS}
+      - OLLAMA_HOST=http://ollama:11434
+      - SEARXNG_HOST=http://searxng:8080
+    restart: always
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "50m"
+        max-file: "3"
+
+  nginx:
+    image: nginx:latest
+    ports:
+      - "100:80" # Shifted +20 (Original: 80:80). Note: If port 100 requires root or conflicts, you can use "8020:80".
+    volumes:
+      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
+    restart: always
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "50m"
+        max-file: "3"
+
+  zabbix-server:
+    image: zabbix/zabbix-server-mysql:ubuntu-7.0-latest
+    environment:
+      - DB_SERVER_HOST=mysql
+      - MYSQL_USER=zabbix
+      - MYSQL_PASSWORD=${MYSQL_ZABBIX_PASSWORD}
+      - ZBX_SNMPTRAPPER=1
+    restart: always
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "50m"
+        max-file: "3"
+    ports:
+      - "10071:10051" # Shifted +20 (Original: 10051:10051)
+
+  zabbix-web:
+    image: zabbix/zabbix-web-nginx-mysql:ubuntu-7.0-latest
+    ports:
+      - "8101:8080" # Shifted +20 (Original: 8081:8080)
+      - "8464:8443" # Shifted +20 (Original: 8444:8443)
+    environment:
+      - DB_SERVER_HOST=mysql
+      - MYSQL_USER=zabbix
+      - MYSQL_PASSWORD=${MYSQL_ZABBIX_PASSWORD}
+      - ZBX_SERVER_HOST=zabbix-server
+      - PHP_TZ=Europe/Paris
+    restart: always
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "50m"
+        max-file: "3"
+
+  zabbix-agent:
+    image: zabbix/zabbix-agent:ubuntu-7.0-latest
+    environment:
+      - ZBX_HOSTNAME=DistributedNode
+      - ZBX_SERVER_HOST=zabbix-server
+    privileged: true
+    pid: "host"
+    volumes:
+      - /var/run:/var/run
+    restart: always
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "50m"
+        max-file: "3"
+
+  airflow-webserver:
+    image: apache/airflow:2.8.1
+    environment:
+      - AIRFLOW__CORE__EXECUTOR=SequentialExecutor
+      - AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=sqlite:////opt/airflow/data/airflow.db
+      - AIRFLOW__CORE__LOAD_EXAMPLES=False
+    ports:
+      - "8102:8080" # Shifted +20 (Original: 8082:8080)
+    volumes:
+      - ./dags:/opt/airflow/dags
+      - ./logs:/opt/airflow/logs
+      - ./data:/opt/airflow/data
+      - /var/run/docker.sock:/var/run/docker.sock
+    command: webserver
+    restart: always
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "50m"
+        max-file: "3"
+
+  airflow-scheduler:
+    image: apache/airflow:2.8.1
+    environment:
+      - AIRFLOW__CORE__EXECUTOR=SequentialExecutor
+      - AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=sqlite:////opt/airflow/data/airflow.db
+      - AIRFLOW__CORE__LOAD_EXAMPLES=False
+    volumes:
+      - ./dags:/opt/airflow/dags
+      - ./logs:/opt/airflow/logs
+      - ./data:/opt/airflow/data
+      - /var/run/docker.sock:/var/run/docker.sock
+    command: bash -c "airflow db migrate && airflow users create --role Admin --username admin --email admin --firstname admin --lastname admin --password admin && airflow scheduler"
+    restart: always
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "50m"
+        max-file: "3"
+
+volumes:
+  mysql_data:
+  ollama_data:

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 39 - 0
taiga/local-food-ai-1-36f35ff9-da1b-4eb5-9309-058448c998ad.json


Vissa filer visades inte eftersom för många filer har ändrats