support backgroud task

This commit is contained in:
neos evo 2024-04-23 14:05:22 +08:00
parent 53fb607dbd
commit 7f1f496a30
7 changed files with 29 additions and 13 deletions

View File

@ -13,4 +13,7 @@ RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
COPY backend .
EXPOSE 7777
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7777"]
CMD tail -f /dev/null
# ENTRYPOINT ["bash", "docker_entrypoint.sh"]

View File

@ -30,4 +30,6 @@ WORKDIR /pb
EXPOSE 8090
CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8090"]
CMD tail -f /dev/null
# CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8090"]

View File

@ -21,6 +21,9 @@
### 2、强烈建议普通用户
- cd client
- 启动项目: docker compose up -d
- 关闭项目docker compose down
### 3、管理配置页面 —— http://127.0.0.1:8090/_/

View File

@ -0,0 +1,5 @@
#!/bin/bash
set -o allexport
set +o allexport
exec uvicorn main:app --reload --host 0.0.0.0 --port 7777 &
exec python background_task.py

View File

@ -13,4 +13,5 @@ langsmith==0.0.77
faiss-cpu # for cpu-only environment
pocketbase==0.10.0
gne
chardet
chardet
schedule

View File

@ -10,6 +10,7 @@ services:
volumes:
- ./pb/pb_data:/pb/pb_data
# - ./${PROJECT_DIR}:/pb/${PROJECT_DIR}
entrypoint: /pb/pocketbase serve --http=0.0.0.0:8090
api:
build:
@ -17,13 +18,14 @@ services:
image: wiseflow/api
tty: true
stdin_open: true
entrypoint: bash docker_entrypoint.sh
env_file:
- .env
ports:
- 7777:7777
volumes:
- ./${PROJECT_DIR}:/app/${PROJECT_DIR}
- ${EMBEDDING_MODEL_PATH}:${EMBEDDING_MODEL_PATH}
- ${RERANKER_MODEL_PATH}:${RERANKER_MODEL_PATH}
- ./${EMBEDDING_MODEL_PATH}:/app/${EMBEDDING_MODEL_PATH}
- ./${RERANKER_MODEL_PATH}:/app/${RERANKER_MODEL_PATH}
depends_on:
- web

View File

@ -1,14 +1,14 @@
#**for local llmp server**
export DASHSCOPE_API_KEY=''
export VOLC_KEY='AK|SK'
export DASHSCOPE_API_KEY=""
export VOLC_KEY="AK|SK"
#**for embeddig model**
export EMBEDDING_MODEL_PATH=''
export RERANKER_MODEL_PATH=''
export DEVICE=''
export EMBEDDING_MODEL_PATH="bce-embedding-base_v1"
export RERANKER_MODEL_PATH="bce-reranker-base_v1"
export DEVICE="cpu"
#**for processer**
export PROJECT_DIR=""
export PROJECT_DIR="work_dir"
export WS_LOG="verbose"
export PB_API_AUTH='test@example.com|123467890'
export PB_API_BASE='web:8090' ##可以参考https://stackoverflow.com/questions/70151702/how-to-network-2-separate-docker-containers-to-communicate-with-eachother
export PB_API_AUTH="test@example.com|123467890"
export PB_API_BASE="web:8090" ##可以参考https://stackoverflow.com/questions/70151702/how-to-network-2-separate-docker-containers-to-communicate-with-eachother