8000 GitHub - allthingslinux/infra
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

allthingslinux/infra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

All Things Linux Infrastructure Monorepo

All Things Linux Terraform Ansible Docker Infrastructure as Code

Infrastructure-as-Code monorepo for the All Things Linux 501(c)(3) non-profit organization

πŸš€ Quick Start β€’ πŸ“ Structure β€’ πŸ”§ Development β€’ πŸ“š Documentation

πŸ—οΈ Overview

This infrastructure monorepo contains the complete platform-as-code for All Things Linux, a 501(c)(3) non-profit organization. We manage infrastructure for 10,000+ community members using modern GitOps practices and infrastructure-as-code principles.

🎯 What This Repo Manages

Infrastructure Only - Applications live in separate repositories:

  • πŸ—οΈ Infrastructure Provisioning - Terraform for Hetzner Cloud resources
  • βš™οΈ Configuration Management - Ansible for server configuration
  • πŸ” Monitoring & Observability - Prometheus, Grafana, and alerting
  • 🌐 Network & Security - Load balancing, SSL, firewalls
  • πŸ“¦ Platform Services - Shared services (databases, caching, etc.)

πŸ“± Applications (Separate Repos)

Applications deploy to this infrastructure but live independently:

  • Discord Bot (Tux) - Community automation and moderation
  • ATL Wiki - Educational resources and documentation
  • ATL Tools - Self-hosted applications suite
  • ATL Chat - Multi-platform communication bridging
  • ATL Dev - Developer pubnix and hosting platform

πŸš€ Quick Start

Unified CLI (Recommended)

The atl CLI provides a unified interface for all infrastructure operations:

# Install dependencies
poetry install

# Quick operations
atl plan                    # Plan infrastructure changes
atl apply -y               # Apply changes with auto-approve
atl lint --fix             # Run linting with auto-fix
atl docs build --serve     # Build and serve documentation

# Organized commands
atl infra plan             # Infrastructure planning
atl infra apply            # Infrastructure deployment
atl infra destroy          # Infrastructure destruction
atl quality lint           # Code quality checks
atl docs build             # Documentation generation
atl utils update-collections  # Ansible collections update

# Get help
atl info                   # Show available commands
atl status                 # Check tool availability
atl <command> --help       # Detailed help for any command

Prerequisites

  • Python 3.11+ with Poetry for dependency management
  • Terraform for infrastructure provisioning
  • Ansible for configuration management
  • Hetzner Cloud account and API token
  • Cloudflare account and API token

Installation

  1. Clone and setup:

    git clone <repository-url>
    cd infra
    
    # Install dependencies
    poetry install
    poetry run ansible-galaxy collection install -r ansible/collections/requirements.yml
  2. Configure secrets:

    # Copy secrets template
    cp configs/secrets.example.yml configs/secrets.yml
    
    # Edit with your actual credentials (never commit this!)
    edit configs/secrets.yml
  3. Set up development environment:

    # Install pre-commit hooks
    ./scripts/setup/setup-hooks.sh
    
    # Run validation
    atl lint
  4. Deploy infrastructure:

    # Plan changes first
    cd terraform/environments/staging
    terraform plan
    
    # Apply infrastructure
    terraform apply
    
    # Configure servers
    cd ../../../ansible
    ansible-playbook -i inventories/dynamic.py playbooks/site.yml

πŸ“ Monorepo Structure

