Skip to content

Commit 6c2b729

Browse files
committed
feat: initial commit with production configuration
0 parents  commit 6c2b729

579 files changed

Lines changed: 118804 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.

.env.example

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# LegalOS 4.0 - Environment Variables Template
2+
# Copy this file to .env and update the values for your deployment
3+
4+
# ==========================================
5+
# Application Configuration
6+
# ==========================================
7+
ENVIRONMENT=production
8+
LOG_LEVEL=INFO
9+
DEBUG=false
10+
11+
# ==========================================
12+
# Security Configuration
13+
# ==========================================
14+
# IMPORTANT: Change these in production!
15+
JWT_SECRET_KEY=your-super-secret-jwt-key-change-this-in-production-minimum-32-characters
16+
DB_PASSWORD=your-secure-database-password
17+
18+
# ==========================================
19+
# CORS Configuration
20+
# ==========================================
21+
# Comma-separated list of allowed origins
22+
CORS_ORIGINS=http://localhost:3000,http://localhost:80,https://yourdomain.com
23+
24+
# ==========================================
25+
# Database Configuration
26+
# ==========================================
27+
DATABASE_URL=postgresql://postgres:${DB_PASSWORD}@db:5432/legalos
28+
POSTGRES_USER=postgres
29+
POSTGRES_DB=legalos
30+
31+
# ==========================================
32+
# Redis Configuration
33+
# ==========================================
34+
REDIS_URL=redis://redis:6379
35+
REDIS_PASSWORD=
36+
37+
# ==========================================
38+
# AI/ML Configuration
39+
# ==========================================
40+
# Add your API keys for AI services
41+
OPENAI_API_KEY=
42+
ANTHROPIC_API_KEY=
43+
GOOGLE_AI_API_KEY=
44+
45+
# ==========================================
46+
# Email Configuration (Optional)
47+
# ==========================================
48+
SMTP_HOST=
49+
SMTP_PORT=587
50+
SMTP_USER=
51+
SMTP_PASSWORD=
52+
EMAIL_FROM=noreply@legalos.com
53+
54+
# ==========================================
55+
# Storage Configuration
56+
# ==========================================
57+
UPLOAD_DIR=/app/uploads
58+
MAX_UPLOAD_SIZE=10485760
59+
60+
# ==========================================
61+
# Feature Flags
62+
# ==========================================
63+
ENABLE_AI_ANALYSIS=true
64+
ENABLE_REAL_TIME_UPDATES=true
65+
ENABLE_FILE_UPLOAD=true
66+
67+
# ==========================================
68+
# Monitoring (Optional)
69+
# ==========================================
70+
SENTRY_DSN=
71+
DATADOG_API_KEY=
72+
73+
# ==========================================
74+
# SSL/TLS Configuration (Production)
75+
# ==========================================
76+
# SSL_CERT_PATH=/etc/nginx/ssl/cert.pem
77+
# SSL_KEY_PATH=/etc/nginx/ssl/key.pem

.github/workflows/ci-cd.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
name: LegalOS CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
# Backend Tests
15+
test-backend:
16+
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
working-directory: ./backend
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.11'
28+
29+
- name: Cache pip packages
30+
uses: actions/cache@v3
31+
with:
32+
path: ~/.cache/pip
33+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
34+
35+
- name: Install dependencies
36+
run: |
37+
python -m pip install --upgrade pip
38+
pip install -r requirements.txt
39+
pip install pytest pytest-asyncio pytest-cov
40+
41+
- name: Run tests with coverage
42+
run: |
43+
pytest --cov=app --cov-report=xml --cov-report=html
44+
45+
- name: Upload coverage reports
46+
uses: codecov/codecov-action@v3
47+
with:
48+
files: ./coverage.xml
49+
flags: backend
50+
name: backend-coverage
51+
52+
# Frontend Tests
53+
test-frontend:
54+
runs-on: ubuntu-latest
55+
defaults:
56+
run:
57+
working-directory: ./nyayasahayak-main-main
58+
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- name: Set up Node.js
63+
uses: actions/setup-node@v4
64+
with:
65+
node-version: '20'
66+
cache: 'npm'
67+
cache-dependency-path: './nyayasahayak-main-main/package-lock.json'
68+
69+
- name: Install dependencies
70+
run: npm ci
71+
72+
- name: Run linting
73+
run: npm run lint
74+
75+
- name: Build
76+
run: npm run build
77+
78+
- name: Run tests
79+
run: npm test -- --coverage --watchAll=false || true
80+
81+
# Build and Push Docker Images
82+
build-and-push:
83+
needs: [test-backend, test-frontend]
84+
runs-on: ubuntu-latest
85+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
86+
87+
permissions:
88+
contents: read
89+
packages: write
90+
91+
steps:
92+
- uses: actions/checkout@v4
93+
94+
- name: Set up Docker Buildx
95+
uses: docker/setup-buildx-action@v3
96+
97+
- name: Log in to Container Registry
98+
uses: docker/login-action@v3
99+
with:
100+
registry: ${{ env.REGISTRY }}
101+
username: ${{ github.actor }}
102+
password: ${{ secrets.GITHUB_TOKEN }}
103+
104+
- name: Extract metadata (backend)
105+
id: meta-backend
106+
uses: docker/metadata-action@v5
107+
with:
108+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backend
109+
tags: |
110+
type=ref,event=branch
111+
type=ref,event=pr
112+
type=sha
113+
type=raw,value=latest,enable={{is_default_branch}}
114+
115+
- name: Build and push backend image
116+
uses: docker/build-push-action@v5
117+
with:
118+
context: ./backend
119+
file: ./Dockerfile.backend
120+
push: true
121+
tags: ${{ steps.meta-backend.outputs.tags }}
122+
labels: ${{ steps.meta-backend.outputs.labels }}
123+
cache-from: type=gha
124+
cache-to: type=gha,mode=max
125+
126+
- name: Extract metadata (frontend)
127+
id: meta-frontend
128+
uses: docker/metadata-action@v5
129+
with:
130+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-frontend
131+
tags: |
132+
type=ref,event=branch
133+
type=ref,event=pr
134+
type=sha
135+
type=raw,value=latest,enable={{is_default_branch}}
136+
137+
- name: Build and push frontend image
138+
uses: docker/build-push-action@v5
139+
with:
140+
context: ./nyayasahayak-main-main
141+
file: ./Dockerfile.frontend
142+
push: true
143+
tags: ${{ steps.meta-frontend.outputs.tags }}
144+
labels: ${{ steps.meta-frontend.outputs.labels }}
145+
cache-from: type=gha
146+
cache-to: type=gha,mode=max
147+
148+
# Security Scan
149+
security-scan:
150+
needs: build-and-push
151+
runs-on: ubuntu-latest
152+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
153+
154+
steps:
155+
- uses: actions/checkout@v4
156+
157+
- name: Run Trivy vulnerability scanner
158+
uses: aquasecurity/trivy-action@master
159+
with:
160+
scan-type: 'fs'
161+
scan-ref: '.'
162+
format: 'sarif'
163+
output: 'trivy-results.sarif'
164+
165+
- name: Upload scan results
166+
uses: github/codeql-action/upload-sarif@v2
167+
with:
168+
sarif_file: 'trivy-results.sarif'

.gitignore

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# General
2+
.DS_Store
3+
Thumbs.db
4+
*.log
5+
*.zip
6+
*.gz
7+
*.tar
8+
9+
# VS Code
10+
.vscode/
11+
!.vscode/settings.json
12+
!.vscode/tasks.json
13+
!.vscode/launch.json
14+
!.vscode/extensions.json
15+
*.code-workspace
16+
17+
# Python / Backend
18+
__pycache__/
19+
*.py[cod]
20+
*$py.class
21+
*.so
22+
.Python
23+
build/
24+
develop-eggs/
25+
dist/
26+
downloads/
27+
eggs/
28+
.eggs/
29+
lib/
30+
lib64/
31+
parts/
32+
sdist/
33+
var/
34+
wheels/
35+
share/python-wheels/
36+
*.egg-info/
37+
.installed.cfg
38+
*.egg
39+
MANIFEST
40+
41+
# Virtual Environments
42+
venv/
43+
.venv/
44+
env/
45+
.env
46+
.env.local
47+
.env.*.local
48+
backend/.env
49+
backend/.env.*
50+
51+
# Node.js / Frontend
52+
node_modules/
53+
frontend/node_modules/
54+
frontend/dist/
55+
frontend/build/
56+
frontend/.env
57+
frontend/.env.local
58+
frontend/.env.*.local
59+
frontend/npm-debug.log*
60+
frontend/yarn-debug.log*
61+
frontend/yarn-error.log*
62+
frontend/.eslintcache
63+
64+
# Docker / Volumes
65+
postgres-data/
66+
redis-data/
67+
grafana-data/
68+
prometheus-data/
69+
70+
# Application Specific
71+
evidence-storage/
72+
backend/uploads/
73+
*.sqlite
74+
*.db
75+
*.sqlite3
76+
debug_db.py
77+
create_backup.py
78+
seed_roles.py
79+
80+
# Backups
81+
backups/
82+
*_backup_*.zip
83+
84+
# Testing
85+
.pytest_cache/
86+
.coverage
87+
htmlcov/
88+
backend/.pytest_cache/
89+
backend/coverage.xml
90+
91+
# LegalOS Specific
92+
PRODUCTION_DEPLOYMENT_GUIDE.md

0 commit comments

Comments
 (0)