-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Phenomenon and reproduction steps** **Root cause and solution** **Impactions** **Test method** **Affected branch(es)** * main **Checklist** - [ ] Dependencies update required - [ ] Common bug (similar problem in other repo)
- Loading branch information
congxi
committed
Mar 21, 2024
1 parent
9012067
commit f54633a
Showing
57 changed files
with
3,430 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[flake8] | ||
# it's not a bug that we aren't using all of hacking, ignore: | ||
# F401: A module has been imported but is not used anywhere in the file | ||
# F812: list comprehension redefines ... | ||
# H101: Use TODO(NAME) | ||
# H202: assertRaises Exception too broad | ||
# H233: Python 3.x incompatible use of print operator | ||
# H301: one import per line | ||
# H306: imports not in alphabetical order (time, os) | ||
# H401: docstring should not start with a space | ||
# H403: multi line docstrings should end on a new line | ||
# H404: multi line docstring should start without a leading new line | ||
# H405: multi line docstring summary not separated with an empty line | ||
# H501: Do not use self.__dict__ for string formatting | ||
# | ||
# E501: line too long (82 > 79 characters) | ||
# E129: visually indented line with same indent as next logical line | ||
# E126: continuation line over-indented for hanging indent | ||
# E711: comparison to None should be ‘if cond is None:’ | ||
# E999: SyntaxError: invalid syntax | ||
# W504: line break after binary operator | ||
# W503: line break before binary operator | ||
# W605: invalid escape sequence | ||
max-line-length = 248 | ||
ignore = N813,F401,F812,H101,H202,H233,H301,H306,H401,H403,H404,H405,H501,E501,E999,E129,E126,E711,W503,W504,W605,N801,N806 | ||
# exclude = web-servcie-base,fauths/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: CI | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the "main" branch | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
- 'v**' | ||
- 'feature-**' | ||
- latest | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
inputs: | ||
ref: | ||
description: "Why trigger?" | ||
required: true | ||
type: string | ||
|
||
env: | ||
IMAGE: "deepflowio-stella-agent-ce" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set Env | ||
run: | | ||
echo "IMAGE_TAG_PREFIX=${{ github.ref_name }}"|sed 's|main|latest|' >> $GITHUB_ENV | ||
echo "IMAGE_TAG=$(git rev-list --count HEAD)" >> $GITHUB_ENV | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
|
||
- name: Setup Pythons | ||
uses: actions/setup-python@v5 | ||
with: | ||
node-version: '3.8' | ||
|
||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
install: true | ||
|
||
- name: Log In To GitHub Docker Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: "ghcr.io" | ||
username: "${{ github.repository_owner }}" | ||
password: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Log In To Docker Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
username: "deepflowce" | ||
password: "${{ secrets.REGISTRY_PASS }}" | ||
|
||
- name: Build And Push deepflowio-stella-agent-ce Images | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
"ghcr.io/${{ github.repository_owner }}/deepflow-ce/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}-${{ env.IMAGE_TAG }}" | ||
"ghcr.io/${{ github.repository_owner }}/deepflow-ce/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}" | ||
"deepflowce/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}" | ||
- name: Log In To ALIYUN HongKong Docker Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: "registry.cn-hongkong.aliyuncs.com" | ||
username: "${{ secrets.REGISTRY_ALIYUN_USER }}" | ||
password: "${{ secrets.REGISTRY_PASS }}" | ||
|
||
- name: Build And Push deepflowio-stella-agent-ce Images to ALIYUN HongKong | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
"registry.cn-hongkong.aliyuncs.com/deepflow-ce/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}-${{ env.IMAGE_TAG }}" | ||
"registry.cn-hongkong.aliyuncs.com/deepflow-ce/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}" | ||
- name: Log In To ALIYUN Docker Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: "registry.cn-beijing.aliyuncs.com" | ||
username: "${{ secrets.REGISTRY_ALIYUN_USER }}" | ||
password: "${{ secrets.REGISTRY_PASS }}" | ||
|
||
- name: Build And Push deepflowio-stella-agent-ce Images To ALIYUN BeiJing | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
"registry.cn-beijing.aliyuncs.com/deepflow-ce/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}-${{ env.IMAGE_TAG }}" | ||
"registry.cn-beijing.aliyuncs.com/deepflow-ce/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}" | ||
- name: Build tar.gz | ||
run: | | ||
mkdir -p release/stella-agent-ce | ||
mv deploy df-llm-agent etc Dockerfile requirements3.txt stream.html -t release/stella-agent-ce | ||
cd release | ||
tar -zcvf deepflow-gui-grafana.tar.gz ./stella-agent-ce/* | ||
rm -r ./stella-agent-ce | ||
- name: Release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
./release/* | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__pycache__ | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# 构建层 | ||
FROM python:3.8-slim-buster AS builder | ||
RUN apt-get update && \ | ||
apt-get install --no-install-suggests \ | ||
--no-install-recommends --yes \ | ||
python3-venv \ | ||
gcc \ | ||
libpython3-dev \ | ||
libpq-dev \ | ||
default-libmysqlclient-dev \ | ||
make \ | ||
&& \ | ||
python3 -m venv /root/venv && \ | ||
/root/venv/bin/pip install --upgrade pip --trusted-host mirrors.aliyun.com --index-url https://mirrors.aliyun.com/pypi/simple | ||
|
||
# Base 构建层 | ||
FROM builder AS builder-venv-base | ||
RUN /root/venv/bin/pip install cffi --trusted-host mirrors.aliyun.com --index-url https://mirrors.aliyun.com/pypi/simple/ | ||
|
||
# 自定义构建层 | ||
FROM builder-venv-base AS builder-venv-custom | ||
COPY requirements3.txt /root/requirements3.txt | ||
RUN /root/venv/bin/pip install --disable-pip-version-check \ | ||
--no-cache-dir \ | ||
--trusted-host mirrors.aliyun.com \ | ||
--index-url https://mirrors.aliyun.com/pypi/simple/ \ | ||
-r /root/requirements3.txt | ||
|
||
FROM python:3.8-slim-buster AS runner | ||
|
||
WORKDIR /root/df-llm-agent/ | ||
|
||
RUN apt-get update && apt-get install --no-install-suggests --no-install-recommends --yes gcc libpython3-dev | ||
COPY --from=builder-venv-custom /usr/lib/*-linux-gnu/*.so* /usr/lib/x86_64-linux-gnu/ | ||
RUN mkdir /usr/lib/x86_64-linux-gnu/mariadb19 | ||
COPY --from=builder-venv-custom /usr/lib/*-linux-gnu/mariadb19/ /usr/lib/x86_64-linux-gnu/mariadb19/ | ||
COPY --from=builder-venv-custom /root/venv /root/venv | ||
|
||
# Copy code | ||
## 复制代码 | ||
COPY ./etc/df-llm-agent.yaml /etc/web/ | ||
COPY ./df-llm-agent /root/df-llm-agent/ | ||
|
||
RUN chmod +x /root/df-llm-agent/py2c.sh | ||
|
||
RUN /root/df-llm-agent/py2c.sh | ||
|
||
RUN ls -la /root/df-llm-agent | ||
|
||
## dockerfile里的db_version 和issu里最大版本的x.x.x.x.sql 一致 | ||
ENV DB_VERSION=1.0.0.0 | ||
|
||
## Run | ||
CMD /root/venv/bin/python3 -u /root/df-llm-agent/app.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# stella-agent-ce | ||
gpt agent | ||
|
||
# 运行服务 | ||
进入deploy/templates 目录下,执行命令 | ||
|
||
``` | ||
kubectl create -f ./configmap.yaml | ||
kubectl create -f ./deployment.yaml | ||
kubectl create -f ./service.yaml | ||
``` | ||
|
||
# 本地测试 | ||
|
||
python3 -m pip install virtualenv | ||
/usr/local/bin/virtualenv --clear ./venv | ||
./venv/bin/pip3 install -r ./requirements3.txt | ||
./venv/bin/python3 ./app.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[feature|bugfix] commit message title | ||
|
||
**Phenomenon and reproduction steps** | ||
|
||
(Describe the phenomenon and scenario of the bug) | ||
|
||
**Root cause and solution** | ||
|
||
(Describe the cause of the bug and corresponding solution) | ||
|
||
**Impactions** | ||
|
||
(Visible changes after this fix) | ||
|
||
**Test method** | ||
|
||
(Test method to ensure the bug is fixed) | ||
|
||
**Affected branch(es)** | ||
|
||
* main | ||
|
||
**Checklist** | ||
|
||
- [ ] Dependencies update required | ||
- [ ] Common bug (similar problem in other repo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v2 | ||
name: df-llm-agent | ||
description: A Helm chart for Kubernetes | ||
|
||
type: application | ||
|
||
version: 6.1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# df-llm-agent Config | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: df-llm-agent | ||
namespace: deepflow | ||
data: | ||
df-llm-agent.yaml: |- | ||
daemon: True | ||
api_timeout: 500 | ||
sql_show: False | ||
log_file: /var/log/df-llm-agent.log | ||
log_level: info | ||
instance_path: /root/df-llm-agent | ||
redis: | ||
host: | ||
- redis | ||
cluster_enabled: False # True,False | ||
port: 6379 | ||
db: 6 | ||
password: "password123" | ||
mysql: | ||
user_name: root | ||
user_password: password123 | ||
host: mysql | ||
port: 30130 | ||
database: deepflow_llm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: df-llm-agent-deployment | ||
namespace: deepflow | ||
labels: | ||
component: df-llm-agent | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
component: df-llm-agent | ||
template: | ||
metadata: | ||
labels: | ||
component: df-llm-agent | ||
spec: | ||
hostNetwork: true | ||
dnsPolicy: ClusterFirstWithHostNet | ||
containers: | ||
- name: df-llm-agent | ||
image: "hub.deepflow.yunshan.net/dev/df-llm-agent:latest" | ||
imagePullPolicy: Always | ||
volumeMounts: | ||
- name: debug-path | ||
mountPath: /root/debug | ||
- mountPath: /etc/web/df-llm-agent.yaml | ||
name: web-volumes-df-llm-agent | ||
subPath: df-llm-agent.yaml | ||
volumes: | ||
- name: debug-path | ||
hostPath: | ||
type: DirectoryOrCreate | ||
path: /usr/local/deepflow/debug/ | ||
- name: web-volumes-df-llm-agent | ||
configMap: | ||
name: df-llm-agent | ||
items: | ||
- key: df-llm-agent.yaml | ||
path: df-llm-agent.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: df-llm-agent-deployment-mysql | ||
namespace: cx-test | ||
labels: | ||
component: df-llm-agent-mysql | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
component: df-llm-agent-mysql | ||
template: | ||
metadata: | ||
labels: | ||
component: df-llm-agent-mysql | ||
spec: | ||
hostNetwork: false | ||
dnsPolicy: ClusterFirstWithHostNet | ||
containers: | ||
- name: df-llm-agent-mysql | ||
image: "mysql:8.0.26" | ||
imagePullPolicy: Always | ||
env: | ||
- name: MYSQL_ROOT_PASSWORD | ||
value: password123 | ||
ports: | ||
- containerPort: 3306 | ||
name: mysql |
Oops, something went wrong.