infra/                           # πŸ—οΈ Infrastructure Monorepo
β”œβ”€β”€ πŸ“‹ README.md                 # This file
β”œβ”€β”€ πŸ”§ configs/                  # 🎯 Configuration Management
β”‚   β”œβ”€β”€ domains.yml              # Domain configurations
β”‚   β”œβ”€β”€ environments.yml         # Environment definitions
β”‚   └── secrets.example.yml      # Secrets template (never commit secrets.yml!)
β”‚
β”œβ”€β”€ πŸ—οΈ terraform/                # Infrastructure Provisioning
β”‚   β”œβ”€β”€ modules/                 # Reusable Terraform modules
β”‚   β”‚   β”œβ”€β”€ network/             # VPC, subnets, security groups
β”‚   β”‚   β”œβ”€β”€ compute/             # Servers, load balancers
β”‚   β”‚   └── security/            # SSL, firewalls, monitoring
β”‚   β”œβ”€β”€ environments/            # Environment-specific configs
β”‚   β”‚   β”œβ”€β”€ production/          # Production infrastructure
β”‚   β”‚   β”œβ”€β”€ staging/             # Staging environment
β”‚   β”‚   └── development/         # Development environment
β”‚   └── shared/                  # Cross-environment resources (DNS, etc.)
β”‚
β”œβ”€β”€ βš™οΈ ansible/                  # Configuration Management
β”‚   β”œβ”€β”€ ansible.cfg              # Ansible configuration
β”‚   β”œβ”€β”€ inventories/             # Dynamic and static inventories
β”‚   β”‚   └── dynamic.py           # Dynamic inventory from Terraform
β”‚   β”œβ”€β”€ playbooks/               # Ansible playbooks
β”‚   β”‚   β”œβ”€β”€ site.yml             # Main deployment playbook
β”‚   β”‚   β”œβ”€β”€ infrastructure/      # Infrastructure setup playbooks
β”‚   β”‚   β”œβ”€β”€ security/            # Security hardening
β”‚   β”‚   └── domains/             # Domain-specific deployments
β”‚   β”œβ”€β”€ roles/                   # Reusable Ansible roles
β”‚   β”‚   β”œβ”€β”€ system/              # Base system configuration
β”‚   β”‚   β”œβ”€β”€ docker/              # Docker and containers
β”‚   β”‚   └── monitoring/          # Monitoring agents
β”‚   β”œβ”€β”€ group_vars/              # Group variables
β”‚   β”œβ”€β”€ host_vars/               # Host-specific variables
β”‚   └── collections/             # Ansible collections requirements
β”‚
β”œβ”€β”€ πŸ“Š monitoring/               # Observability Stack
β”‚   β”œβ”€β”€ prometheus/              # Metrics collection
β”‚   β”œβ”€β”€ grafana/                 # Dashboards and visualization
β”‚   └── alerting/                # Alert rules and notifications
β”‚
β”œβ”€β”€ πŸ”§ scripts/                  # Automation and Tooling
β”‚   β”œβ”€β”€ deploy.py                # Modern Python deployment CLI
β”‚   β”œβ”€β”€ lint.py                  # Code quality and validation
β”‚   β”œβ”€β”€ docs.py                  # Documentation generation
β”‚   β”œβ”€β”€ common/                  # Shared utilities
β”‚   └── setup/                   # Environment setup scripts
β”‚
β”œβ”€β”€ πŸ“š docs/                     # Infrastructure Documentation
β”‚   β”œβ”€β”€ guides/                  # How-to guides
β”‚   β”œβ”€β”€ architecture/            # Architecture decisions
β”‚   β”œβ”€β”€ runbooks/                # Operational procedures
β”‚   └── setup/                   # Setup and configuration
β”‚
β”œβ”€β”€ πŸ”„ .github/workflows/        # CI/CD Pipelines
β”‚   β”œβ”€β”€ terraform.yml            # Infrastructure validation
β”‚   β”œβ”€β”€ ansible.yml              # Configuration validation
β”‚   └── docs.yml                 # Documentation deployment
β”‚
└── 🐍 Python Environment        # Development Environment
    β”œβ”€β”€ pyproject.toml            # Poetry dependencies & CLI tools
    β”œβ”€β”€ poetry.lock               # Locked dependencies
    └── mise.toml                 # Development environment

πŸ—οΈ Architecture Principles

This monorepo follows modern platform engineering patterns:

  • πŸ”„ GitOps - Infrastructure changes via git workflows
  • πŸ“¦ Modular - Reusable Terraform modules and Ansible roles
  • 🌍 Multi-environment - Consistent dev/staging/production
  • πŸ” Observable - Built-in monitoring and alerting
  • πŸ”’ Secure - Security hardening and secrets management
  • πŸ“± App-agnostic - Applications deploy independently

