Skip to content

Commit 5138c68

Browse files
committed
adding docs
1 parent 4fe49d6 commit 5138c68

File tree

7 files changed

+582
-3
lines changed

7 files changed

+582
-3
lines changed

.github/workflows/docs.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches: [ main , adding-docs ]
6+
paths:
7+
- 'docs/**'
8+
- 'backend/docs/**'
9+
- 'files_for_readme/ARCHITECTURE_IN_DETAILS.md'
10+
- 'backend/tests/load/README.md'
11+
- 'mkdocs.yml'
12+
- '.github/workflows/docs.yml'
13+
pull_request:
14+
branches:
15+
- main
16+
paths:
17+
- 'docs/**'
18+
- 'backend/docs/**'
19+
- 'files_for_readme/ARCHITECTURE_IN_DETAILS.md'
20+
- 'backend/tests/load/README.md'
21+
- 'mkdocs.yml'
22+
- '.github/workflows/docs.yml'
23+
workflow_dispatch: # Allow manual trigger
24+
25+
permissions:
26+
contents: write
27+
pages: write
28+
id-token: write
29+
30+
# Allow only one concurrent deployment
31+
concurrency:
32+
group: pages
33+
cancel-in-progress: false
34+
35+
jobs:
36+
build:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0 # Full history for git info
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: '3.12'
48+
49+
- name: Cache pip dependencies
50+
uses: actions/cache@v4
51+
with:
52+
key: mkdocs-${{ hashFiles('mkdocs.yml') }}
53+
path: ~/.cache/pip
54+
restore-keys: |
55+
mkdocs-
56+
57+
- name: Install MkDocs and dependencies
58+
run: |
59+
pip install --upgrade pip
60+
pip install \
61+
mkdocs-material \
62+
mkdocs-mermaid2-plugin \
63+
pymdown-extensions
64+
65+
- name: Prepare documentation structure
66+
run: |
67+
# Create directory structure for docs
68+
mkdir -p docs/architecture
69+
mkdir -p docs/reference
70+
mkdir -p docs/components/sse
71+
mkdir -p docs/components/workers
72+
mkdir -p docs/operations
73+
mkdir -p docs/security
74+
mkdir -p docs/testing
75+
mkdir -p docs/stylesheets
76+
mkdir -p docs/assets/images
77+
78+
# Copy images and assets
79+
cp files_for_readme/*.png docs/architecture/
80+
cp files_for_readme/*.svg docs/architecture/ 2>/dev/null || true
81+
cp files_for_readme/logo.png docs/assets/images/
82+
83+
# Copy architecture docs
84+
cp files_for_readme/ARCHITECTURE_IN_DETAILS.md docs/architecture/overview.md
85+
cp backend/docs/services-overview.md docs/architecture/
86+
cp backend/docs/kafka-topic-architecture.md docs/architecture/
87+
cp backend/docs/lifecycle.md docs/architecture/
88+
89+
# Copy API reference
90+
cp backend/docs/api-reference.md docs/reference/
91+
92+
# Copy component docs - services overview
93+
cp backend/docs/services-overview.md docs/components/
94+
95+
# Copy SSE docs
96+
cp backend/docs/sse-partitioned-architecture.md docs/components/sse/
97+
cp backend/docs/execution-sse-flow.md docs/components/sse/
98+
cp backend/docs/workers/sse-architecture.md docs/components/sse/
99+
100+
# Copy worker docs
101+
cp backend/docs/workers/pod_monitor.md docs/components/workers/
102+
cp backend/docs/workers/result_processor.md docs/components/workers/
103+
104+
# Copy other component docs
105+
cp backend/docs/dead-letter-queue.md docs/components/
106+
cp backend/docs/schema-manager.md docs/components/
107+
108+
# Copy operations docs
109+
cp backend/docs/tracing.md docs/operations/
110+
cp backend/docs/metrics-contextvars.md docs/operations/
111+
cp backend/docs/cpu-time-measurement.md docs/operations/
112+
cp backend/docs/notification-types.md docs/operations/
113+
cp backend/docs/troubleshooting-result-processor-di-crash.md docs/operations/
114+
115+
# Copy security docs
116+
cp backend/docs/security/policies.md docs/security/
117+
118+
# Copy testing docs
119+
cp backend/tests/load/README.md docs/testing/load-testing.md
120+
121+
# Create minimal extra.css if not exists
122+
if [ ! -f docs/stylesheets/extra.css ]; then
123+
echo "/* Custom styles for Integr8sCode docs */" > docs/stylesheets/extra.css
124+
fi
125+
126+
- name: Build documentation
127+
run: mkdocs build --strict
128+
129+
- name: Upload artifact
130+
uses: actions/upload-pages-artifact@v3
131+
with:
132+
path: site/
133+
134+
deploy:
135+
# Only deploy on push to main (not PRs)
136+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
137+
needs: build
138+
runs-on: ubuntu-latest
139+
environment:
140+
name: github-pages
141+
url: ${{ steps.deployment.outputs.page_url }}
142+
steps:
143+
- name: Deploy to GitHub Pages
144+
id: deployment
145+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# MkDocs documentation build output
2+
site/
3+
4+
# Python
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
*.so
9+
.Python
10+
build/
11+
develop-eggs/
12+
dist/
13+
downloads/
14+
eggs/
15+
.eggs/
16+
lib/
17+
lib64/
18+
parts/
19+
sdist/
20+
var/
21+
wheels/
22+
*.egg-info/
23+
.installed.cfg
24+
*.egg
25+
26+
# Virtual environments
27+
venv/
28+
ENV/
29+
env/
30+
.venv/
31+
32+
# IDE
33+
.idea/
34+
.vscode/
35+
*.swp
36+
*.swo
37+
*~
38+
.project
39+
.pydevproject
40+
.settings/
41+
42+
# Testing
43+
.coverage
44+
.pytest_cache/
45+
htmlcov/
46+
.tox/
47+
.nox/
48+
coverage.xml
49+
*.cover
50+
.hypothesis/
51+
52+
# Linting/Type checking
53+
.mypy_cache/
54+
.ruff_cache/
55+
.dmypy.json
56+
dmypy.json
57+
58+
# Jupyter
59+
.ipynb_checkpoints/
60+
61+
# Environment files
62+
.env
63+
.env.local
64+
.env.*.local
65+
*.local.env
66+
67+
# Certificates (generated locally)
68+
certs/
69+
*.pem
70+
*.key
71+
*.crt
72+
*.csr
73+
74+
# Kubernetes
75+
kubeconfig.yaml
76+
kubeconfig.yml
77+
78+
# Docker
79+
*.log
80+
81+
# OS files
82+
.DS_Store
83+
Thumbs.db
84+
85+
# Node (frontend)
86+
node_modules/
87+
npm-debug.log*
88+
yarn-debug.log*
89+
yarn-error.log*
90+
91+
# Build outputs
92+
frontend/public/build/

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Integr8sCode
2+
3+
**Run Python scripts online in isolated Kubernetes pods with resource limits and real-time feedback.**
4+
5+
Integr8sCode is a platform where you can run Python scripts online with ease. Just paste your script, and the platform runs it in an isolated environment within its own Kubernetes pod, complete with resource limits to keep things safe and efficient. You'll get the results back in no time.
6+
7+
## Quick Start
8+
9+
### Deployment
10+
11+
1. Clone the repository
12+
2. Ensure Docker is enabled, Kubernetes is running, and kubectl is installed
13+
3. Run `docker-compose up --build`
14+
15+
**Access points:**
16+
17+
| Service | URL |
18+
|---------|-----|
19+
| Frontend | `https://127.0.0.1:5001/` |
20+
| Backend API | `https://127.0.0.1:443/` |
21+
| Grafana | `http://127.0.0.1:3000` (admin/admin123) |
22+
23+
### Verify Installation
24+
25+
Check if the backend is running:
26+
27+
```bash
28+
curl -k https://127.0.0.1/api/v1/k8s-limits
29+
```
30+
31+
This should return JSON with current resource limits.
32+
33+
### Enable Kubernetes Metrics
34+
35+
If CPU and Memory metrics show as `null`, enable the metrics server:
36+
37+
```bash
38+
kubectl create -f https://raw.githubusercontent.com/pythianarora/total-practice/master/sample-kubernetes-code/metrics-server.yaml
39+
```
40+
41+
Verify with:
42+
43+
```bash
44+
kubectl top node
45+
```
46+
47+
## Core Features
48+
49+
- **Isolated Execution**: Every script runs in its own Kubernetes pod
50+
- **Resource Limits**: CPU (1000m), Memory (128Mi), configurable timeouts
51+
- **Multi-version Python**: Support for Python 3.10+ and earlier versions
52+
- **Real-time Updates**: Server-Sent Events for live execution status
53+
- **Event Sourcing**: Complete audit trail via Kafka event streams
54+
- **Dead Letter Queue**: Automatic retry and recovery for failed events
55+
56+
## Architecture Overview
57+
58+
The platform is built on three main pillars:
59+
60+
- **Frontend**: Svelte application for user interaction
61+
- **Backend**: FastAPI with MongoDB, Kafka, and Redis
62+
- **Kubernetes**: Isolated pod execution with Cilium network policies
63+
64+
```
65+
User → Frontend → API → Coordinator → Saga → K8s Worker → Pod
66+
67+
Pod Monitor → Result Processor → SSE → User
68+
```
69+
70+
For detailed architecture diagrams, see the [Architecture](architecture/overview.md) section.
71+
72+
## Security
73+
74+
- **Network Isolation**: Pods cannot make external network calls (Cilium deny-all policy)
75+
- **No Privileged Access**: Pods run as non-root with dropped capabilities
76+
- **Read-only Filesystem**: Containers use read-only root filesystem
77+
- **No Service Account**: Pods have no access to Kubernetes API
78+
79+
## Documentation Sections
80+
81+
<div class="grid cards" markdown>
82+
83+
- :material-architecture-outline: **[Architecture](architecture/overview.md)**
84+
85+
---
86+
87+
System design, service interactions, and event flows
88+
89+
- :material-api: **[API Reference](reference/api-reference.md)**
90+
91+
---
92+
93+
Complete REST and SSE endpoint documentation
94+
95+
- :material-cog: **[Components](components/services-overview.md)**
96+
97+
---
98+
99+
SSE, Workers, DLQ, and Schema management
100+
101+
- :material-wrench: **[Operations](operations/tracing.md)**
102+
103+
---
104+
105+
Tracing, metrics, monitoring, and troubleshooting
106+
107+
</div>
108+
109+
## Sample Test
110+
111+
Verify your installation by running this Python 3.10+ code:
112+
113+
```python
114+
from typing import TypeGuard
115+
116+
def is_string(value: object) -> TypeGuard[str]:
117+
return isinstance(value, str)
118+
119+
def example_function(data: object):
120+
match data:
121+
case int() if data > 10:
122+
print("An integer greater than 10")
123+
case str() if is_string(data):
124+
print(f"A string: {data}")
125+
case _:
126+
print("Something else")
127+
128+
example_function(15)
129+
example_function("hello")
130+
example_function([1, 2, 3])
131+
```
132+
133+
Expected output:
134+
135+
```
136+
An integer greater than 10
137+
A string: hello
138+
Something else
139+
```
140+
141+
## Links
142+
143+
- [GitHub Repository](https://github.com/HardMax71/Integr8sCode)
144+
- [Live Demo](https://app.integr8scode.cc/)

0 commit comments

Comments
 (0)