-
Notifications
You must be signed in to change notification settings - Fork 0
Infra-MCP v2 with tools for container deployment #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dd79f2c
Use `--quiet` flag to reduce LLM token usage
bubacoder b219e9b
Rename CLAUDE.md to AGENTS.md, add symlinks
bubacoder c23391e
Enable ruff - flake8-bandit and tryceratops
bubacoder 650859a
Add fix-lint-issue command
bubacoder 89de756
Remove obsolete git-reorder-fixup script
bubacoder 7f61bad
Fix linter issues
bubacoder 34171b5
Refactor container deployment command, integrate with MCP tools
bubacoder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Fix specific lint issue (parameter: issue code or description) | ||
|
|
||
| ## Variables | ||
|
|
||
| ISSUE_ID: $ARGUMENTS | ||
|
|
||
| ## Instructions | ||
|
|
||
| 1. Run "task lint-app" to identify all lint issues | ||
| 2. Filter for issues matching "ISSUE_ID" (can be a specific error code like S607 or a description like "subprocess") | ||
| 3. Analyze each matching issue and implement fixes according to best practices | ||
| 4. For each fixed issue: | ||
| - Explain the problem and why it's a concern | ||
| - Show the original code | ||
| - Explain your fix and its benefits | ||
| 5. After implementing fixes, run "task lint-app" again to verify the issues are resolved | ||
| 6. Summarize your changes and list any remaining issues grouped by type | ||
|
|
||
| Notes: | ||
| - Focus only on issues matching the specified ISSUE_ID | ||
| - Apply consistent fixes across similar issues | ||
| - For Python security issues (S-prefixed codes), consult Python security best practices | ||
| - For other issues, follow the appropriate linting tool's recommendations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,192 @@ | ||
| # CLAUDE.md | ||
|
bubacoder marked this conversation as resolved.
|
||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Repository Overview | ||
|
|
||
| This repository contains Infrastructure as Code (IaC) configuration for a home infrastructure setup. The main goals are: | ||
| - Creating a local, self-hosted environment for various services minimizing reliance on cloud providers | ||
| - Learning and organizing knowledge, best practices, and tool documentation | ||
|
|
||
| ## Key Commands | ||
|
|
||
| ### Development and Building | ||
|
|
||
| ```bash | ||
| # List all available tasks | ||
| task --list-all | ||
|
|
||
| # Run all linting and build tasks | ||
| task build | ||
|
|
||
| # Run linting tools on all files (via pre-commit) | ||
| task lint | ||
|
|
||
| # Open TaskUI (terminal UI for executing tasks) | ||
| task ui | ||
|
|
||
| # Clear generated content and cache data | ||
| task clean | ||
| ``` | ||
|
|
||
| ### Docker Management | ||
|
|
||
| ```bash | ||
| # Deploy locally configured containers | ||
| task docker:apply | ||
|
|
||
| # Update and restart containers | ||
| task docker:update | ||
|
|
||
| # Pull container images | ||
| task docker:pull | ||
|
|
||
| # Pull, update, restart containers, then show restarts | ||
| task docker:pull-update | ||
|
|
||
| # Stop configured containers | ||
| task docker:stop | ||
|
|
||
| # Create/update Docker example environment configuration files | ||
| task docker:create-example-env | ||
| ``` | ||
|
|
||
| ### Service Management | ||
|
|
||
| ```bash | ||
| # Manage individual Docker service (pull, up, down, restart, recreate, config) | ||
| scripts/labctl.py service [operation] [category/service-name] | ||
|
|
||
| # Examples: | ||
| scripts/labctl.py service up security/traefik | ||
| scripts/labctl.py service restart ai/ollama | ||
| scripts/labctl.py service pull media/video/jellyfin | ||
| ``` | ||
|
|
||
| ### Ansible Commands | ||
|
|
||
| ```bash | ||
| # Run Ansible for homelab setup | ||
| task ansible:apply-homelab | ||
|
|
||
| # Run Ansible for cloud setup | ||
| task ansible:apply-cloud | ||
| ``` | ||
|
|
||
| ### Terraform Management | ||
|
|
||
| ```bash | ||
| # Apply Azure VM Terraform configuration | ||
| task azure-vm:apply | ||
|
|
||
| # Plan Azure VM Terraform changes | ||
| task azure-vm:plan | ||
|
|
||
| # Destroy Azure VM Terraform resources | ||
| task azure-vm:destroy | ||
| ``` | ||
|
|
||
| ### Utility Commands | ||
|
|
||
| ```bash | ||
| # Show public IP of the server | ||
| task get-public-ip | ||
|
|
||
| # Show version numbers of installed software | ||
| task versions | ||
|
|
||
| # Create a compressed backup of the configuration directory | ||
| task backup-config | ||
|
|
||
| # Download data files for offline use | ||
| task get-offline-data | ||
| ``` | ||
|
|
||
| ## Architecture Overview | ||
|
|
||
| The infrastructure is designed around the following components: | ||
|
|
||
| 1. **Core Infrastructure**: | ||
| - Proxmox Virtual Environment as a Type 1 hypervisor | ||
| - Ubuntu Server as the host OS for Docker containers | ||
| - Ansible for configuration management | ||
| - Docker Compose for container definitions | ||
|
|
||
| 2. **Key Services**: | ||
| - **Security**: Traefik (reverse proxy), Authelia (authentication), Cloudflared (tunnel) | ||
| - **Monitoring**: Grafana, Prometheus, Node-exporter, Uptime-kuma | ||
| - **Media**: Jellyfin, Metube, Navidrome, Calibre | ||
| - **Storage**: MinIO, Syncthing, FileSharing | ||
| - **AI Tools**: Ollama, Open-WebUI, LiteLLM, AutogenStudio | ||
| - **Tools**: Guacamole, Homepage (dashboard), Vaultwarden | ||
|
|
||
| 3. **Configuration Structure**: | ||
| - `ansible/`: Contains playbooks and roles for infrastructure setup | ||
| - `docker/`: Contains Docker Compose definitions for all services | ||
| - `docs/`: Documentation and usage instructions | ||
| - `terraform/`: IaC for cloud provisioning | ||
| - `azure-vm/`: Azure Virtual Machine deployment with CloudInit | ||
| - `proxmox/`: Scripts for VM creation and management | ||
| - `scripts/`: Utility scripts for various tasks | ||
| - `config/`: Host-specific configuration (not in repository) | ||
| - `config-example/`: Example configuration files | ||
|
|
||
| ## Development Workflow | ||
|
|
||
| This project uses: | ||
| - **Task** (taskfile.dev) as a task runner/build tool | ||
| - **Pre-commit** for code quality and security checks: | ||
| - Shell script validation with ShellCheck | ||
| - YAML linting and validation | ||
| - Terraform validation and formatting | ||
| - Ansible linting | ||
| - Python linting with Ruff | ||
| - Dockerfile linting with Hadolint | ||
| - Security scanning with Gitleaks and KICS | ||
| - **Docker** and Docker Compose for containerized services | ||
| - **Python** for service management via the `scripts/labctl.py` tool | ||
| - **GitHub Actions** for CI/CD workflows: | ||
| - Pre-commit checks | ||
| - Building devcontainer | ||
| - Building and deploying documentation site | ||
| - **Renovate** for automated dependency updates | ||
|
|
||
| ## Docker Service Management | ||
|
|
||
| The repository uses a custom Python script (`scripts/labctl.py`) to manage Docker services defined in YAML files: | ||
|
|
||
| 1. Services are organized by category (security, media, tools, etc.) | ||
| 2. Each service has a YAML definition file with container specifications | ||
| 3. Host-specific configuration is defined in `config/docker/<hostname>/services.yaml` | ||
| 4. Environment variables are loaded from `.env` files in the config directory | ||
| 5. The `labctl.py` script supports operations: up, down, restart, recreate, update, pull, config. | ||
|
|
||
| When adding or modifying services: | ||
| 1. Create or edit the YAML file in the appropriate category directory | ||
| 2. Add the service to the host configuration in `config/docker/<hostname>/services.yaml` | ||
| 3. Provide any required environment variables in the appropriate `.env` files | ||
| 4. Deploy using `task docker:apply` or using the specific service command | ||
|
|
||
| ## File Structure | ||
|
|
||
| Key directories and their purposes: | ||
|
|
||
| ```text | ||
| / | ||
| ├── ansible/ # Ansible configuration for server setup | ||
| │ ├── playbooks/ # Main playbooks for different environments | ||
| │ └── roles/ # Individual roles for specific configurations | ||
| ├── docker/ # Docker Compose files for services | ||
| │ ├── security/ # Auth and security services | ||
| │ ├── media/ # Media services | ||
| │ ├── storage/ # Storage services | ||
| │ ├── monitoring/ # Monitoring services | ||
| │ ├── ai/ # AI-related services | ||
| │ └── tools/ # Various utility services | ||
| ├── docs/ # Documentation | ||
| ├── terraform/ # Terraform configurations | ||
| │ └── azure-vm/ # Azure VM deployment with CloudInit | ||
| └── scripts/ # Utility scripts | ||
| ``` | ||
|
|
||
| When contributing to this repository, follow the pre-commit rules defined in `.pre-commit-config.yaml` which includes linting for shell scripts, Dockerfiles, YAML files, Ansible playbooks, and Terraform configurations. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.