Skip to content

Commit 3747af3

Browse files
authored
Adding docs (#5)
* adding docs * updated readme
1 parent 4fe49d6 commit 3747af3

File tree

8 files changed

+602
-54
lines changed

8 files changed

+602
-54
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 ]
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/

README.md

Lines changed: 17 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ things safe and efficient. You'll get the results back in no time.
5454
- Backend: `https://127.0.0.1:443/`
5555
- To check if it works, you can use `curl -k https://127.0.0.1/api/v1/k8s-limits`, should return JSON with current limits
5656
- Grafana: `http://127.0.0.1:3000` (login - `admin`, pw - `admin123`)
57-
57+
5858

5959
You may also find out that k8s doesn't capture metrics (`CPU` and `Memory` params are `null`), it may well be that metrics server
6060
for k8s is turned off/not enabled. To enable, execute:
@@ -63,9 +63,9 @@ kubectl create -f https://raw.githubusercontent.com/pythianarora/total-practice/
6363
```
6464

6565
and test output by writing `kubectl top node` in console, should output sth like:
66-
```
67-
PS C:\Users\User\Desktop\Integr8sCode> kubectl top node
68-
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
66+
```
67+
PS C:\Users\User\Desktop\Integr8sCode> kubectl top node
68+
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
6969
docker-desktop 267m 3% 4732Mi 29%
7070
```
7171

@@ -77,7 +77,7 @@ docker-desktop 267m 3% 4732Mi 29%
7777
You can check correctness of start by running a sample test script:
7878
1. Open website at `https://127.0.0.1:5001/`, go to Editor
7979
2. In code window, paste following code:
80-
```python
80+
```python
8181
from typing import TypeGuard
8282

8383
def is_string(value: object) -> TypeGuard[str]:
@@ -97,8 +97,8 @@ example_function("hello")
9797
example_function([1, 2, 3])
9898
```
9999

100-
First, select `>= Python 3.10` and run script, will output:
101-
```
100+
First, select `>= Python 3.10` and run script, will output:
101+
```
102102
Status: completed
103103
Execution ID: <some hex number>
104104
Output:
@@ -107,8 +107,8 @@ Output:
107107
Something else
108108
```
109109

110-
Then, select `< Python 3.10` and do the same:
111-
```
110+
Then, select `< Python 3.10` and do the same:
111+
```
112112
Status: completed
113113
Execution ID: <some other hex number>
114114
Output:
@@ -117,51 +117,25 @@ Output:
117117
^
118118
SyntaxError: invalid syntax
119119
```
120-
This shows that pods with specified python versions are creating and working as expected. Btw, the latter throws error
120+
This shows that pods with specified python versions are creating and working as expected. Btw, the latter throws error
121121
cause `match-case` was introduced first in `Python 3.10`.
122122

123123
</details>
124124

125125

126126
## Architecture Overview
127127

128-
> [!WARNING]
129-
> Detailed, up-to-date architecture diagrams are in [this file](files_for_readme/ARCHITECTURE_IN_DETAILS.md).
128+
> [!TIP]
129+
> Full documentation is available at https://hardmax71.github.io/Integr8sCode/
130130
131131
<img src="./files_for_readme/system_diagram.png" alt="system diagram">
132132

133133
The platform is built on three main pillars:
134134

135-
- **Frontend**: A sleek Svelte app that users interact with.
136-
- **Backend**: Powered by FastAPI, Python, and MongoDB to handle all the heavy lifting.
137-
- **Kubernetes Cluster**: Each script runs in its own pod, ensuring isolation and resource control.
138-
139-
## Kubernetes Integration
140-
141-
### Pod Setup
142-
143-
- **Docker Image**:Lightweight Python image with just what we need is used.
144-
- **Isolation**: Every script gets its own pod for security and reliability.
145-
- **Cleanup**: Once your script is done, the pod goes away to keep things tidy.
146-
147-
### Resource Management
148-
149-
> [!TIP]
150-
> By limiting resources, we ensure fair usage and prevent any single script from hogging the system.
151-
152-
- **CPU & Memory Limits**: Each pod has caps to prevent overuse (128 Mi for RAM and 1000m for CPU).
153-
- **Timeouts**: Scripts can't run forever—they'll stop after a set time (default: 5s).
154-
- **Disk Space**: Limited to prevent excessive storage use.
155-
156-
> You can find actual limits in dropdown above execution output.
157-
158-
### Security Considerations
159-
160-
> [!CAUTION]
161-
> Running user-provided code is risky. We take security seriously to protect both our system and other users.
162-
163-
- **Network Restrictions**: Pods can't make external network calls.
164-
- **No Privileged Access**: Pods run without elevated permissions.
135+
- Frontend: A sleek Svelte app that users interact with.
136+
- Backend: Powered by FastAPI, Python, and MongoDB to handle all the heavy lifting.
137+
- Kubernetes Cluster: Each script runs in its own pod, ensuring isolation and resource control.
165138

166-
139+
## License
167140

141+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)