Skip to content

Commit 495e5e9

Browse files
Merge branch 'dev' of github.com:code-kern-ai/refinery-gateway into graphrag
2 parents f9d6459 + d306abc commit 495e5e9

File tree

4 files changed

+49
-4
lines changed

4 files changed

+49
-4
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ __pycache__/
77
*.py[cod]
88
*$py.class
99

10-
.vscode/
10+
.vscode/*
11+
!.vscode/launch.json
1112

1213
# C extensions
1314
*.so

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python Debugger: refinery-gateway",
9+
"type": "debugpy",
10+
"request": "attach",
11+
"connect": {
12+
"host": "localhost",
13+
"port": 15670
14+
},
15+
"pathMappings": [
16+
{
17+
"localRoot": "${workspaceFolder}",
18+
"remoteRoot": "."
19+
}
20+
]
21+
}
22+
]
23+
}

requirements-dev.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
-r requirements.txt
22
httpx>=0.25.0
3-
pytest==8.1.1
3+
pytest==8.1.1
4+
debugpy==1.8.12

start

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
#!/bin/bash
2+
3+
DEBUG_MODE=false
4+
DEBUG_PORT=15670
5+
6+
while getopts d flag
7+
do
8+
case "${flag}" in
9+
d) DEBUG_MODE=true;;
10+
esac
11+
done
12+
13+
CMD=""
14+
if [ $DEBUG_MODE = true ]; then
15+
CMD="debugpy --wait-for-client --listen 0.0.0.0:$DEBUG_PORT -m uvicorn app:app --host 0.0.0.0 --port 80 --reload"
16+
fi
17+
218
trap "echo -ne '\nstopping container...' && docker stop refinery-gateway > /dev/null 2>&1 && echo -ne '\t\t [done]\n'" EXIT
319

420
unameOut="$(uname -s)"
@@ -60,7 +76,7 @@ then
6076
fi
6177

6278
echo -ne 'building container...'
63-
docker build -t graphql-dev -f dev.Dockerfile . > /dev/null 2>&1
79+
docker build -t graphql-dev -f dev.Dockerfile .
6480
echo -ne '\t\t [done]\n'
6581

6682
echo -ne 'migrating db...\n'
@@ -76,6 +92,7 @@ echo -ne 'migration done\n'
7692
echo -ne 'starting...'
7793
docker run -d --rm \
7894
--name refinery-gateway \
95+
-p $DEBUG_PORT:$DEBUG_PORT \
7996
-p 7051:80 \
8097
-e AC_EXEC_ENV_IMAGE=registry.dev.kern.ai/code-kern-ai/refinery-ac-exec-env:dev$IS_ARM64 \
8198
-e LF_EXEC_ENV_IMAGE=registry.dev.kern.ai/code-kern-ai/refinery-lf-exec-env:dev$IS_ARM64 \
@@ -106,7 +123,10 @@ docker run -d --rm \
106123
--mount type=bind,source="$(pwd)"/,target=/app \
107124
-v /var/run/docker.sock:/var/run/docker.sock \
108125
--network dev-setup_default \
109-
graphql-dev > /dev/null 2>&1
126+
graphql-dev $CMD > /dev/null 2>&1
110127
echo -ne '\t\t\t [done]\n'
111128

129+
if [ $DEBUG_MODE = true ]; then
130+
echo -e "\033[0;33muse VSCode Debugger (Python Debugger: refinery-gateway) to start the service\033[0m"
131+
fi
112132
docker logs -f refinery-gateway \

0 commit comments

Comments
 (0)