first commit
This commit is contained in:
commit
bce101bf52
55
README.md
Normal file
55
README.md
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# 开元rag
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
执行下面的命令
|
||||||
|
```
|
||||||
|
git clone https://git.opencomputing.cn/yumoqing/kyrag
|
||||||
|
cd kyrag
|
||||||
|
cdir=$(pwd)
|
||||||
|
uname=$(id -un)
|
||||||
|
gname=$(id -gn)
|
||||||
|
python3 -m venv py3
|
||||||
|
source py3/bin/activate
|
||||||
|
pip install -r requirements.txt
|
||||||
|
cat > $cdir/kyrag.service <<EOF
|
||||||
|
[Unit]
|
||||||
|
Wants=systemd-networkd.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=$uname
|
||||||
|
Group=$gname
|
||||||
|
Type=forking
|
||||||
|
WorkingDirectory=$cdur
|
||||||
|
ExecStart=$cdir/start.sh
|
||||||
|
ExecStop=$cdir/stop.sh
|
||||||
|
StandardOutput=append:/var/log/kyrag/kyrag.log
|
||||||
|
StandardError=append:/var/log/kyrag/kyrag.log
|
||||||
|
SyslogIdentifier=kyrag
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
cat > $cdir/start.sh <<EOF
|
||||||
|
#!/usr/bin/bash
|
||||||
|
cd $cdir
|
||||||
|
$cdir/py3/bin/python $cdir/app/kyrag.py -p 9182 -w $cdir &
|
||||||
|
exit 0
|
||||||
|
EOF
|
||||||
|
cat > $cdir/stop.sh <<EOF
|
||||||
|
PORT=9182
|
||||||
|
PID=$(lsof -t -i:$PORT)
|
||||||
|
|
||||||
|
if [ -n "$PID" ]; then
|
||||||
|
echo "找到端口 $PORT 的进程: PID=$PID"
|
||||||
|
kill -9 $PID
|
||||||
|
echo "已终止端口 $PORT 的进程"
|
||||||
|
else
|
||||||
|
echo "未找到端口 $PORT 的进程"
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
chmod +x $cdir/start.sh stop.sh
|
||||||
|
sudo mkdir /var/log/kyrag
|
||||||
|
sudo cp kyrag.service /etc/systemd/system
|
||||||
|
sudo systemctl enable kyrag
|
||||||
|
sudo systemctl restart kyrag
|
||||||
|
```
|
||||||
16
app/kyrag.py
Normal file
16
app/kyrag.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
from ahserver.webapp import webapp
|
||||||
|
from ahserver.serverenv import ServerEnv
|
||||||
|
from appbase.init import load_appbase
|
||||||
|
from rbac.init import load_rbac
|
||||||
|
from filemgr.init import load_filemgr
|
||||||
|
from rag.init import load_rag
|
||||||
|
|
||||||
|
def init():
|
||||||
|
load_appbase()
|
||||||
|
load_rbac()
|
||||||
|
load_filemgr()
|
||||||
|
load_rag()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
webapp(init)
|
||||||
|
|
||||||
62
conf/config.json
Executable file
62
conf/config.json
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
"password_key":"!@#$%^&*(*&^%$QWERTYUIqwertyui234567",
|
||||||
|
"logger":{
|
||||||
|
"name":"kyrag",
|
||||||
|
"levelname":"info",
|
||||||
|
"logfile":"$[workdir]$/logs/kyrag.log"
|
||||||
|
},
|
||||||
|
"filesroot":"$[workdir]$/files",
|
||||||
|
"databases":{
|
||||||
|
"kyrag":{
|
||||||
|
"driver":"aiomysql",
|
||||||
|
"async_mode":true,
|
||||||
|
"coding":"utf8",
|
||||||
|
"maxconn":100,
|
||||||
|
"dbname":"kyrag",
|
||||||
|
"kwargs":{
|
||||||
|
"user":"test",
|
||||||
|
"db":"kyrag",
|
||||||
|
"password":"QUZVcXg5V1p1STMybG5Ia6mX9D0v7+g=",
|
||||||
|
"host":"db"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"website":{
|
||||||
|
"paths":[
|
||||||
|
["$[workdir]$/wwwroot",""]
|
||||||
|
],
|
||||||
|
"client_max_size":10000,
|
||||||
|
"host":"0.0.0.0",
|
||||||
|
"port":9182,
|
||||||
|
"coding":"utf-8",
|
||||||
|
"indexes":[
|
||||||
|
"index.html",
|
||||||
|
"index.tmpl",
|
||||||
|
"index.ui",
|
||||||
|
"index.dspy"
|
||||||
|
],
|
||||||
|
"startswiths":[
|
||||||
|
{
|
||||||
|
"leading":"/idfile",
|
||||||
|
"registerfunction":"idfile"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"processors":[
|
||||||
|
[".proxy","proxy"],
|
||||||
|
[".tmpl.js","tmpl"],
|
||||||
|
[".tmpl.css","tmpl"],
|
||||||
|
[".html.tmpl","tmpl"],
|
||||||
|
[".bcrud", "bricks_crud"],
|
||||||
|
[".tmpl","tmpl"],
|
||||||
|
[".app","app"],
|
||||||
|
[".bui","bui"],
|
||||||
|
[".ui","bui"],
|
||||||
|
[".dspy","dspy"]
|
||||||
|
],
|
||||||
|
"session_max_time":3000,
|
||||||
|
"session_issue_time":2500,
|
||||||
|
"session_redis":{
|
||||||
|
"url":"redis://127.0.0.1:6379"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
requirements.txt
Normal file
8
requirements.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
git+https://git.opencomputing.cn:yumoqing/apppublic
|
||||||
|
git+https://git.opencomputing.cn:yumoqing/sqlor
|
||||||
|
git+https://git.opencomputing.cn:yumoqing/ahserver
|
||||||
|
git+https://git.opencomputing.cn:yumoqing/appbase
|
||||||
|
git+https://git.opencomputing.cn:yumoqing/rbac
|
||||||
|
git+https://git.opencomputing.cn:yumoqing/rag
|
||||||
|
git+https://git.opencomputing.cn:yumoqing/dapi
|
||||||
|
git+https://git.opencomputing.cn:yumoqing/filemgr
|
||||||
Loading…
x
Reference in New Issue
Block a user