cesi部署文档

安装cesi之前我们需要先安装Yarn(Apache Hadoop YARN (Yet Another Resource Negotiator,另一种资源协调者)是一种新的 Hadoop 资源管理器,它是一个通用资源管理系统,可为上层应用提供统一的资源管理和调度,它的引入为集群在利用率、资源统一管理和数据共享等方面带来了巨大好处.)

Yran 稳定版 (1.13.0)

On CentOS, Fedora and RHEL, you can install Yarn via our RPM package repository.

curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

If you do not already have Node.js installed, you should also configure the NodeSource repository:

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

Then you can simply:

sudo yum install yarn
## OR ##
sudo dnf install yarn

​ https://yarn.bootcss.com/docs/install/#centos-stable 对于yarn的安装,我也不懂,就是在这个网站照做的,我用的服务器是centos7。

部署cesi##

​ cesi的部署,我是在github上照着作者给的安装的,看着下面的傻瓜式安装https://github.com/Gamegos/cesi#manuel-instructions 百度到的好多教程都是原先版本的,安装不好,还是看着人家作者的安装吧。

Install Dependencies For Cesi Api

$ # On Ubuntu [18.04, 16.04, 14.04]
$ sudo apt install -y git python3 python3-pip
$ # On Centos 7
$ sudo yum install -y git epel-release
$ sudo yum install -y python34 python34-pip
$ # On Fedora 28
$ sudo dnf install -y git python3 python3-pip

Install Cesi

$ export CESI_SETUP_PATH=~/cesi
$ mkdir ${CESI_SETUP_PATH}
$ cd ${CESI_SETUP_PATH}

$ # Download the project to ~/cesi directory
$ wget https://github.com/gamegos/cesi/releases/download/v2.6.7/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

$ # Run with command line
(venv) $ python3 ${CESI_SETUP_PATH}/cesi/run.py --config-file ${CESI_SETUP_PATH}/defaults/cesi.conf.toml

Install Cesi as a service

$ # 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.6.7/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

Running Cesi with uWSGI

You may want to run Cesi using uWSGI (or any other WSGI deamon). Configure your system in the similiar way to running as a service and use uwsgi to start app. Check defaults/cesi-uwsgi.ini for details.

While running with uWSGI Cesi config host and port are ignored.

cesi的自启服务我没有使用这个uWSGI,也没有把它放在supervisor中,想着cesi本来就是集群化管理进程的,还把它放里面总有一种俄罗斯套娃的感觉的说。所以我添加了自启文件服务。

vim /etc/systemd/system/cesi.service

[Unit]
Description=cesi
[Service]
Environment=
ExecStart=/root/Envs/python3/bin/python3 /root/cesi/cesi/run.py --config-file /etc/cesi.conf.toml
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=TERM
User=root
WorkingDirectory=/root/cesi
Restart=on-failure
[Install]
WantedBy=multi-user.target

然后添加到服务中就好了。‘

这是针对centos7的,低于centos7版本请用其他的方式。

你可能感兴趣的:(cesi,python)