美文网首页
CeSi(Supervisor 守护进程集中管理工具)

CeSi(Supervisor 守护进程集中管理工具)

作者: 都市小木屋 | 来源:发表于2020-03-31 22:30 被阅读0次

    简介
      CeSi 是 Supervisor 官方推荐的集中化管理 Supervisor 实例的 Web UI,该工具是用 Python 编写,基于 Flask Web 框架 。
      Superviosr 自带的 Web UI 不支持跨机器管理
      Supervisor 进程,功能比较简单,通过 CeSi 可以集中管理各个服务器节点的进程,在 Web 界面就可以轻松管理各个服务的启动、关闭、重启等,很方便使用。(以上概论网络拷贝,侵删)

    当前部署环境:CentOS7.6、Python3.5

    安装部署

    1、升级系统python版本

    CentosOS7.6 默认Python版本为2.7,CeS基于 Python3 (+3.4)、Flask (+1.0)、ReactJs (+16.0)

    #安装依赖
    [root@datacloud21 ~]# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
    #下载Python源码包:
    [root@datacloud21 ~]# wget http://mirrors.sohu.com/python/3.5.2/Python-3.5.2.tgz
    #编译、安装:
    [root@datacloud21 ~]# tar -xzvf /usr/local/src/Python-3.5.2.tgz -C /usr/local/src/
    [root@datacloud21 ~]# cd /usr/local/src/Python-3.5.2
    [root@datacloud21 Python-3.5.2]# ./configure --prefix=/usr/local/python
    [root@datacloud21 Python-3.5.2]# make -j 4
    [root@datacloud21 Python-3.5.2]# make install
    #查看扩展安装包:
    [root@datacloud21 ~]# /usr/local/python/bin/pip3 list
    pip (8.1.1)
    setuptools (20.10.1)
    #添加Python命令到环境变量:
    [root@Python /]# vim /etc/profile
     
    PATH=$PATH:$HOME/bin
    #添加:
    PATH=$PATH:$HOME/bin:/usr/local/python/bin
    #使环境变量生效:
    [root@datacloud21 ~]#  source /etc/profile
    #查看Python版本:
    [root@datacloud21 ~]#  python3 -V
    Python 3.5.2
    #更改系统默认python版本为Python3.5(CentOS 7)
    [root@datacloud21 ~]#  mv /usr/bin/python /usr/bin/python2.7
    [root@datacloud21 ~]#  ln -s /usr/local/python/bin/python3.5 /usr/bin/python
    [root@datacloud21 ~]#  python -V
    Python 3.5.2
    

    二、部署CeSi

    #安装依赖
    [root@datacloud21 ~]# yum install -y git wget epel-release  npm bzip2 
    [root@datacloud21 ~]# pip3 install flask flask_sqlalchemy tomlkit
    
    [root@datacloud21 ~]# npm install -g n (升级node到最新的版本)
    [root@datacloud21 ~]# n latest
    [root@datacloud21 ~]# curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
    [root@datacloud21 ~]# yum install -y yarn (安装yarn)
    
    #开始部署cesi,参考官网教程
    [root@datacloud21 ~]# export CESI_SETUP_PATH=/home/cesi
    [root@datacloud21 ~]# mkdir ${CESI_SETUP_PATH}
    [root@datacloud21 ~]# cd ${CESI_SETUP_PATH}
    [root@datacloud21 cesi]# wget https://github.com/gamegos/cesi/releases/download/v2.6.8/cesi-extended.tar.gz -O cesi.tar.gz
    [root@datacloud21 cesi]# tar -xvf cesi.tar.gz
    [root@datacloud21 cesi]# python -m venv venv
    [root@datacloud21 cesi]# source venv/bin/activate
    (venv) [root@datacloud21 cesi]# pip3 install -r requirements.txt
    (venv) [root@datacloud21 cesi]# deactivate
    [root@datacloud21 ~]# cd ${CESI_SETUP_PATH}/cesi/ui
    [root@datacloud21 ui]# yarn install
    [root@datacloud21 ui]# yarn build
    
    #出现Successful,即成功。
    
    #创建日志文件目录
    mkdir -p /home/cesi/logs/
    
    #开始配置配置文件
    
    [root@datacloud21 ~]# cat /etc/cesi.conf.toml
    [cesi]
    database = "sqlite:///users.db" # Relative path
    activity_log = "/home/cesi/logs/activity.log" # File path for CeSI logs
    admin_username = "admin" # Username of admin user
    admin_password = "admin" # Password of admin user
    
    [[nodes]]
    name = "node1"  #节点名称,自定义
    environment = "TEST" #这个可以理解为进程分组
    username = "admin"  #远程主机supervisor的web主机帐号密码
    password = "admin"  #密码不支持特殊字符,如果web成功监听远程主机但是无法选中操作,原因大都基于此。
    host = "172.16.23.102"
    port = "9001"
    
    [[nodes]]
    name = "node2"
    environment = "TEST"
    username = "admin"
    password = "pass123"
    host = "172.16.23.241"
    port = "9001"
    
    [[nodes]]
    name = "node3"
    environment = "TEST"
    username = "admin"
    password = "admin"
    host = "172.16.23.205"
    port = "9001"
    
    [[nodes]]
    name = "Admin_web"
    environment = "Admin_web"
    username = "admin"
    password = "admin"
    host = "127.0.0.1"
    port = "9001"
    
    
    [[nodes]]
    name = "23.153"
    environment = "线上测试"
    username = "admin"
    password = "admin"
    host = "172.16.23.153"
    port = "9001"
    
    [[nodes]]
    name = "23.159"
    environment = "线上测试"
    username = "admin"
    password = "admin"
    host = "172.16.23.159"
    port = "9001"
    
    #配置CeSi启动方式
    [root@datacloud21 ~]# cp /home/cesi/defaults/cesi.service /etc/systemd/system/cesi.service
    
    [root@datacloud21 ~]# cat /etc/systemd/system/cesi.service
    
    [Unit]
    Description=cesi
    [Service]
    Environment=
    ExecStart=/home/cesi/cesi/run.py --config-file /etc/cesi.conf.toml
    ExecReload=/bin/kill -HUP $MAINPID
    KillSignal=TERM
    User=root
    WorkingDirectory=/home/cesi
    Restart=on-failure
    [Install]
    WantedBy=multi-user.target
    
    #启动
    systemctl daemon-reload
    systemctl start cesi
    

    三、Web访问

    浏览器访问 http://IP:5000

    Nodes
    Supervisor_CeSi

    以上

    相关文章

      网友评论

          本文标题:CeSi(Supervisor 守护进程集中管理工具)

          本文链接:https://www.haomeiwen.com/subject/rbtnuhtx.html