Skip to content

Commit adb9525

Browse files
committed
chore: prepare initial open-source release
0 parents  commit adb9525

451 files changed

Lines changed: 45894 additions & 0 deletions

File tree

Some content is hidden

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

‎.dockerignore‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.git
2+
.github
3+
.gitignore
4+
.gitattributes
5+
.idea
6+
.vscode
7+
.trae
8+
.venv
9+
__pycache__
10+
*.pyc
11+
*.pyo
12+
.run-logs
13+
*.log
14+
*.sqlite3
15+
*.db
16+
*.key
17+
*.pem
18+
*.pfx
19+
**/password.txt
20+
.env
21+
.env.*
22+
!.env.docker.example
23+
!backend/.env.template
24+
frontend/node_modules
25+
frontend/dist
26+
frontend/dist-ssr
27+
backend/log
28+
backend/temp_files
29+
temp_files
30+
embedding/web_data_embeddings
31+
backend/static/*
32+
!backend/static/default
33+
!backend/static/default/**

‎.env.docker.example‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
ENVIRONMENT=dev
2+
TZ=Asia/Shanghai
3+
4+
MYSQL_USER=root
5+
MYSQL_PASSWORD=replace-with-a-strong-mysql-password
6+
MYSQL_DATABASE=onlineunigraph
7+
MYSQL_EXPOSE_PORT=3306
8+
9+
REDIS_PASSWORD=replace-with-a-strong-redis-password
10+
REDIS_DATABASE=0
11+
REDIS_EXPOSE_PORT=6379
12+
13+
BACKEND_PORT=8000
14+
FRONTEND_PORT=8080
15+
16+
TOKEN_SECRET_KEY=replace-with-a-random-token-secret
17+
OPERA_LOG_ENCRYPT_SECRET_KEY=replace-with-a-random-opera-log-secret
18+
JXNU_AES_SECRET_KEY=
19+
20+
OAUTH2_GITHUB_CLIENT_ID=test
21+
OAUTH2_GITHUB_CLIENT_SECRET=test
22+
OAUTH2_LINUX_DO_CLIENT_ID=test
23+
OAUTH2_LINUX_DO_CLIENT_SECRET=test
24+
25+
CELERY_BROKER_REDIS_DATABASE=1
26+
CELERY_BACKEND_REDIS_DATABASE=2
27+
28+
EMBEDDING_MODEL=text-embedding-3-small
29+
OPENAI_API_KEY=replace-with-your-embedding-api-key
30+
31+
SSO_USER_INFO_URL=http://backend:8000/knowg/v1/sys/users/me
32+
INDEX_EXPORT_URL_ROOT=http://backend:8000/knowg/v1/knowledge/ask
33+
CORS_ALLOWED_ORIGINS=["http://localhost:8080"]
34+
35+
FRONTEND_VITE_HOST_URL=
36+
FRONTEND_VITE_API_BASE_URL=/knowg
37+
FRONTEND_VITE_SHOW_IMAGE_API=/knowg/v1/image/
38+
FRONTEND_VITE_USER_INFO_SSO_URL=/knowg/v1/sys/users/me

‎.gitattributes‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
* text=auto
2+
3+
*.py text eol=lf
4+
*.js text eol=lf
5+
*.ts text eol=lf
6+
*.vue text eol=lf
7+
*.css text eol=lf
8+
*.html text eol=lf
9+
*.json text eol=lf
10+
*.md text eol=lf
11+
*.txt text eol=lf
12+
*.toml text eol=lf
13+
*.conf text eol=lf
14+
*.sql text eol=lf
15+
*.sh text eol=lf
16+
*.yml text eol=lf
17+
*.yaml text eol=lf
18+
Dockerfile* text eol=lf
19+
.dockerignore text eol=lf
20+
.gitattributes text eol=lf
21+
.gitignore text eol=lf
22+
23+
*.cmd text eol=crlf
24+
*.ps1 text eol=crlf
25+
26+
*.ico binary
27+
*.jpg binary
28+
*.jpeg binary
29+
*.png binary
30+
*.svg text eol=lf
31+
*.ttf binary
32+
*.woff binary
33+
*.woff2 binary

‎.github/dependabot.yml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: /backend
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
9+
- package-ecosystem: npm
10+
directory: /frontend
11+
schedule:
12+
interval: weekly
13+
open-pull-requests-limit: 5
14+
15+
- package-ecosystem: github-actions
16+
directory: /
17+
schedule:
18+
interval: weekly
19+
open-pull-requests-limit: 5

‎.github/workflows/ci.yml‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
backend:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
- name: Install backend quality tools
20+
run: python -m pip install ruff==0.15.20 -r backend/requirements.txt
21+
- name: Check Python formatting and lint
22+
working-directory: backend
23+
run: |
24+
ruff format --check .
25+
ruff check .
26+
- name: Run security regression tests
27+
run: |
28+
python -m unittest discover -s backend/tests -v
29+
python backend/tests/smoke_import.py
30+
- name: Audit locked backend dependencies
31+
run: |
32+
python -m pip install pip-audit
33+
pip-audit --requirement backend/requirements.txt --no-deps --disable-pip
34+
35+
frontend:
36+
runs-on: ubuntu-latest
37+
defaults:
38+
run:
39+
working-directory: frontend
40+
steps:
41+
- uses: actions/checkout@v4
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version: "20"
45+
cache: npm
46+
cache-dependency-path: frontend/package-lock.json
47+
- run: npm ci
48+
- run: npm run typecheck
49+
- run: npm run build
50+
- run: npm audit --audit-level=high
51+
52+
compose:
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v4
56+
- name: Validate Compose configuration
57+
run: docker compose --env-file .env.docker.example config --quiet

‎.gitignore‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.DS_Store
2+
Thumbs.db
3+
4+
.idea/
5+
.vscode/
6+
.trae/
7+
.codex-release-git/
8+
9+
.venv/
10+
venv/
11+
__pycache__/
12+
*.py[cod]
13+
*.pyo
14+
15+
.run-logs/
16+
.pytest_cache/
17+
.ruff_cache/
18+
.mypy_cache/
19+
.coverage
20+
htmlcov/
21+
*.log
22+
23+
frontend/node_modules/
24+
frontend/dist/
25+
frontend/dist-ssr/
26+
frontend/.vite/
27+
28+
backend/log/*
29+
backend/temp_files/*
30+
!backend/temp_files/.gitkeep
31+
temp_files/*
32+
!temp_files/.gitkeep
33+
backend/static/*
34+
!backend/static/.gitkeep
35+
!backend/static/default/
36+
!backend/static/default/**
37+
embedding/web_data_embeddings/*
38+
!embedding/web_data_embeddings/.gitkeep
39+
backend/embedding/web_data_embeddings/
40+
backend/common/core_layer/unigraph/web_search/web_data_embeddings/
41+
backend/ip2region.xdb
42+
*.sqlite3
43+
*.db
44+
45+
# Never commit private keys or bundled certificate archives.
46+
*.key
47+
*.pem
48+
*.pfx
49+
**/password.txt
50+
51+
.env.docker
52+
.env
53+
.env.*
54+
!.env.template
55+
!.env.docker.example
56+
backend/.env
57+
backend/.env.*
58+
!backend/.env.template
59+
*.local

