Skip to content

Commit b45508e

Browse files
authored
Merge branch 'main' into copilot/add-meshtastic-support
2 parents e077bc4 + 9a4a75c commit b45508e

File tree

108 files changed

+25877
-1942
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+25877
-1942
lines changed

.dockerignore

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Git
2+
.git
3+
.gitignore
4+
.github
5+
6+
# Python
7+
__pycache__
8+
*.py[cod]
9+
*$py.class
10+
*.so
11+
.Python
12+
env/
13+
venv/
14+
ENV/
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
*.egg-info/
28+
.installed.cfg
29+
*.egg
30+
MANIFEST
31+
32+
# Testing
33+
.pytest_cache
34+
.coverage
35+
.coverage.*
36+
htmlcov/
37+
.tox/
38+
.hypothesis/
39+
.mypy_cache/
40+
.dmypy.json
41+
dmypy.json
42+
43+
# IDEs
44+
.vscode/
45+
.idea/
46+
*.swp
47+
*.swo
48+
*~
49+
.DS_Store
50+
51+
# Documentation
52+
docs/_build/
53+
*.md
54+
!README.md
55+
56+
# CI/CD
57+
.github/
58+
.pre-commit-config.yaml
59+
60+
# Other
61+
*.log
62+
*.zip
63+
Planning*.zip
64+
examples/
65+
tests/
66+
*.tar
67+
*.tar.gz

.github/workflows/docker.yml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
branches: [ main ]
10+
workflow_dispatch:
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
IMAGE_NAME: ${{ github.repository }}
15+
16+
jobs:
17+
build-and-push:
18+
name: Build and Push Docker Images
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
strategy:
25+
matrix:
26+
target: [production, development]
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
35+
- name: Log in to Container Registry
36+
if: github.event_name != 'pull_request'
37+
uses: docker/login-action@v3
38+
with:
39+
registry: ${{ env.REGISTRY }}
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Extract metadata (tags, labels)
44+
id: meta
45+
uses: docker/metadata-action@v5
46+
with:
47+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
tags: |
49+
type=ref,event=branch
50+
type=ref,event=pr
51+
type=semver,pattern={{version}}
52+
type=semver,pattern={{major}}.{{minor}}
53+
type=semver,pattern={{major}}
54+
type=sha
55+
flavor: |
56+
suffix=-${{ matrix.target }},onlatest=true
57+
58+
- name: Build and push Docker image
59+
uses: docker/build-push-action@v5
60+
with:
61+
context: .
62+
file: ./deployment/docker/Dockerfile
63+
target: ${{ matrix.target }}
64+
push: ${{ github.event_name != 'pull_request' }}
65+
tags: ${{ steps.meta.outputs.tags }}
66+
labels: ${{ steps.meta.outputs.labels }}
67+
cache-from: type=gha
68+
cache-to: type=gha,mode=max
69+
platforms: linux/amd64,linux/arm64
70+
71+
- name: Test Docker image
72+
if: matrix.target == 'production'
73+
run: |
74+
docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-production accelerapp --version || true
75+
docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-production accelerapp info
76+
77+
build-compose:
78+
name: Test Docker Compose
79+
runs-on: ubuntu-latest
80+
needs: build-and-push
81+
82+
steps:
83+
- name: Checkout code
84+
uses: actions/checkout@v4
85+
86+
- name: Set up Docker Buildx
87+
uses: docker/setup-buildx-action@v3
88+
89+
- name: Build Docker Compose services
90+
run: |
91+
cd deployment/docker
92+
docker-compose build --no-cache
93+
94+
- name: Test Docker Compose services
95+
run: |
96+
cd deployment/docker
97+
docker-compose up -d accelerapp
98+
sleep 10
99+
docker-compose ps
100+
docker-compose logs accelerapp
101+
docker-compose down
102+
103+
- name: Clean up
104+
if: always()
105+
run: |
106+
cd deployment/docker
107+
docker-compose down -v
108+
109+
scan-security:
110+
name: Security Scan Docker Images
111+
runs-on: ubuntu-latest
112+
needs: build-and-push
113+
if: github.event_name != 'pull_request'
114+
115+
steps:
116+
- name: Checkout code
117+
uses: actions/checkout@v4
118+
119+
- name: Run Trivy vulnerability scanner
120+
uses: aquasecurity/trivy-action@master
121+
with:
122+
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-production
123+
format: 'sarif'
124+
output: 'trivy-results.sarif'
125+
126+
- name: Upload Trivy results to GitHub Security tab
127+
uses: github/codeql-action/upload-sarif@v3
128+
if: always()
129+
with:
130+
sarif_file: 'trivy-results.sarif'
131+
132+
- name: Run Trivy vulnerability scanner (table format)
133+
uses: aquasecurity/trivy-action@master
134+
with:
135+
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-production
136+
format: 'table'
137+
exit-code: '0'
138+
ignore-unfixed: true
139+
severity: 'CRITICAL,HIGH'
140+
141+
publish-manifest:
142+
name: Create Multi-arch Manifest
143+
runs-on: ubuntu-latest
144+
needs: build-and-push
145+
if: startsWith(github.ref, 'refs/tags/v')
146+
147+
steps:
148+
- name: Log in to Container Registry
149+
uses: docker/login-action@v3
150+
with:
151+
registry: ${{ env.REGISTRY }}
152+
username: ${{ github.actor }}
153+
password: ${{ secrets.GITHUB_TOKEN }}
154+
155+
- name: Create and push manifest
156+
run: |
157+
VERSION=${GITHUB_REF#refs/tags/v}
158+
docker manifest create \
159+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} \
160+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}-production
161+
docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}
162+
163+
docker manifest create \
164+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
165+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-production
166+
docker manifest push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest

CHANGELOG.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,110 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added - Phase 6: Optimization – Performance, Cost, and Documentation
11+
12+
#### Performance Optimization (2 new modules)
13+
- **Performance Profiler**: Comprehensive performance profiling and optimization system
14+
- `PerformanceProfiler`: Profile functions with CPU, memory, and I/O tracking
15+
- Hotspot identification and bottleneck detection
16+
- Baseline comparison and regression detection (>10% slowdown)
17+
- Optimization strategy recommendations with impact estimates
18+
- Support for multiple profiling types: CPU, MEMORY, IO, FULL
19+
- Performance summaries and statistics
20+
- **Performance Features**:
21+
- Function-level execution time measurement (< 50ms overhead)
22+
- Memory usage tracking with tracemalloc integration
23+
- Automatic hotspot detection (execution >100ms or memory >50MB)
24+
- Baseline management and historical comparison
25+
- Actionable optimization recommendations (caching, async, batching)
26+
- Regression detection with configurable thresholds
27+
28+
#### Cost Optimization (2 new modules)
29+
- **Cost Monitor**: Complete cost monitoring and optimization framework
30+
- `CostMonitor`: Track infrastructure costs across cloud providers
31+
- Multi-cloud support: AWS, Azure, GCP, On-Premise
32+
- Resource type tracking: Compute, Storage, Database, Network, Container, Serverless
33+
- Cost breakdown by provider and resource type
34+
- 30-day cost forecasting with confidence intervals
35+
- Automated optimization opportunity detection
36+
- **Cost Features**:
37+
- Real-time resource cost tracking
38+
- Underutilized resource detection (<30% utilization)
39+
- Idle resource identification (>24 hours inactive)
40+
- Oversized resource detection (low CPU/memory usage)
41+
- Cost report generation with savings opportunities
42+
- Automated cost optimization application
43+
- Cost estimation with customizable pricing
44+
45+
#### Comprehensive Documentation (4 new guides)
46+
- **Operations Manual** (`docs/OPERATIONS.md`, 550 lines):
47+
- System overview and architecture components
48+
- Deployment and configuration (Docker, Kubernetes, cloud)
49+
- Monitoring and health checks (Prometheus, Grafana)
50+
- Performance management and scaling guidelines
51+
- Cost management procedures
52+
- Security operations and incident response
53+
- Backup and recovery (RTO: 4 hours, RPO: 4 hours)
54+
- Maintenance procedures (daily, weekly, monthly)
55+
- Troubleshooting guides and quick reference
56+
57+
- **Performance Tuning Guide** (`docs/PERFORMANCE_TUNING.md`, 500 lines):
58+
- Performance baseline establishment (targets and metrics)
59+
- Profiling techniques (CPU, memory, I/O)
60+
- Application-level optimization (caching, async, lazy loading)
61+
- Database optimization (indexing, query tuning, connection pooling)
62+
- Multi-level caching strategies (memory, Redis, database)
63+
- Network optimization (HTTP/2, CDN, compression)
64+
- Resource management (memory, CPU, garbage collection)
65+
- Benchmarking best practices and load testing
66+
67+
- **Cost Optimization Guide** (`docs/COST_OPTIMIZATION.md`, 680 lines):
68+
- Cost monitoring and real-time tracking
69+
- Cloud provider optimization (AWS, Azure, GCP)
70+
- Reserved instances (35-60% savings)
71+
- Spot instances (60-90% savings)
72+
- Resource right-sizing strategies
73+
- Cost-effective auto-scaling configuration
74+
- Storage lifecycle policies and archival
75+
- Network cost reduction (CDN, compression, regional)
76+
- Dev/test environment optimization (70% savings)
77+
78+
- **Operational Procedures** (`docs/OPERATIONAL_PROCEDURES.md`, 550 lines):
79+
- Daily operations checklist and health checks
80+
- Incident response procedures (P1-P4 severity levels)
81+
- Deployment procedures and rollback
82+
- Monitoring and alerting response
83+
- Backup and recovery procedures
84+
- Security operations (daily, weekly, monthly)
85+
- Performance management workflows
86+
- Cost management reviews
87+
- Team communication protocols
88+
- Runbooks for common issues
89+
90+
#### Testing
91+
- 24 comprehensive tests for Phase 6 (100% passing)
92+
- Cost monitoring tests: 11 tests
93+
- Resource tracking and cost calculation
94+
- Optimization opportunity detection (underutilized, idle, oversized)
95+
- Cost report generation and forecasting
96+
- Cost breakdown and optimization application
97+
- Performance profiler tests: 11 tests
98+
- Function profiling with CPU and memory tracking
99+
- Hotspot identification and recommendations
100+
- Baseline comparison and regression detection
101+
- Performance summaries and optimization strategies
102+
- Integration tests: 2 tests
103+
- Cost and performance integration
104+
- Complete optimization workflow
105+
106+
#### Documentation Statistics
107+
- Total documentation: 2,280+ lines
108+
- Code examples: 75+ working examples
109+
- Procedures documented: 25+ operational procedures
110+
- Runbooks: 5+ troubleshooting runbooks
111+
- Performance targets defined: 8 key metrics
112+
- Cost optimization strategies: 15+ documented strategies
113+
10114
### Added - Zero-Trust Hardware Security Architecture
11115

12116
#### Security Features (5 new modules)

0 commit comments

Comments
 (0)