Skip to content

Add Docker Container Manager TUI with FazAI installer testing infrastructure#59

Draft
Copilot wants to merge 3 commits intoprestable2.0from
copilot/fix-a4af9d21-d657-4916-8008-ec3927e69ba3
Draft

Add Docker Container Manager TUI with FazAI installer testing infrastructure#59
Copilot wants to merge 3 commits intoprestable2.0from
copilot/fix-a4af9d21-d657-4916-8008-ec3927e69ba3

Conversation

Copy link

Copilot AI commented Sep 28, 2025

This PR introduces a comprehensive Docker Container Manager TUI that provides an interactive interface for managing Docker containers with predefined templates, specifically designed to streamline FazAI development and testing workflows.

🎯 Problem Solved

The original issue requested an interactive TUI program to manage Docker containers with templates for testing the FazAI installer and other development scenarios. This was needed to provide developers with an efficient way to:

  • Test the FazAI installer in clean, isolated environments
  • Manage development containers with consistent configurations
  • Streamline container-based workflows for the project

🚀 Key Features

Interactive TUI Application

  • Multi-tab interface with Containers, Templates, Images, and Logs views
  • Real-time Docker integration showing live container status and information
  • Keyboard shortcuts (q to quit, r to refresh) and intuitive button controls
  • Rich terminal interface using the Textual library, following FazAI's visual patterns

Predefined Container Templates

The TUI includes 5 ready-to-use templates for common development scenarios:

  1. Ubuntu 22.04 LTS - Clean system for general testing
  2. FazAI Installer Test - Specialized container with automated installer testing
  3. Qdrant Vector Database - Vector database for RAG functionality
  4. Nginx Development - Web server for testing
  5. Node.js 22 Development - Node.js environment with workspace mounting

FazAI Installer Test Infrastructure

A complete testing solution for validating the FazAI installation process:

  • Custom Dockerfile (Dockerfile.installer-test) with all FazAI dependencies pre-installed
  • Automated test script (docker-installer-test-entrypoint.sh) with multiple modes:
    • auto: Full install/uninstall test cycle
    • install: Test installation process only
    • uninstall: Test removal process only
    • interactive: Manual testing mode
  • Volume mounting for live code testing without rebuilding images
  • Non-root user setup mirroring real deployment scenarios

🔧 System Integration

The container manager integrates seamlessly with FazAI's existing infrastructure:

  • NPM Script: npm run containers-tui for easy access
  • CLI Wrapper: fazai-containers command available system-wide
  • Install Script Integration: Updated install.sh to include container manager in system deployment
  • Follows FazAI Conventions: Uses lower_snake_case naming for tools and structured logging

📋 Usage Examples

Launch the interactive TUI:

npm run containers-tui
# or
fazai-containers

Test FazAI installer in isolated environment:

# Create and run test container
docker run -it --name fazai-test \
  -v $(pwd):/workspace \
  fazai-installer-test

# Inside container - run automated tests
docker-installer-test-entrypoint.sh auto

🧪 Testing & Validation

  • Comprehensive test suite (tests/container_manager.test.sh) validates all functionality
  • Template validation ensures all 5 templates are properly structured
  • Docker integration tests confirm seamless operation with Docker daemon
  • Live testing confirmed - TUI successfully displays and manages real containers

📁 Files Added/Modified

New Files:

  • opt/fazai/tools/container_manager_tui.py - Main TUI application (755 lines)
  • bin/fazai-containers - CLI wrapper script
  • Dockerfile.installer-test - Custom container for installer testing
  • docker-installer-test-entrypoint.sh - Automated testing script
  • docs/CONTAINER_MANAGER.md - Complete user documentation
  • tests/container_manager.test.sh - Comprehensive test suite

Modified Files:

  • package.json - Added containers-tui NPM script
  • install.sh - Added container manager to system installation
  • .gitignore - Added Python cache file exclusions

This implementation provides immediate productivity benefits for container-based development while maintaining full compatibility with FazAI's architectural patterns and conventions.

Original prompt

acompa
The following is a snapshot of a chat conversation between a user and an AI coding assistant. Prioritize later messages in the conversation.
User: explique e ajuste o problmea
User: como funciona o models?
AI: O sistema FazAI utiliza modelos de linguagem Gemma (Google) para inferência local, seguindo uma arquitetura modular e desacoplada. O componente de modelos (“models”) refere-se ao diretório onde ficam armazenados os arquivos dos modelos Gemma, normalmente em
AI: .

Funcionamento:

  1. Armazenamento:
    Os modelos são baixados (ex: via HuggingFace CLI) e salvos nesse diretório, geralmente no formato .sbs ou similar.

  2. Carregamento:
    O worker Python/C++ (bindings via PyBind11) inicializa o modelo a partir desse caminho, usando a variável de ambiente GEMMA_MODEL_PATH ou o caminho padrão.

  3. Inferência:
    Quando um prompt é enviado, o worker utiliza a LibGemma para processar o texto e gerar uma resposta, retornando o resultado para o daemon ou CLI.

  4. Configuração:
    O caminho do modelo pode ser alterado via variável de ambiente ou configuração no código, permitindo trocar de
    User: me refiro a opcao @ models]
    AI: No contexto do FazAI, a opção @ models geralmente se refere ao gerenciamento ou seleção de modelos de IA utilizados pelo sistema, especialmente os modelos Gemma (como o Gemma 2B) para inferência local.

