Skip to content

Commit bbed17b

Browse files
authored
Merge pull request #11 from jdhoffa/1-setup_project
chore: set-up the bulk of the project implementing 12FA
2 parents 3fec9e7 + dc6c545 commit bbed17b

35 files changed

+19788
-0
lines changed

.env.example

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Database Configuration
2+
DATABASE_URL=postgres://lucidata:password@localhost:5432/lucidata
3+
POSTGRES_DB=lucidata
4+
POSTGRES_USER=lucidata
5+
POSTGRES_PASSWORD=password
6+
7+
# API Configuration
8+
API_HOST=0.0.0.0
9+
API_PORT=8000
10+
11+
# Frontend Configuration
12+
REACT_APP_API_URL=http://localhost:8000
13+
REACT_APP_LLM_ENGINE_URL=http://localhost:8001
14+
15+
# LLM Engine Configuration
16+
LLM_MODEL=openai/gpt-4
17+
LLM_API_KEY=your-api-key-here
18+
LLM_ENGINE_PORT=8001
19+
20+
# Response Formatter Configuration
21+
FORMATTER_PORT=8002

.github/workflows/ci.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
image: postgres:15
16+
env:
17+
POSTGRES_DB: lucidata_test
18+
POSTGRES_USER: lucidata
19+
POSTGRES_PASSWORD: password
20+
ports:
21+
- 5432:5432
22+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
# API tests
28+
- name: Set up Rust
29+
uses: actions-rs/toolchain@v1
30+
with:
31+
toolchain: stable
32+
override: true
33+
components: rustfmt, clippy
34+
35+
- name: Check formatting
36+
working-directory: ./api
37+
run: cargo fmt -- --check
38+
39+
- name: Lint
40+
working-directory: ./api
41+
run: cargo clippy -- -D warnings
42+
43+
- name: Test
44+
working-directory: ./api
45+
run: cargo test
46+
env:
47+
DATABASE_URL: postgres://lucidata:password@localhost:5432/lucidata_test
48+
49+
# Frontend tests
50+
- name: Set up Node.js
51+
uses: actions/setup-node@v3
52+
with:
53+
node-version: '18'
54+
55+
- name: Install frontend dependencies
56+
working-directory: ./frontend
57+
run: npm ci
58+
59+
- name: Lint frontend
60+
working-directory: ./frontend
61+
run: npm run lint
62+
63+
- name: Test frontend
64+
working-directory: ./frontend
65+
run: npm test
66+
67+
# Python services tests
68+
- name: Set up Python
69+
uses: actions/setup-python@v4
70+
with:
71+
python-version: '3.10'
72+
73+
- name: Install pytest
74+
run: pip install pytest
75+
76+
- name: Test LLM Engine
77+
working-directory: ./llm_engine
78+
run: |
79+
pip install -r requirements.txt
80+
pytest
81+
82+
- name: Test Query Runner
83+
working-directory: ./query_runner
84+
run: |
85+
pip install -r requirements.txt
86+
pytest
87+
88+
- name: Test Response Formatter
89+
working-directory: ./response_formatter
90+
run: |
91+
pip install -r requirements.txt
92+
pytest
93+
94+
build:
95+
runs-on: ubuntu-latest
96+
needs: test
97+
98+
steps:
99+
- uses: actions/checkout@v3
100+
101+
- name: Set up Docker Buildx
102+
uses: docker/setup-buildx-action@v2
103+
104+
- name: Build API
105+
uses: docker/build-push-action@v4
106+
with:
107+
context: ./api
108+
push: false
109+
load: true
110+
tags: lucidata-api:latest
111+
112+
- name: Build Frontend
113+
uses: docker/build-push-action@v4
114+
with:
115+
context: ./frontend
116+
push: false
117+
load: true
118+
tags: lucidata-frontend:latest
119+
120+
- name: Build LLM Engine
121+
uses: docker/build-push-action@v4
122+
with:
123+
context: ./llm_engine
124+
push: false
125+
load: true
126+
tags: lucidata-llm:latest
127+
128+
- name: Build Query Runner
129+
uses: docker/build-push-action@v4
130+
with:
131+
context: ./query_runner
132+
push: false
133+
load: true
134+
tags: lucidata-query-runner:latest
135+
136+
- name: Build Response Formatter
137+
uses: docker/build-push-action@v4
138+
with:
139+
context: ./response_formatter
140+
push: false
141+
load: true
142+
tags: lucidata-response-formatter:latest

.github/workflows/deploy.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
branches: [main]
7+
types: [completed]
8+
9+
jobs:
10+
deploy:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v2
19+
20+
- name: Login to GitHub Container Registry
21+
uses: docker/login-action@v2
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Build and Push API
28+
uses: docker/build-push-action@v4
29+
with:
30+
context: ./api
31+
push: true
32+
tags: |
33+
ghcr.io/${{ github.repository }}/lucidata-api:latest
34+
ghcr.io/${{ github.repository }}/lucidata-api:${{ github.sha }}
35+
36+
- name: Build and Push Frontend
37+
uses: docker/build-push-action@v4
38+
with:
39+
context: ./frontend
40+
push: true
41+
tags: |
42+
ghcr.io/${{ github.repository }}/lucidata-frontend:latest
43+
ghcr.io/${{ github.repository }}/lucidata-frontend:${{ github.sha }}
44+
45+
- name: Build and Push LLM Engine
46+
uses: docker/build-push-action@v4
47+
with:
48+
context: ./llm_engine
49+
push: true
50+
tags: |
51+
ghcr.io/${{ github.repository }}/lucidata-llm:latest
52+
ghcr.io/${{ github.repository }}/lucidata-llm:${{ github.sha }}
53+
54+
- name: Build and Push Query Runner
55+
uses: docker/build-push-action@v4
56+
with:
57+
context: ./query_runner
58+
push: true
59+
tags: |
60+
ghcr.io/${{ github.repository }}/lucidata-query-runner:latest
61+
ghcr.io/${{ github.repository }}/lucidata-query-runner:${{ github.sha }}
62+
63+
- name: Build and Push Response Formatter
64+
uses: docker/build-push-action@v4
65+
with:
66+
context: ./response_formatter
67+
push: true
68+
tags: |
69+
ghcr.io/${{ github.repository }}/lucidata-response-formatter:latest
70+
ghcr.io/${{ github.repository }}/lucidata-response-formatter:${{ github.sha }}
71+
72+
# For a real deployment, you'd add steps here to update your infrastructure
73+
# For example, updating a Kubernetes deployment or triggering a cloud deployment

.gitignore

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# OS specific files
2+
.DS_Store
3+
Thumbs.db
4+
.AppleDouble
5+
.LSOverride
6+
.Spotlight-V100
7+
.Trashes
8+
9+
# Editor directories and files
10+
.idea/
11+
.vscode/
12+
*.sublime-workspace
13+
*.sublime-project
14+
.vs/
15+
*.swp
16+
*~
17+
18+
# Rust / Cargo
19+
api/target/
20+
api/Cargo.lock
21+
**/*.rs.bk
22+
*.pdb
23+
24+
# Node.js / JavaScript / Frontend
25+
frontend/node_modules/
26+
frontend/.npm/
27+
frontend/.env
28+
frontend/.env.local
29+
frontend/.env.development.local
30+
frontend/.env.test.local
31+
frontend/.env.production.local
32+
frontend/npm-debug.log*
33+
frontend/yarn-debug.log*
34+
frontend/yarn-error.log*
35+
frontend/coverage/
36+
frontend/build/
37+
frontend/dist/
38+
frontend/.cache/
39+
40+
# Python
41+
__pycache__/
42+
*.py[cod]
43+
*$py.class
44+
*.so
45+
.Python
46+
env/
47+
venv/
48+
ENV/
49+
.env
50+
.venv
51+
build/
52+
develop-eggs/
53+
dist/
54+
downloads/
55+
eggs/
56+
.eggs/
57+
lib64/
58+
parts/
59+
sdist/
60+
var/
61+
*.egg-info/
62+
.installed.cfg
63+
*.egg
64+
.pytest_cache/
65+
.coverage
66+
htmlcov/
67+
.tox/
68+
.nox/
69+
.hypothesis/
70+
71+
# Docker
72+
.docker/
73+
74+
# Database
75+
*.sqlite
76+
*.sqlite3
77+
*.db
78+
*.sql.gz
79+
*.dump
80+
database/data/
81+
82+
# Logs
83+
logs/
84+
*.log
85+
npm-debug.log*
86+
yarn-debug.log*
87+
yarn-error.log*
88+
89+
# Temp files
90+
tmp/
91+
temp/
92+
.tmp/
93+
*.tmp
94+
*.bak
95+
*.swp
96+
*~.nib
97+
98+
# Jupyter Notebook
99+
.ipynb_checkpoints
100+
101+
# Secret files
102+
*.pem
103+
*.key
104+
*secret*
105+
*credentials*
106+
config.json
107+
.env

api/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "lucidata-api"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
tokio = { version = "1", features = ["full"] }
8+
axum = "0.6"
9+
serde = { version = "1.0", features = ["derive"] }
10+
serde_json = "1.0"
11+
sqlx = { version = "0.6", features = ["runtime-tokio-native-tls", "postgres", "macros", "json"] }
12+
tracing = "0.1"
13+
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
14+
dotenv = "0.15"
15+
tower-http = { version = "0.4", features = ["cors"] }

0 commit comments

Comments
 (0)