Skip to content

Commit e9bc8b1

Browse files
authored
24 feature add db service provider management (#25)
* Add data service, db migrations, and api Signed-off-by: jphillips <josh.phillips@fearnworks.com> * Remove old db migration system Signed-off-by: jphillips <josh.phillips@fearnworks.com> * remove dist build Signed-off-by: jphillips <josh.phillips@fearnworks.com> * Fix seed scripts on startup Signed-off-by: jphillips <josh.phillips@fearnworks.com> * add common module for api status codes Signed-off-by: jphillips <josh.phillips@fearnworks.com> * Add dataservice connection to ui Signed-off-by: jphillips <josh.phillips@fearnworks.com> * add provider api and ui, fix relations Signed-off-by: jphillips <josh.phillips@fearnworks.com> * Add perspective doc Signed-off-by: jphillips <josh.phillips@fearnworks.com> * Add locality graph Signed-off-by: jphillips <josh.phillips@fearnworks.com> * decompose provider panel & resolve lints Signed-off-by: jphillips <josh.phillips@fearnworks.com> * Add autoconnect to server Signed-off-by: jphillips <josh.phillips@fearnworks.com> * Increase size of expanded side panels Signed-off-by: jphillips <josh.phillips@fearnworks.com> * cleanup Signed-off-by: jphillips <josh.phillips@fearnworks.com> --------- Signed-off-by: jphillips <josh.phillips@fearnworks.com>
1 parent 37ea52b commit e9bc8b1

68 files changed

Lines changed: 5052 additions & 311 deletions

Some content is hidden

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

.cursor/rules/task.mdc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
description: Current Task for the Agent
2+
description:
33
globs:
4-
alwaysApply: true
4+
alwaysApply: false
55
---
6-
Include Task for the branch here
6+
Add your task here.

.vscode/settings.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,16 @@
22
"sonarlint.connectedMode.project": {
33
"connectionId": "open-model-initiative",
44
"projectKey": "Open-Model-Initiative_graphcap"
5-
}
5+
},
6+
"sqltools.connections": [
7+
{
8+
"previewLimit": 50,
9+
"server": "localhost",
10+
"port": 35433,
11+
"driver": "PostgreSQL",
12+
"name": "graphcap_pg",
13+
"database": "graphcap",
14+
"username": "graphcap"
15+
}
16+
]
617
}

Taskfile.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
version: "3"
22
dotenv: ['.env', '{{.ENV}}/.env', '{{.HOME}}/.env']
33

4+
includes:
5+
data: ./data_service/Taskfile.data.yml
6+
47
tasks:
58
build:
69
cmds:

data_service/.dockerignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Version control
2+
.git
3+
.gitignore
4+
.gitattributes
5+
6+
# Dependencies
7+
node_modules
8+
dist
9+
10+
# Environment files
11+
.env*
12+
*.env
13+
14+
# Development files
15+
*.log
16+
.vscode
17+
.idea
18+
*.md
19+
!README.md
20+
21+
# Test files
22+
__tests__
23+
*.test.*
24+
*.spec.*
25+
26+
# Other
27+
.DS_Store
28+
*.swp
29+
*.swo
30+
.editorconfig
31+
.eslintrc*
32+
.prettierrc*
33+
coverage
34+

data_service/.gitignore

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

data_service/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
FROM oven/bun:1.0-debian AS base
3+
4+
WORKDIR /app
5+
6+
# Install basic utilities and PostgreSQL client
7+
RUN apt-get update && apt-get install -y \
8+
lsof \
9+
net-tools \
10+
postgresql-client \
11+
procps \
12+
wget \
13+
&& apt-get clean \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
# Install dependencies
17+
COPY package.json bun.lock ./
18+
RUN bun install
19+
20+
# Copy source code
21+
COPY . .
22+
23+
# Build and verify
24+
RUN chmod +x /app/entrypoint.sh
25+
26+
27+
# Expose ports
28+
EXPOSE 32550
29+
EXPOSE 32501
30+
31+
# Use our debug entrypoint script
32+
ENTRYPOINT ["/app/entrypoint.sh"]

data_service/Taskfile.data.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
version: "3"
2+
3+
tasks:
4+
dev:
5+
desc: Start the data service container with watch mode
6+
cmds:
7+
- docker compose -f ./docker-compose.yml --env-file ./workspace/config/.env up graphcap_data_service --watch --build
8+
9+
start:
10+
desc: Start the data service container
11+
cmds:
12+
- docker compose -f ./docker-compose.yml --env-file ./workspace/config/.env up -d graphcap_data_service
13+
14+
stop:
15+
desc: Stop the data service container
16+
cmds:
17+
- docker compose -f ./docker-compose.yml --env-file ./workspace/config/.env stop graphcap_data_service
18+
19+
logs:
20+
desc: View logs for the data service container
21+
cmds:
22+
- docker compose -f ./docker-compose.yml logs -f graphcap_data_service
23+
24+
rebuild:
25+
desc: Rebuild and restart the data service container
26+
cmds:
27+
- docker compose -f ./docker-compose.yml --env-file ./workspace/config/.env build graphcap_data_service
28+
- docker compose -f ./docker-compose.yml --env-file ./workspace/config/.env up -d --force-recreate graphcap_data_service
29+
30+
migrate:
31+
desc: Run database migrations
32+
cmds:
33+
- docker compose -f ./docker-compose.yml exec graphcap_data_service bun run migrate
34+
35+
seed:
36+
desc: Seed the database with initial data
37+
cmds:
38+
- docker compose -f ./docker-compose.yml --env-file ./workspace/config/.env exec graphcap_data_service bun run seed
39+
40+
studio:
41+
desc: Start Drizzle Kit Studio for database management
42+
cmds:
43+
- docker compose -f ./docker-compose.yml exec graphcap_data_service bun run studio
44+
45+
generate:
46+
desc: Generate Drizzle ORM schema files
47+
cmds:
48+
- docker compose -f ./docker-compose.yml exec graphcap_data_service bun run generate
49+
50+
local-dev:
51+
desc: Run the data service locally with Bun
52+
cmds:
53+
- bun run dev
54+
55+
local-build:
56+
desc: Build the data service locally
57+
cmds:
58+
- bun run build
59+
60+
local-start:
61+
desc: Start the built data service locally
62+
cmds:
63+
- bun run start
64+
65+
install:
66+
desc: Install dependencies
67+
cmds:
68+
- bun install

data_service/biome.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"linter": {
7+
"enabled": true,
8+
"rules": {
9+
"recommended": true
10+
}
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "space",
15+
"indentWidth": 2,
16+
"lineWidth": 100
17+
}
18+
}

data_service/bun.lock

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

data_service/drizzle.config.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig } from 'drizzle-kit';
2+
import 'dotenv/config';
3+
4+
export default defineConfig({
5+
out: './src/db/migrations',
6+
schema: './src/db/schema/index.ts',
7+
dialect: 'postgresql',
8+
dbCredentials: {
9+
url: process.env.DATABASE_URL || '',
10+
},
11+
verbose: true,
12+
strict: true,
13+
tablesFilter: ['providers*', 'provider_*'],
14+
schemaFilter: 'public',
15+
migrations: {
16+
prefix: 'timestamp',
17+
table: '__drizzle_migrations__',
18+
schema: 'public'
19+
}
20+
});

0 commit comments

Comments
 (0)