CeSi的安装和部署
CeSi 是 Supervisor 官方推荐的集中化管理 Supervisor 实例的 Web UI,该工具是用 Python 编写的,基于 Flask Web 框架 。
Superviosr 自带的 Web UI 不支持跨机器管理,Supervisor 进程功能比较简单,通过 CeSi 可以集中管理各个服务器节点的进程,在 Web 界面就可以轻松管理各个服务的启动、关闭、重启等,使用很方便。
安装
以Ubuntu为例,具体的安装步骤如下:
$ sudo apt install -y git python3 python3-pip python3-venv $ # If you want to change CESI_SETUP_PATH, you must change the configurations in the cesi.service file.$ export CESI_SETUP_PATH=/opt/cesi$ mkdir ${CESI_SETUP_PATH}$ cd ${CESI_SETUP_PATH} $ # Download the project to CESI_SETUP_PATH directory$ wget https://github.com/gamegos/cesi/releases/download/v2.7.1/cesi-extended.tar.gz -O cesi.tar.gz$ tar -xvf cesi.tar.gz $ # Create virtual environment and install requirement packages$ python3 -m venv venv$ source venv/bin/activate(venv) $ pip3 install -r requirements.txt(venv) $ deactivate # Deactivate virtual environment $ # Build ui (First you must install dependencies for ui -> yarn) - Optional$ cd ${CESI_SETUP_PATH}/cesi/ui$ yarn install$ yarn build $ # Create cesi.conf.toml file and update cesi.conf.toml for your environment.$ # Config file documentation can be found inside default file.$ # (You must create cesi.conf in the etc directory for cesi.service)$ sudo cp ${CESI_SETUP_PATH}/defaults/cesi.conf.toml /etc/cesi.conf.toml $ # Run as a service$ sudo cp ${CESI_SETUP_PATH}/defaults/cesi.service /etc/systemd/system/cesi.service$ sudo systemctl daemon-reload$ sudo systemctl start cesi
配置
CeSi 的配置非常简单,和 Supervisor 的配置文件类似,配置文件路径:
/etc/cesi.conf.toml
只需要把nodes部分填充为自己的各个服务器节点信息就可以了,含义可以看注释部分。
# This is the main CeSI toml configuration file. It contains CeSI web application and# supervisord information to connect # This is the CeSI's own configuration.[cesi]# Database Uridatabase = "sqlite:///users.db" # Relative path# Etc#database = "sqlite:////opt/cesi/< version >/users.db" # Absolute path#database = "postgres://<user>:<password>@localhost:5432/<database_name>"#database = "mysql+pymysql://<user>:<password>@localhost:3306/<database_name>"activity_log = "activity.log" # File path for CeSI logsadmin_username = "admin" # Username of admin useradmin_password = "admin" # Password of admin user # This is the definition section for new supervisord node.# [[nodes]]# name = "api" # (String) Unique name for supervisord node.# environment = "" # (String) The environment name provides logical grouping of supervisord nodes. It can be used as filtering option in the UI.# username = "" # (String) Username of the XML-RPC interface of supervisord Set nothing if no username is configured# password = "" # (String) Password of the XML-RPC interface of supervisord. Set nothing if no username is configured# host = "127.0.0.1" # (String) Host of the XML-RPC interface of supervisord# port = "9001" # (String) Port of the XML-RPC interface of supervisord # Default supervisord nodes[[nodes]]name = "专项服务器"environment = ""username = "test"password = "test"host = ""port = "9001" [[nodes]]name = "主服务器"environment = ""username = "test"password = "test"host = ""port = "9001"
最终的效果图如下: