此包包含Kaomi部署程序的服务器端点。Kaomi服务器必须在您要部署的系统上运行。
kaomi-server的Python项目详细描述
Kaomi服务器
这个包是KAOMI Deployer的服务器。在
安装、配置和使用
1。创建虚拟环境
virtualenv env --python=python3
source env/bin/activate
2。安装程序包
^{pr2}$3。创建配置文件夹
python -m kaomi_server configure --folder <path>
5。为systemd
创建配置文件,路径为/etc/systemd/system/kaomi-server.service
[Unit]
Description=Kaomi Server (TM) Service
[Service]
Type=simple
User=root
Group=root
# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.
# Prefixing the path with '-' makes it try to load, but if the file doesn't
# exist, it continues onward.
EnvironmentFile=-/etc/default/kaomi-server
EnvironmentFile=-/etc/sysconfig/kaomi-server
ExecStart=<virtualenv path>/env/bin/python -m kaomi_server start --config <path file server.conf> --apikey <path directory conf.d>
Restart=on-abnormal
WorkingDirectory=<virtualenv path>
# When stopping, how long to wait before giving up and sending SIGKILL?
# Keep in mind that SIGKILL on a process can cause data loss.
TimeoutStopSec=3min
[Install]
WantedBy=multi-user.target
启动时启动Kaomi服务器
systemctl daemon-reload
systemctl enable kaomi-server.service
立即启动服务器
systemctl start kaomi-server.service
服务器格式
服务器响应是具有以下结构的json字典:
{ "status": "status code", "substatus": "substatus code", "message": "meaning of the substatus" "data": "eventual useful data" }
状态和子状态代码
status | substatus | meaning | data | example |
---|---|---|---|---|
0 | EVERYTHING WENT OK | |||
0 | Action executed | - | Specified folder has been created | |
1 | Final status reached but not in common way | - | Folder already existed | |
1 | REQUEST'S ERRORS | |||
0 | Wrong request type | - | Get request where only POST admitted | |
1 | Payload content-length greater than maximum allowed | Max request size in bytes | ||
2 | Json content cannot be parsed | - | ||
3 | Content-length not specified or not valid | - | ||
4 | Missing fields in JSON | List of requeted fields | ||
5 | ValueError in JSON | Exception text | Permissions received are not valid | |
2 | APPLICATION'S ERRORS | |||
0 | Generic server error occurred | Exception text | ||
1 | Invalid apikey | - | ||
2 | Action not permitted | Exception text | ||
3 | A RuntimeError occurred | Exception text | ||
4 | File/folder already exists | Exception text | ||
5 | The uploaded file is too big | - | Uploaded file exceed maximum size (data contains maximum size in MB) | |
6 | Client ip not allowed | - | The client ip is not in the allowed list |
- 项目
标签: