import re import os file_path = "generate_docs.py" with open(file_path, "r", encoding="utf-8", errors="replace") as f: content = f.read() # Replace encoding issues in generate_docs.py header as well content = content.replace("Lange Franois", "Francois Lange") content = content.replace("Lange FranA ois", "Francois Lange") # 1. Find and replace Technical_Document.md .env configuration block old_tech_env = """ MYSQL_ROOT_PASSWORD=your_db_password_here DB_READER_PASS=your_db_password_here DB_LOADER_PASS=your_db_password_here DB_APP_AUTH_PASS=your_db_password_here MYSQL_ZABBIX_PASSWORD=your_db_password_here SERVER_HOST=192.168.130.170 SERVER_USER=your_ssh_user SERVER_PASS=your_db_password_here""" new_tech_env = """ MYSQL_ROOT_PASSWORD=your_secure_root_password DB_READER_PASS=your_secure_reader_password DB_LOADER_PASS=your_secure_loader_password DB_APP_AUTH_PASS=your_secure_auth_password MYSQL_ZABBIX_PASSWORD=your_secure_zabbix_password SERVER_HOST=192.168.130.170 SERVER_USER=your_ssh_user SERVER_PASS=your_secure_server_password # ZABBIX & SNMP CREDENTIALS ZABBIX_USER=Admin ZABBIX_PASS=zabbix ZABBIX_SNMP_USER=your_snmp_user ZABBIX_SNMP_AUTHKEY=your_snmp_authkey ZABBIX_SNMP_PRIVKEY=your_snmp_privkey DISCORD_WEBHOOK=https://discord.com/api/webhooks/your_webhook_id # EMAIL ALERTS CONFIGURATION EMAIL_USER=your_email@gmail.com EMAIL_PASS=your_email_app_password # TAIGA CREDENTIALS TAIGA_URL=https://192.168.130.161/taiga TAIGA_USER=your_taiga_user TAIGA_PASS=your_taiga_password""" content = content.replace(old_tech_env, new_tech_env) # 2. Overwrite Installation_Guide.md content block inside generate_docs.py old_install_guide_content = """ "Installation_Guide.md": \"\"\"# $Id$ # Installation Guide ## Requirements - Ubuntu 24.04 LTS (or WSL2) - Docker & Docker Compose - 16GB RAM Minimum ## Deployment Steps 1. **Clone the Repository**: - *Online Mode*: `git clone https://git.btshub.lu/lanfr/LocalFoodAI_lanfr144.git` - *Offline/Disconnected Mode*: Copy the repository files directly to the target environment via SCP or USB storage. 2. `cd LocalFoodAI_lanfr144` 3. `chmod +x data_sync.sh backup_db.sh` 4. **Deploy Stack**: - For regular production: `docker compose up -d --build` - For local/offline single-node fallback: `docker compose -f docker-compose_skip.yml up -d` 5. Navigate to `http://localhost` (or `http://localhost:8502` for direct Streamlit port) \"\"\",""" new_install_guide_content = """ "Installation_Guide.md": \"\"\"# $Id$ # Local Food AI - Detailed Installation and Deployment Guide This guide describes how to provision the host hypervisor, install Docker on Ubuntu, clone the repository, check out the correct branch, and launch the application. ## 1. WSL2 Ubuntu Instance Setup To create a dedicated WSL2 environment for the application, execute the following command in an Administrator PowerShell window: ```powershell wsl --install -d Ubuntu-22.04 --name Dopro1 ``` During initialization, configure the default Unix user and password as prompted: ``` Create a default Unix user account: lanfr144 New password: Retype new password: passwd: password updated successfully ``` > [!WARNING] > **WSL Filesystem Mounts**: By default, launching WSL may place you in a Windows filesystem mount (e.g. `/mnt/d/...`). To prevent performance degradation and permission bugs, navigate to your WSL home directory immediately: ```bash cd ~ ``` --- ## 2. Docker & Docker Compose Installation inside WSL Ubuntu To install Docker directly inside your WSL Ubuntu instance (without Docker Desktop): ### Step 2.1: Clean Existing Docker Versions ```bash sudo apt remove -y docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc ``` ### Step 2.2: Add Docker's Official GPG Key & Repository ```bash sudo apt update sudo apt install -y ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc sudo tee /etc/apt/sources.list.d/docker.sources <