‎.python-version‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

‎CONTRIBUTING.md‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contributing
2+
3+
Thanks for improving UniGraph.
4+
5+
## Development workflow
6+
7+
1. Fork the repository and create a focused branch.
8+
2. Keep changes small and explain the problem they solve.
9+
3. Never commit `.env` files, credentials, logs, database files, generated
10+
assets, or user data.
11+
4. Run the checks below before opening a pull request.
12+
13+
```bash
14+
ruff format --check backend
15+
ruff check backend
16+
python -m unittest discover -s backend/tests -v
17+
python backend/tests/smoke_import.py
18+
pip-audit --requirement backend/requirements.txt --no-deps --disable-pip
19+
cd frontend
20+
npm ci
21+
npm run lint
22+
npm run typecheck
23+
npm run build
24+
npm audit --audit-level=high
25+
```
26+
27+
For backend changes, add focused tests when a test seam exists. Avoid broad
28+
format-only changes in the same pull request as functional work.
29+
30+
## Pull requests
31+
32+
Describe the behavior before and after the change, how it was verified, and
33+
any migration or configuration impact. Link the relevant issue when one
34+
exists.

‎Dockerfile.backend‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM python:3.11-slim
2+
3+
ENV PYTHONDONTWRITEBYTECODE=1 \
4+
PYTHONUNBUFFERED=1 \
5+
PYTHONPATH=/app
6+
7+
WORKDIR /app
8+
9+
RUN apt-get update && \
10+
apt-get install -y --no-install-recommends gcc python3-dev && \
11+
rm -rf /var/lib/apt/lists/*
12+
13+
COPY backend/requirements.txt /tmp/requirements.txt
14+
RUN pip install --no-cache-dir -r /tmp/requirements.txt
15+
16+
COPY backend /app/backend
17+
18+
EXPOSE 8000
19+
20+
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]

‎Dockerfile.celery‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3.11-slim
2+
3+
ENV PYTHONDONTWRITEBYTECODE=1 \
4+
PYTHONUNBUFFERED=1 \
5+
PYTHONPATH=/app
6+
7+
WORKDIR /app
8+
9+
RUN apt-get update && \
10+
apt-get install -y --no-install-recommends gcc python3-dev && \
11+
rm -rf /var/lib/apt/lists/*
12+
13+
COPY backend/requirements.txt /tmp/requirements.txt
14+
RUN pip install --no-cache-dir -r /tmp/requirements.txt
15+
16+
COPY backend /app/backend
17+
18+
CMD ["celery", "-A", "backend.app.task.celery:celery_app", "worker", "--loglevel=info"]

0 commit comments

Comments
 (0)