Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
2bccf60
fix: correct AILB flake8 config and ALB go version
PenguinzTech Dec 16, 2025
b694793
fix: resolve all linter issues - flake8 config and ALB proto setup
PenguinzTech Dec 16, 2025
85b897c
style: apply go fmt formatting to all Go files
PenguinzTech Dec 16, 2025
812282e
fix: update GitHub Actions workflows
PenguinzTech Dec 16, 2025
50a22a1
fix: refactor proxy-egress and proxy-ingress module import paths
PenguinzTech Dec 16, 2025
41de482
bugfixes and test updates
PenguinzTech Dec 16, 2025
8294a21
fix: resolve compilation errors in proxy-egress and proxy-ingress
PenguinzTech Dec 16, 2025
362b6e5
docs: comprehensive documentation reorganization and AILB features
PenguinzTech Dec 17, 2025
f3e4b46
feat: add Kong API Gateway integration with full WebUI management
PenguinzTech Dec 19, 2025
5e5d201
bugfixes, kong apilb, and more!
PenguinzTech Dec 19, 2025
8a8a46d
periodic save
PenguinzTech Jan 6, 2026
caaf889
updated markdown docs
PenguinzTech Jan 6, 2026
bcbe4f0
updated markdown docs
PenguinzTech Jan 6, 2026
20c5c5a
updated markdown docs
PenguinzTech Jan 6, 2026
f378390
fix: resolve test failures and API mismatches in proxy-egress
PenguinzTech Jan 7, 2026
b3a2772
periodic save
PenguinzTech Jan 7, 2026
f9fca7e
feat: add block rules API and E2E tests for traffic control
PenguinzTech Jan 7, 2026
024d084
security: fix 52 Dependabot vulnerabilities across all dependencies
PenguinzTech Jan 7, 2026
2650684
fix: correct lint workflow configuration issues
PenguinzTech Jan 7, 2026
876a27c
fix: make lint checks advisory (non-blocking)
PenguinzTech Jan 7, 2026
63c2e6e
refactor: implement smart linting for changed files only
PenguinzTech Jan 7, 2026
65ce08f
fix: Remove unnecessary manager dependencies from python-lint job
PenguinzTech Jan 7, 2026
6355ddf
fix: CI/CD infrastructure improvements for clean PR
PenguinzTech Jan 7, 2026
788a5a6
fix: Add system dependencies for python-saml in manager CI
PenguinzTech Jan 7, 2026
b9b9fcd
fix(ci): resolve pre-existing workflow issues for clean PR
PenguinzTech Jan 7, 2026
917fa96
fix(ci): resolve remaining workflow failures
PenguinzTech Jan 8, 2026
80a66fb
fix(ci): add libbpf-dev to security-scan jobs in proxy workflows
PenguinzTech Jan 8, 2026
b2dc0b0
fix(ci): ensure pydantic v2 is installed for API server tests
PenguinzTech Jan 8, 2026
76ad8a0
fix(ci): resolve remaining workflow and code quality issues
PenguinzTech Jan 8, 2026
816dfd0
periodic save
PenguinzTech Jan 8, 2026
7c05f4d
fix(manager): complete py4web to Quart migration with async fixes
PenguinzTech Jan 9, 2026
287e3ef
periodic save
PenguinzTech Jan 9, 2026
7d565ab
fix(k8s): resolve manager deployment issues for Kubernetes
PenguinzTech Jan 12, 2026
011d2fe
Updating documentation to new base standard
PenguinzTech Jan 12, 2026
9b96ac3
feat(webui): deploy React WebUI to Kubernetes with ingress routing
PenguinzTech Jan 12, 2026
c754cbd
feat: update default admin credentials and optimize logo assets
PenguinzTech Jan 13, 2026
c9de1e7
fix: TypeScript errors in Kong components and update Dockerfile PYTHO…
PenguinzTech Jan 13, 2026
39eebea
Updating documentation to new base standard
PenguinzTech Jan 14, 2026
7b4baef
Updating documentation to new base standard
PenguinzTech Jan 14, 2026
c0ad974
Updating documentation to new base standard
PenguinzTech Jan 14, 2026
237cbc3
Updating documentation to new base standard
PenguinzTech Jan 14, 2026
4c57f80
feat(rbac): implement comprehensive RBAC system with OAuth2-style sco…
PenguinzTech Jan 15, 2026
693e802
chore: bump version to v1.0.2 for RBAC release
PenguinzTech Jan 15, 2026
8a1cd86
fix(manager): correct Dockerfile COPY paths for build context
PenguinzTech Jan 15, 2026
595ef29
fix(manager): use python3.12 -m hypercorn instead of direct binary path
PenguinzTech Jan 15, 2026
df942f7
fix(rbac): update Pydantic Field regex to pattern for v2 compatibility
PenguinzTech Jan 15, 2026
9506657
fix(manager): improve RBAC initialization with proper transaction han…
PenguinzTech Jan 15, 2026
4648b24
feat(rbac): add RBAC tables to SQLAlchemy schema for auto-initialization
PenguinzTech Jan 15, 2026
6e3f9f8
fix(api): add /healthz/ready endpoint for Kubernetes readiness probe
PenguinzTech Jan 15, 2026
88829c5
Updating documentation to new base standard
PenguinzTech Jan 15, 2026
a6a52a8
security: fix React Router XSS vulnerability (GHSA-2w69-qvjg-hvjx)
PenguinzTech Jan 15, 2026
dfd6852
fix(tests): correct database import path in api-server conftest
PenguinzTech Jan 15, 2026
3c5f794
fix(tests): correct license key validation logic
PenguinzTech Jan 16, 2026
730d001
security: enable SSL certificate verification in httpx clients
PenguinzTech Jan 16, 2026
eb0b4a2
ci: reorganize test phases - separate CI/CD from integration tests
PenguinzTech Jan 16, 2026
f2093e4
test: implement alpha and beta smoke test infrastructure
PenguinzTech Jan 16, 2026
c16c68f
removed claude files
PenguinzTech Jan 21, 2026
12b5074
feat(media): implement media streaming expansion with AV1, SRT, and W…
PenguinzTech Jan 22, 2026
f32620a
fix: resolve linter errors in manager API files
PenguinzTech Jan 22, 2026
d6e0d1f
Updating documentation to new base standard
PenguinzTech Jan 22, 2026
550440f
Updating documentation to new base standard
PenguinzTech Jan 22, 2026
93632be
style: format manager files with black
PenguinzTech Jan 22, 2026
3e5d089
Updating documentation to new base standard
PenguinzTech Jan 22, 2026
da3c8d1
style: format manager files with black 23.12.1 for CI compatibility
PenguinzTech Jan 23, 2026
86a5b42
style: format manager with black 23.12.1 using pyproject.toml config …
PenguinzTech Jan 23, 2026
d8ffe69
Updating documentation to new base standard
PenguinzTech Feb 10, 2026
5c30d1b
fix(ci): resolve manager linting failures and CI workflow issues
PenguinzTech Feb 11, 2026
7993384
ci: add workflow_dispatch triggers to build-and-test, manager-ci, lin…
PenguinzTech Feb 11, 2026
88c0569
Merge remote-tracking branch 'origin/main' into fresh-start
PenguinzTech Feb 12, 2026
b38d642
fix(tests): correct mock patch target in test_quart_app.py
PenguinzTech Feb 12, 2026
9213443
fix(tests): update test assertions to match actual endpoint behavior
PenguinzTech Feb 12, 2026
7417a1d
Add standardized k8s deployment configuration
PenguinzTech Feb 13, 2026
484714c
Updating documentation to new base standard
PenguinzTech Feb 13, 2026
e7cc7a2
Updating documentation to new base standard
PenguinzTech Feb 13, 2026
3a25811
Remove extra k8s documentation files
PenguinzTech Feb 13, 2026
ff67e44
Fix ingress TLD: use penguintech.cloud for beta, localhost.local for …
PenguinzTech Feb 13, 2026
0222c34
Fix pre-existing CI failures across proxy-egress, proxy-ingress, and …
PenguinzTech Feb 13, 2026
c3e948b
Updating documentation to new base standard
PenguinzTech Feb 13, 2026
e5f86c2
Fix manager flake8 violations (E712 and C901)
PenguinzTech Feb 14, 2026
099bda3
fix(k8s): standardize ingress TLDs - beta=.penguintech.cloud, alpha=.…
PenguinzTech Feb 17, 2026
3ff5b57
Remove app.md template (replaced by {subject}.local.md convention)
PenguinzTech Feb 19, 2026
45bbbd1
Updating documentation to new base standard
PenguinzTech Feb 19, 2026
555836c
Updating documentation to new base standard
PenguinzTech Feb 19, 2026
c1ca8da
Updating documentation to new base standard
PenguinzTech Feb 26, 2026
b65bfa2
Updating documentation to new base standard
PenguinzTech Feb 26, 2026
4ffe5ed
Updating documentation to new base standard
PenguinzTech Mar 2, 2026
0cdff2b
Add standardized GitHub issue templates
PenguinzTech Mar 2, 2026
e7c36f5
Updating documentation to new base standard
PenguinzTech Mar 4, 2026
9792f60
Updating documentation to new base standard
PenguinzTech Mar 9, 2026
77d9b55
Updating documentation to new base standard
PenguinzTech Mar 11, 2026
d3db035
Updating documentation to new base standard
PenguinzTech Mar 11, 2026
5a507d6
security: pin trivy-action to v0.35.0 (supply chain fix)
PenguinzTech Mar 24, 2026
98bffd3
Updating documentation to new base standard
PenguinzTech Mar 25, 2026
e683c8b
chore: pin all dependencies to immutable SHA references
PenguinzTech Mar 25, 2026
3843638
chore: pin shellcheck and trufflehog to immutable SHA references
PenguinzTech Mar 25, 2026
b58e24a
Updating documentation to new base standard
PenguinzTech Mar 26, 2026
026f1de
Updating documentation to new base standard
PenguinzTech Mar 26, 2026
647ee57
periodic save
PenguinzTech Mar 28, 2026
f496e1b
feat: Replace ChromaDB memory with mem0 HTTP client (WaddleAI pgvecto…
PenguinzTech Apr 1, 2026
3b524ec
Updating documentation to new base standard
PenguinzTech Apr 1, 2026
28ce935
refactor: Complete py4web → Quart migration and restructure AILB to Go
PenguinzTech Apr 1, 2026
c99ae4d
chore: Recompile manager requirements with Quart and corrected pengui…
PenguinzTech Apr 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
60 changes: 60 additions & 0 deletions .claude/.claude/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Claude Context Files

This directory contains focused standards files for Claude Code to reference when working on specific parts of the codebase.

## 🚫 DO NOT MODIFY EXISTING FILES

**These are centralized template standards that will be overwritten when updated.**

Files you must **NEVER modify**:
- `go.md`, `python.md`, `react.md` (language standards)
- `flask-backend.md`, `go-backend.md`, `webui.md` (service standards)
- `database.md`, `security.md`, `testing.md`, `containers.md`, `kubernetes.md` (domain standards)
- `README.md` (this file)

**Instead, CREATE NEW FILES for app-specific context:**
- `.claude/app.md` - App-specific rules and context
- `.claude/[feature].md` - Feature-specific context (e.g., `billing.md`, `notifications.md`)
- `docs/APP_STANDARDS.md` - Human-readable app-specific documentation

---

## ⚠️ CRITICAL RULES

Every file in this directory starts with a "CRITICAL RULES" section. Claude should read and follow these rules strictly.

## File Index

### Language Standards
| File | When to Read |
|------|--------------|
| `go.md` | Working on Go code (*.go files) |
| `python.md` | Working on Python code (*.py files) |
| `react.md` | Working on React/frontend code (*.jsx, *.tsx files) |

### Service Standards
| File | When to Read |
|------|--------------|
| `flask-backend.md` | Working on Flask backend service |
| `go-backend.md` | Working on Go backend service |
| `webui.md` | Working on WebUI/React service |

### Domain Standards
| File | When to Read |
|------|--------------|
| `database.md` | Any database operations (PyDAL, SQLAlchemy, GORM) |
| `security.md` | Authentication, authorization, security scanning |
| `testing.md` | Running tests, beta infrastructure, smoke tests |
| `containers.md` | Docker images, Dockerfiles, container configuration |
| `kubernetes.md` | K8s deployments, Helm v3 charts, Kustomize overlays |

## Usage

Claude should:
1. Read the main `CLAUDE.md` for project overview and critical rules
2. Read relevant `.claude/*.md` files based on the task at hand
3. Follow the CRITICAL RULES sections strictly - these are non-negotiable

## File Size Limit

All files in this directory should be under 5000 characters to ensure Claude can process them effectively.
File renamed without changes.
114 changes: 114 additions & 0 deletions .claude/.claude/containers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Container Image Standards

## ⚠️ CRITICAL RULES

1. **Debian 12 (bookworm) ONLY** - all container images must use Debian-based images
2. **NEVER use Alpine** - causes glibc/musl compatibility issues, missing packages, debugging difficulties
3. **Use `-slim` variants** when available for smaller image sizes
4. **PostgreSQL 16.x** standard for all database containers
5. **Multi-arch builds required** - support both amd64 and arm64

---

## Base Image Selection

### Priority Order (MUST follow)

1. **Debian 12 (bookworm)** - PRIMARY, always use if available
2. **Debian 11 (bullseye)** - fallback if bookworm unavailable
3. **Debian 13 (trixie)** - fallback for newer packages
4. **Ubuntu LTS** - ONLY if no Debian option exists
5. ❌ **NEVER Alpine** - forbidden, causes too many issues

---

## Standard Images

| Service | Image | Notes |
|---------|-------|-------|
| PostgreSQL | `postgres:16-bookworm` | Primary database |
| MySQL | `mysql:8.0-debian` | Alternative database |
| Redis | `redis:7-bookworm` | Cache/session store |
| Python | `python:3.13-slim-bookworm` | Flask backend |
| Node.js | `node:18-bookworm-slim` | WebUI build |
| Nginx | `nginx:stable-bookworm-slim` | Reverse proxy |
| Go | `golang:1.24-bookworm` | Build stage only |
| Runtime | `debian:bookworm-slim` | Go runtime stage |

---

## Dockerfile Patterns

### Python Service
```dockerfile
FROM python:3.13-slim-bookworm AS builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .

FROM python:3.13-slim-bookworm
WORKDIR /app
COPY --from=builder /app /app
CMD ["gunicorn", "-b", "0.0.0.0:8080", "app:app"]
```

### Go Service
```dockerfile
FROM golang:1.24-bookworm AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /app/server

FROM debian:bookworm-slim
COPY --from=builder /app/server /server
CMD ["/server"]
```

### Node.js/React Service
```dockerfile
FROM node:18-bookworm-slim AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM nginx:stable-bookworm-slim
COPY --from=builder /app/dist /usr/share/nginx/html
```

---

## Why Not Alpine?

❌ **glibc vs musl** - Many Python packages require glibc, Alpine uses musl
❌ **Missing packages** - Common tools often unavailable or different versions
❌ **Debugging harder** - No bash by default, limited tooling
❌ **DNS issues** - Known DNS resolution problems in some scenarios
❌ **Build failures** - C extensions often fail to compile

✅ **Debian-slim** - Only ~30MB larger than Alpine but zero compatibility issues

---

## Docker Compose Example

```yaml
services:
postgres:
image: postgres:16-bookworm

redis:
image: redis:7-bookworm

api:
build:
context: ./services/flask-backend
# Uses python:3.13-slim-bookworm internally

web:
image: nginx:stable-bookworm-slim
```
206 changes: 206 additions & 0 deletions .claude/.claude/database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
# Database Standards Quick Reference

## ⚠️ CRITICAL RULES

1. **PyDAL MANDATORY for ALL runtime operations** - no exceptions
2. **SQLAlchemy + Alembic for schema/migrations only** - never for runtime queries
3. **Support ALL databases by default**: PostgreSQL, MySQL, MariaDB Galera, SQLite
4. **DB_TYPE environment variable required** - maps to connection string prefix
5. **Connection pooling REQUIRED** - use PyDAL built-in pool_size configuration
6. **Thread-safe connections MANDATORY** - thread-local storage for multi-threaded apps
7. **Retry logic with exponential backoff** - handle database initialization delays
8. **MariaDB Galera special handling** - WSREP checks, short transactions, charset utf8mb4

---

## Database Support Matrix

| Database | DB_TYPE | Version | Default Port | Use Case |
|----------|---------|---------|--------------|----------|
| PostgreSQL | `postgresql` | **16.x** | 5432 | Production (primary) |
| MySQL | `mysql` | 8.0+ | 3306 | Production alternative |
| MariaDB Galera | `mysql` | 10.11+ | 3306 | HA clusters (special config) |
| SQLite | `sqlite` | 3.x | N/A | Development/lightweight |

---

## Dual-Library Architecture (Python)

### SQLAlchemy + Alembic
- **Purpose**: Schema definition and version-controlled migrations ONLY
- **When**: Application first-time setup
- **What**: Define tables, columns, relationships
- **Not for**: Runtime queries, data operations

### PyDAL
- **Purpose**: ALL runtime database operations
- **When**: Every request, transaction, query
- **What**: Queries, inserts, updates, deletes, transactions
- **Built-in**: Connection pooling, thread safety, retry logic

---

## Environment Variables

```bash
DB_TYPE=postgresql # Database type
DB_HOST=localhost # Database host
DB_PORT=5432 # Database port
DB_NAME=app_db # Database name
DB_USER=app_user # Database username
DB_PASS=app_pass # Database password
DB_POOL_SIZE=10 # Connection pool size (default: 10)
DB_MAX_RETRIES=5 # Maximum connection retries (default: 5)
DB_RETRY_DELAY=5 # Retry delay in seconds (default: 5)
```

---

## PyDAL Connection Pattern

```python
from pydal import DAL

def get_db():
db_type = os.getenv('DB_TYPE', 'postgresql')
db_uri = f"{db_type}://{DB_USER}:{DB_PASS}@{DB_HOST}:{DB_PORT}/{DB_NAME}"

db = DAL(
db_uri,
pool_size=int(os.getenv('DB_POOL_SIZE', '10')),
migrate=True,
check_reserved=['all'],
lazy_tables=True
)
return db
```

---

## Thread-Safe Usage Pattern

**NEVER share DAL instance across threads. Use thread-local storage:**

```python
import threading

thread_local = threading.local()

def get_thread_db():
if not hasattr(thread_local, 'db'):
thread_local.db = DAL(db_uri, pool_size=10, migrate=False)
return thread_local.db
```

**Flask pattern (automatic via g context):**

```python
from flask import g

def get_db():
if 'db' not in g:
g.db = DAL(db_uri, pool_size=10)
return g.db

@app.teardown_appcontext
def close_db(error):
db = g.pop('db', None)
if db: db.close()
```

---

## MariaDB Galera Special Requirements

1. **Connection String**: Use `mysql://` (same as MySQL)
2. **Driver Args**: Set charset to utf8mb4
3. **WSREP Checks**: Verify `wsrep_ready` before critical writes
4. **Auto-Increment**: Configure `innodb_autoinc_lock_mode=2` for interleaved mode
5. **Transactions**: Keep short to avoid certification conflicts
6. **DDL Operations**: Plan during low-traffic periods (uses Total Order Isolation)

```python
# Galera-specific configuration
db = DAL(
f"mysql://{DB_USER}:{DB_PASS}@{DB_HOST}:{DB_PORT}/{DB_NAME}",
pool_size=10,
driver_args={'charset': 'utf8mb4'}
)
```

---

## Connection Pooling & Retry Logic

```python
import time

def wait_for_database(max_retries=5, retry_delay=5):
"""Wait for DB with retry logic"""
for attempt in range(max_retries):
try:
db = get_db()
db.close()
return True
except Exception as e:
print(f"Attempt {attempt+1}/{max_retries} failed: {e}")
if attempt < max_retries - 1:
time.sleep(retry_delay)
return False

# Application startup
if not wait_for_database():
sys.exit(1)
db = get_db()
```

---

## Concurrency Selection

| Workload | Approach | Libraries | Pool Size Formula |
|----------|----------|-----------|-------------------|
| I/O-bound (>100 concurrent) | Async | `asyncio`, `databases` | pool = concurrent / 2 |
| CPU-bound | Multi-processing | `multiprocessing` | pool = CPU cores |
| Mixed/Blocking I/O | Multi-threading | `threading`, `ThreadPoolExecutor` | pool = (2 × cores) + spindles |

---

## Go Database Requirements

When using Go for high-performance apps:
- **GORM** (preferred): Full ORM with PostgreSQL/MySQL support
- **sqlx** (alternative): Lightweight, more control
- Must support PostgreSQL, MySQL, SQLite
- Active maintenance required

```go
import (
"gorm.io/driver/postgres"
"gorm.io/driver/mysql"
"gorm.io/gorm"
)

func initDB() (*gorm.DB, error) {
dbType := os.Getenv("DB_TYPE")
dsn := os.Getenv("DATABASE_URL")

var dialector gorm.Dialector
switch dbType {
case "mysql":
dialector = mysql.Open(dsn)
default:
dialector = postgres.Open(dsn)
}

return gorm.Open(dialector, &gorm.Config{})
}
```

---

## See Also

- `/home/penguin/code/project-template/docs/standards/DATABASE.md` - Full documentation
- Alembic migrations: https://alembic.sqlalchemy.org/
- PyDAL docs: https://py4web.io/en_US/chapter-12.html
Loading