πŸš€ Unified ATL CLI

A single, powerful CLI that consolidates all infrastructure operations into an intuitive interface:

Unified CLI

The atl CLI provides a single interface for all infrastructure operations:

Command Group Purpose Key Features
atl infra Infrastructure management Terraform + Ansible deployment with rich output
atl quality Code quality validation Multi-format linting, auto-fix capabilities
atl docs Documentation generation Automated docs from infrastructure code
atl utils Utility operations Collection updates, maintenance tasks

Usage Examples

# Quick access commands
atl plan                            # Preview infrastructure changes
atl apply                           # Apply infrastructure changes
atl lint                            # Run validation checks

# Organized commands
atl infra plan --environment staging
atl infra apply --environment production
atl quality lint --fix             # Auto-fix common issues
atl docs build --serve             # Generate and serve documentation

# Get help and status
atl info                            # Show all available commands
atl status                          # Check tool availability

🎭 Role-Based Access Control

Comprehensive team access management:

Infrastructure Teams

  • πŸ”§ Platform Engineering: Full infrastructure access
  • ☁️ Cloud Operations: Environment management and monitoring
  • πŸ”’ Security: Security policies and compliance
  • πŸ“Š Site Reliability: Monitoring and incident response

Development Teams

  • πŸ–₯️ Backend Engineers: API and service deployment
  • 🎨 Frontend Engineers: Web application deployment
  • 🐍 Python Developers: Discord bot and tools deployment
  • πŸ“± Mobile Developers: Mobile app infrastructure

Community Teams

  • πŸ‘¨β€πŸ’Ό Management: Oversight and resource allocation
  • πŸ›‘οΈ Moderation: Community management tools
  • 🎨 Creative: Content and brand management

πŸ—οΈ Infrastructure Overview

Multi-Environment Strategy

Environment Purpose Infrastructure
Production Live services High-availability, monitoring, backups
Staging Pre-production testing Production-like, automated testing
Development Feature development Lightweight, rapid iteration

Core Platform Services

  • 🌐 Load Balancing: HAProxy with automatic failover
  • πŸ—„οΈ Databases: PostgreSQL clusters with Redis caching
  • πŸ“Š Monitoring: Prometheus + Grafana + AlertManager
  • πŸ” Logging: Centralized log aggregation and analysis
  • πŸ”’ Security: Automated security scanning and hardening
  • πŸ’Ύ Backups: Automated backup and disaster recovery

πŸ”§ Development

Local Development Setup

# Install development dependencies
poetry install

# Set up pre-commit hooks
./scripts/setup/setup-hooks.sh

# Validate your setup
atl lint

Workflow

  1. 🌿 Branch: Create feature branch from main
  2. πŸ’» Develop: Make infrastructure changes
  3. βœ… Validate: Run atl lint
  4. πŸ§ͺ Test: Deploy to development environment
  5. πŸ“ Document: Update relevant documentation
  6. πŸ”„ PR: Create pull request for review
  7. πŸš€ Deploy: Merge triggers deployment pipeline

Testing

# Syntax validation
atl lint

# Infrastructure planning
cd terraform/environments/development
terraform plan

# Configuration testing
cd ansible
ansible-playbook --syntax-check playbooks/site.yml

πŸ“š Documentation

Comprehensive documentation available in docs/:

🀝 Contributing

  1. πŸ“– Read the development guide
  2. 🍴 Fork this repository
  3. 🌿 Create a feature branch
  4. βœ… Test your changes thoroughly
  5. πŸ“ Document any new features
  6. πŸ”„ Submit a pull request

πŸ“„ License

This infrastructure code is licensed under the MIT License. See LICENSE for details.


All Things Linux β€’ A 501(c)(3) Non-Profit Organization

Empowering the Linux ecosystem through education, collaboration, and open infrastructure

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published
0