Como funciona o models no FazAI?

  • Localização dos modelos:
    Os modelos ficam em
    AI: .
    Exemplo: /opt/fazai/models/gemma/gemma2-2b-it-sfp.sbs

  • Seleção e configuração:
    O FazAI permite selecionar qual modelo usar via variáveis de ambiente (GEMMA_MODEL_PATH) ou configuração no daemon/worker.

  • Uso no worker:
    O worker C++/Python carrega o modelo especificado e executa a inferência conforme os prompts recebidos.

  • Comando CLI:
    Se você usar algo como fazai @ models ou fazai models, normalmente espera-se listar, adicionar ou trocar o modelo ativo.

Ajuste de problema comum

Se o comando @ models não está funcionando ou retorna erro, verifique:

  1. Modelos baixados:
    Confirme se há arquivos .sbs em
    AI: .

  2. Permissões:
    O usuário do daemon/worker precisa ter permissão de leitura nesses arquivos.

  3. Configuração do caminho:
    Exporte a variável de ambiente:

    export GEMMA_MODEL_PATH="/opt/fazai/models/gemma/gemma2-2b-it-sfp.sbs"
  4. Logs:
    Veja os logs do daemon (
    AI: ) para mensagens sobre carregamento de modelo.

  5. Reinstalação:
    Se necessário, rode novamente o instalador ou o script de build do modelo:

    ./build_gemma_native.sh

Se precisar de um ajuste específico no código ou script relacionado a models, envie o trecho ou detalhe o erro para que eu possa propor a correção exata.
User: aqui meu
AI: Entendi! O que você está vendo na imagem é o menu de comandos rápidos do VS Code (ativado por Ctrl+P ou Ctrl+Shift+P), onde comandos que começam com @ são usados para buscas e ações rápidas dentro
User: nao... eh do github vou ter que rodar isso @models
AI: Entendi! No seu print, a opção @models aparece no menu de comandos rápidos do GitHub Copilot Chat no VS Code.
Não é um comando do FazAI, mas sim do Copilot Chat.

O que faz o @models no Copilot Chat?

  • Função:
    Permite consultar ou trocar o modelo de IA usado pelo Copilot Chat (por exemplo, GPT-4, GPT-3.5, etc).
  • Como usar:
    Digite @models na barra do Copilot Chat, pressione Enter e veja as opções de modelos disponíveis para seleção.
  • Não afeta o FazAI:
    Isso só muda o modelo do Copilot Chat, não interfere nos modelos Gemma ou no worker do FazAI.

Resumo:
O @models que você vê é do Copilot Chat (GitHub Copilot), não do FazAI.
Se quiser gerenciar modelos do FazAI, use os scripts e variáveis conforme a documentação do FazAI.

Se precisar de exemplos para trocar modelos no FazAI, posso ajudar!
User: eu quero uma ideia pra cria um container pra testar um instalador...
AI: Ótimo! Para testar o instalador do FazAI v2.0 de forma isolada e reprodutível, o ideal é criar um container Docker minimalista, simulando um ambiente limpo (ex: Ubuntu ou Debian), onde você possa rodar o
AI: e validar dependências, permissões e funcionamento.

Exemplo de Dockerfile para Teste do Instalador FazAI

AI: FROM ubuntu:22.04

# Instala dependências básicas
RUN apt-get update && \
    apt-get install -y \
      sudo \
      curl \
      git \
      build-essential \
      cmake \
      python3 \
      python3-pip \
      python3-dev \
      pkg-config \
      libssl-dev \
      libffi-dev \
      wget \
      lsb-release \
      && rm -rf /var/lib/apt/lists/*

# Cria usuário não-root para simular ambiente real
RUN useradd -ms /bin/bash fazai && echo "fazai ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# Define diretório de ...

</details>
Created from VS Code via the [GitHub Pull Request](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github) extension.

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click [here](https://survey3.medallia.com/?EAHeSx-AP01bZqG0Ld9QLQ) to start the survey.

Copilot AI and others added 2 commits September 28, 2025 09:50
…late

Co-authored-by: RLuf <74881309+RLuf@users.noreply.github.com>
Co-authored-by: RLuf <74881309+RLuf@users.noreply.github.com>
Copilot AI changed the title [WIP] Summary of FazAI Development and Container Management Conversation Add Docker Container Manager TUI with FazAI installer testing infrastructure Sep 28, 2025
Copilot AI requested a review from RLuf September 28, 2025 09:53
Copy link
Owner

@RLuf RLuf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6.62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants