-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Phase 1 - Project Setup & Core Infrastructure #1
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # SysAdmin Portfolio - Environment Variables Template | ||
| # Copy this file to .env and fill in your values | ||
| # NEVER commit the .env file to version control! | ||
|
|
||
| # ============================================ | ||
| # Network Monitoring Settings | ||
| # ============================================ | ||
| # SNMP community string for device queries | ||
| SNMP_COMMUNITY=public | ||
|
|
||
| # SNMP version (1, 2c, or 3) | ||
| SNMP_VERSION=2c | ||
|
|
||
| # Default timeout for network operations (seconds) | ||
| DEFAULT_TIMEOUT=5.0 | ||
|
|
||
| # Network devices for monitoring | ||
| MIKROTIK_HOST=192.168.1.1 | ||
| UBIQUITI_HOST=192.168.1.2 | ||
| OMADA_HOST=192.168.1.3 | ||
|
|
||
| # ============================================ | ||
| # Monitoring Stack Settings | ||
| # ============================================ | ||
| # Grafana admin password (change this!) | ||
| GRAFANA_ADMIN_PASSWORD=changeme | ||
|
|
||
| # Prometheus data retention period | ||
| PROMETHEUS_RETENTION=15d | ||
|
|
||
| # Alertmanager webhook URL (optional) | ||
| ALERTMANAGER_WEBHOOK_URL= | ||
|
|
||
| # SMTP settings for email alerts (optional) | ||
| SMTP_HOST=smtp.example.com | ||
| SMTP_PORT=587 | ||
| SMTP_USER= | ||
| SMTP_PASSWORD= | ||
| ALERT_EMAIL_TO=admin@example.com | ||
|
|
||
| # ============================================ | ||
| # Microsoft 365 Settings (for PowerShell scripts) | ||
| # ============================================ | ||
| # Azure AD App Registration details | ||
| M365_TENANT_ID=your-tenant-id | ||
| M365_CLIENT_ID=your-client-id | ||
| M365_CLIENT_SECRET=your-client-secret | ||
|
|
||
| # ============================================ | ||
| # Backup Settings | ||
| # ============================================ | ||
| # Backup destination path | ||
| BACKUP_DEST=/var/backups | ||
|
|
||
| # Retention period in days | ||
| BACKUP_RETENTION_DAYS=30 | ||
|
|
||
| # Database connection strings (for DB backups) | ||
| MYSQL_HOST=localhost | ||
| MYSQL_PORT=3306 | ||
| MYSQL_USER=backup_user | ||
| MYSQL_PASSWORD= | ||
|
|
||
| POSTGRES_HOST=localhost | ||
| POSTGRES_PORT=5432 | ||
| POSTGRES_USER=backup_user | ||
| POSTGRES_PASSWORD= | ||
|
|
||
| # ============================================ | ||
| # Logging Settings | ||
| # ============================================ | ||
| # Log level: DEBUG, INFO, WARNING, ERROR, CRITICAL | ||
| LOG_LEVEL=INFO | ||
|
|
||
| # Log file path (optional, defaults to stdout) | ||
| LOG_FILE= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| name: CI Pipeline | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint & Format Check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install ruff black | ||
|
|
||
| - name: Run Ruff linter | ||
| run: ruff check . | ||
|
|
||
| - name: Check formatting with Black | ||
| run: black --check . | ||
|
|
||
| type-check: | ||
| name: Type Check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements-dev.txt | ||
|
|
||
| - name: Run MyPy | ||
| run: mypy . --ignore-missing-imports | ||
|
|
||
| test: | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements-dev.txt | ||
|
|
||
| - name: Run tests with coverage | ||
| run: | | ||
| pytest tests/ -v --cov --cov-report=xml --cov-report=term-missing | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| if: matrix.python-version == '3.11' | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| file: ./coverage.xml | ||
| fail_ci_if_error: false | ||
|
|
||
| docker-validate: | ||
| name: Validate Docker Compose | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Validate docker-compose.yml | ||
| run: | | ||
| if [ -f "2-infra-monitoring/docker-compose.yml" ]; then | ||
| docker compose -f 2-infra-monitoring/docker-compose.yml config | ||
| else | ||
| echo "docker-compose.yml not found yet, skipping validation" | ||
| fi | ||
|
|
||
| powershell-lint: | ||
| name: PowerShell Lint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install PSScriptAnalyzer | ||
| shell: pwsh | ||
| run: | | ||
| Install-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser | ||
|
|
||
| - name: Run PSScriptAnalyzer | ||
| shell: pwsh | ||
| run: | | ||
| $scripts = Get-ChildItem -Path "4-m365-admin-scripts" -Filter "*.ps1" -Recurse -ErrorAction SilentlyContinue | ||
| if ($scripts) { | ||
| Invoke-ScriptAnalyzer -Path "4-m365-admin-scripts" -Recurse -Settings PSGallery | ||
| } else { | ||
| Write-Host "No PowerShell scripts found yet, skipping lint" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| """ | ||
| SysAdmin Toolkit - Rendszergazda eszközök. | ||
|
|
||
| Ez a modul tartalmazza a rendszergazdai feladatokhoz szükséges eszközöket: | ||
| - System info riport generálás | ||
| - Disk usage monitoring és alertek | ||
| - User audit | ||
| - Service monitor | ||
| - Log analyzer | ||
|
|
||
| Használat: | ||
| >>> from sysadmin_toolkit import get_system_info | ||
| >>> info = get_system_info() | ||
| >>> print(f"CPU: {info.cpu_percent}%, RAM: {info.memory_percent}%") | ||
| """ | ||
|
|
||
| __version__ = "1.0.0" | ||
| __author__ = "SysAdmin Portfolio" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| """ | ||
| Network Health Checker - Hálózati diagnosztikai eszközök. | ||
|
|
||
| Ez a modul tartalmazza a hálózati monitorozáshoz szükséges eszközöket: | ||
| - Ping monitor (ICMP) | ||
| - Port scanner (TCP) | ||
| - DNS lookup | ||
| - Subnet calculator | ||
| - SNMP query | ||
| - Network info | ||
|
|
||
| Használat: | ||
| >>> from network_health_checker import ping_host | ||
| >>> result = ping_host("8.8.8.8") | ||
| >>> print(f"Status: {result.status}, Latency: {result.latency_ms}ms") | ||
| """ | ||
|
|
||
| __version__ = "1.0.0" | ||
| __author__ = "SysAdmin Portfolio" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| """ | ||
| Network Tools - Hálózati eszközök gyűjteménye. | ||
|
|
||
| Tartalmazza az összes hálózati diagnosztikai és monitorozási eszközt. | ||
| """ | ||
|
|
||
| # A modulok importálása a package-ből történő könnyebb eléréshez | ||
| # Ezek később kerülnek hozzáadásra a megfelelő modulok implementálásakor |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| """ | ||
| Backup Automation - Automatizált mentési rendszer. | ||
|
|
||
| Ez a modul tartalmazza a backup műveletekhez szükséges eszközöket: | ||
| - File/folder backup | ||
| - MySQL backup | ||
| - PostgreSQL backup | ||
| - Retention manager | ||
| - Restore test | ||
|
|
||
| Használat: | ||
| >>> from backup_automation import FileBackup | ||
| >>> backup = FileBackup(source="/data", dest="/backups") | ||
| >>> result = backup.run() | ||
| >>> print(f"Backup: {result.success}, Size: {result.backup_size_bytes}") | ||
| """ | ||
|
|
||
| __version__ = "1.0.0" | ||
| __author__ = "SysAdmin Portfolio" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| [build-system] | ||
| requires = ["setuptools>=61.0", "wheel"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "sysadmin-portfolio" | ||
| version = "1.0.0" | ||
| description = "Comprehensive System Administrator Portfolio - Network monitoring, automation scripts, M365 management, and infrastructure tools" | ||
| readme = "README.md" | ||
| license = {text = "MIT"} | ||
| requires-python = ">=3.9" | ||
| authors = [ | ||
| {name = "SysAdmin Portfolio", email = "admin@example.com"} | ||
| ] | ||
| classifiers = [ | ||
| "Development Status :: 4 - Beta", | ||
| "Environment :: Console", | ||
| "Intended Audience :: System Administrators", | ||
| "License :: OSI Approved :: MIT License", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.9", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Topic :: System :: Networking :: Monitoring", | ||
| "Topic :: System :: Systems Administration", | ||
| ] | ||
| keywords = ["sysadmin", "network", "monitoring", "snmp", "automation"] | ||
|
|
||
| dependencies = [ | ||
| "ping3>=4.0.4", | ||
| "pysnmp>=7.1.0", | ||
| "typer[all]>=0.9.0", | ||
| "rich>=13.0.0", | ||
| "dnspython>=2.4.0", | ||
| "pydantic>=2.0.0", | ||
| "pydantic-settings>=2.0.0", | ||
| "python-dotenv>=1.0.0", | ||
| "pyyaml>=6.0.0", | ||
| "psutil>=5.9.0", | ||
| "paramiko>=3.0.0", | ||
| "httpx>=0.25.0", | ||
| ] | ||
|
|
||
| [project.optional-dependencies] | ||
| dev = [ | ||
| "pytest>=7.0.0", | ||
| "pytest-asyncio>=0.21.0", | ||
| "pytest-cov>=4.0.0", | ||
| "pytest-mock>=3.10.0", | ||
| "mypy>=1.0.0", | ||
| "ruff>=0.1.0", | ||
| "black>=23.0.0", | ||
| ] | ||
|
|
||
| [project.scripts] | ||
| nettools = "network_health_checker.cli:app" | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/w7-mgfcode/sysadmin-portfolio" | ||
| Documentation = "https://github.com/w7-mgfcode/sysadmin-portfolio#readme" | ||
| Repository = "https://github.com/w7-mgfcode/sysadmin-portfolio.git" | ||
| Issues = "https://github.com/w7-mgfcode/sysadmin-portfolio/issues" | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["."] | ||
| include = [ | ||
| "network_health_checker*", | ||
| "sysadmin_toolkit*", | ||
| "backup_automation*", | ||
|
Comment on lines
+66
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Package discovery patterns likely won't match the actual directory structure with numeric prefixes. The |
||
| ] | ||
|
|
||
| [tool.ruff] | ||
| target-version = "py39" | ||
| line-length = 100 | ||
| select = [ | ||
| "E", # pycodestyle errors | ||
| "W", # pycodestyle warnings | ||
| "F", # Pyflakes | ||
| "I", # isort | ||
| "B", # flake8-bugbear | ||
| "C4", # flake8-comprehensions | ||
| "UP", # pyupgrade | ||
| "ARG", # flake8-unused-arguments | ||
| "SIM", # flake8-simplify | ||
| ] | ||
| ignore = [ | ||
| "E501", # line too long (handled by formatter) | ||
| "B008", # do not perform function calls in argument defaults | ||
| "B905", # zip without strict parameter | ||
| "C901", # too complex | ||
| ] | ||
|
|
||
| [tool.ruff.per-file-ignores] | ||
| "__init__.py" = ["F401"] | ||
| "tests/*" = ["ARG001"] | ||
|
|
||
| [tool.ruff.isort] | ||
| known-first-party = ["network_health_checker", "sysadmin_toolkit", "backup_automation"] | ||
|
|
||
| [tool.mypy] | ||
| python_version = "3.9" | ||
| warn_return_any = true | ||
| warn_unused_configs = true | ||
| disallow_untyped_defs = true | ||
| disallow_incomplete_defs = true | ||
| check_untyped_defs = true | ||
| ignore_missing_imports = true | ||
|
|
||
| [tool.pytest.ini_options] | ||
| minversion = "7.0" | ||
| addopts = "-ra -q --strict-markers" | ||
| testpaths = ["tests"] | ||
| pythonpath = ["."] | ||
| asyncio_mode = "auto" | ||
| markers = [ | ||
| "slow: marks tests as slow (deselect with '-m \"not slow\"')", | ||
| "integration: marks tests as integration tests", | ||
| ] | ||
|
|
||
| [tool.coverage.run] | ||
| source = ["network_health_checker", "sysadmin_toolkit", "backup_automation"] | ||
| branch = true | ||
| omit = ["*/tests/*", "*/__init__.py"] | ||
|
|
||
| [tool.coverage.report] | ||
| exclude_lines = [ | ||
| "pragma: no cover", | ||
| "def __repr__", | ||
| "raise NotImplementedError", | ||
| "if __name__ == .__main__.:", | ||
|
Comment on lines
+127
to
+132
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (testing): The coverage exclude pattern for This entry looks intended to match the usual |
||
| "if TYPE_CHECKING:", | ||
| ] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): The console script entry point may not resolve if the
network_health_checkerpackage/module isn't actually importable at the top level.This entry point targets
network_health_checker.cli:app, but the repo layout (e.g.3-network-health-checker/) doesn’t clearly provide a top-levelnetwork_health_checkerpackage. Without a realnetwork_health_checker/cli.pyimportable onPYTHONPATH, runningnettoolswill raiseImportError. Please either add a matchingnetwork_health_checkerpackage withcli.py(andapp) or update the entry point to the actual module path.