文档章节

1.fabric介绍与基础

eddy_linux
 eddy_linux
发布于 2017/09/20 12:04
字数 3937
阅读 29
收藏 0
Fabric is a Python (2.5-2.7) library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.
fabric是python(2.5-2.7)下的一个命令行工具,使用ssh作为基础的应用发布和系统管理。主要做为远程管理和批量管理

1.安装
/usr/local/python27/bin/pip install fabric

[root@web2 ~]# /usr/local/python27/bin/fab --help
Usage: fab [options] <command>[:arg1,arg2=val2,host=foo,hosts='h1;h2',...] ...

Options:
  -h, --help            show this help message and exit
  -d NAME, --display=NAME
                        print detailed info about command NAME
  -F FORMAT, --list-format=FORMAT
                        formats --list, choices: short, normal, nested
  -I, --initial-password-prompt
                        Force password prompt up-front
  --initial-sudo-password-prompt
                        Force sudo password prompt up-front
  -l, --list            print list of possible commands and exit
  --set=KEY=VALUE,...   comma separated KEY=VALUE pairs to set Fab env vars
  --shortlist           alias for -F short --list
  -V, --version         show program's version number and exit
  -a, --no_agent        don't use the running SSH agent
  -A, --forward-agent   forward local agent to remote end
  --abort-on-prompts    abort instead of prompting (for password, host, etc)
  -c PATH, --config=PATH
                        specify location of config file to use
  --colorize-errors     Color error output
  -D, --disable-known-hosts
                        do not load user known_hosts file
  -e, --eagerly-disconnect
                        disconnect from hosts as soon as possible
  -f PATH, --fabfile=PATH
                        python module file to import, e.g. '../other.py'
  -g HOST, --gateway=HOST
                        gateway host to connect through
  --gss-auth            Use GSS-API authentication
  --gss-deleg           Delegate GSS-API client credentials or not
  --gss-kex             Perform GSS-API Key Exchange and user authentication
  --hide=LEVELS         comma-separated list of output levels to hide
  -H HOSTS, --hosts=HOSTS
                        comma-separated list of hosts to operate on
  -i PATH               path to SSH private key file. May be repeated.
  -k, --no-keys         don't load private key files from ~/.ssh/
  --keepalive=N         enables a keepalive every N seconds
  --linewise            print line-by-line instead of byte-by-byte
  -n M, --connection-attempts=M
                        make M attempts to connect before giving up
  --no-pty              do not use pseudo-terminal in run/sudo
  -p PASSWORD, --password=PASSWORD
                        password for use with authentication and/or sudo
  -P, --parallel        default to parallel execution method
  --port=PORT           SSH connection port
  -r, --reject-unknown-hosts
                        reject unknown hosts
  --sudo-password=SUDO_PASSWORD
                        password for use with sudo only
  --system-known-hosts=SYSTEM_KNOWN_HOSTS
                        load system known_hosts file before reading user
                        known_hosts
  -R ROLES, --roles=ROLES
                        comma-separated list of roles to operate on
  -s SHELL, --shell=SHELL
                        specify a new shell, defaults to '/bin/bash -l -c'
  --show=LEVELS         comma-separated list of output levels to show
  --skip-bad-hosts      skip over hosts that can't be reached
  --skip-unknown-tasks  skip over unknown tasks
  --ssh-config-path=PATH
                        Path to SSH config file
  -t N, --timeout=N     set connection timeout to N seconds
  -T N, --command-timeout=N
                        set remote command timeout to N seconds
  -u USER, --user=USER  username to use when connecting to remote hosts
  -w, --warn-only       warn, instead of abort, when commands fail
  -x HOSTS, --exclude-hosts=HOSTS
                        comma-separated list of hosts to exclude
  -z INT, --pool-size=INT
                        number of concurrent processes to use in parallel mode

安装完毕之后会生成一个fab的指令用于运行fabric,这里会涉及到一个比较关键的文件fabfile.py
[root@web2 ~]# /usr/local/python27/bin/fab 

Fatal error: Couldn't find any fabfiles!

Remember that -f can be used to specify fabfile path, and use -h for help.

Aborting.

[root@web2 ~]# touch fabfiles.py
[root@web2 ~]# vim fabfiles.py 

#!/usr/local/python27/bin/python
#encoding:utf8

def hello():
    print "hello world"

运行稍微有区别,需要fab fabfile-function
[root@web2 ~]# /usr/local/python27/bin/fab -f /root/fabfiles.py hello
hello world

Done.
[root@web2 ~]# /usr/local/python27/bin/fab --fabfile=/root/fabfiles.py hello
hello world

Done.
可以使用-f或--fabfile选项进行fabfile文件的指定

[root@web2 ~]# /usr/local/python27/bin/fab -f /root/fabfiles.py -list
Available commands:

    hello
也可以使用-list来列出那些可以执行的函数(任务,模块)

通过基本实例来了解fabric
通过fabric在本地安装flask
[root@web2 ~]# /usr/local/python27/bin/fab -f /root/install_flask.py -list
Available commands:

    start_up
[root@web2 ~]# /usr/local/python27/bin/fab -f /root/install_flask.py start_up
[localhost] local: mkdir /tmp/static
[localhost] local: mkdir /tmp/templates
[localhost] local: /usr/local/python27/bin/pip install flask
Collecting flask
/usr/local/python27/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/python27/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
    100% |████████████████████████████████| 92kB 658kB/s 
Collecting itsdangerous>=0.21 (from flask)
  Downloading itsdangerous-0.24.tar.gz (46kB)
    100% |████████████████████████████████| 51kB 1.8MB/s 
Requirement already satisfied: Jinja2>=2.4 in /usr/local/python27/lib/python2.7/site-packages (from flask)
Collecting Werkzeug>=0.7 (from flask)
  Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
    100% |████████████████████████████████| 317kB 911kB/s 
Collecting click>=2.0 (from flask)
  Downloading click-6.7-py2.py3-none-any.whl (71kB)
    100% |████████████████████████████████| 71kB 1.4MB/s 
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/python27/lib/python2.7/site-packages (from Jinja2>=2.4->flask)
Installing collected packages: itsdangerous, Werkzeug, click, flask
  Running setup.py install for itsdangerous ... done
Successfully installed Werkzeug-0.12.2 click-6.7 flask-0.12.2 itsdangerous-0.24
[localhost] local: /usr/local/python27/bin/python app.py
/usr/local/python27/bin/python: can't open file 'app.py': [Errno 2] No such file or directory

Fatal error: local() encountered an error (return code 2) while executing '/usr/local/python27/bin/python app.py'

Aborting.
由于路径错误造成的报错,这边在写一个清理的函数(任务,模块)
完整版
[root@web2 ~]# cat install_flask.py
#!/usr/local/python27/bin/python
#encoding:utf8

from fabric.api import *

def start_up():
    # mkdir
    local('mkdir /tmp/static')
    local('mkdir /tmp/templates')

    # install flask
    local('/usr/local/python27/bin/pip install flask')

    # app.py
    tmpl = '''
from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return 'hello world'

if __name__ == '__main__':
    app.run()		
        '''
    with open('/tmp/app.py','w') as app_file:
        app_file.write(tmpl) 
    # start web
    local('/usr/local/python27/bin/python /tmp/app.py')

def clear_up():
    local('rm -rf /tmp/static /tmp/templates /tmp/app.py')
    local('/usr/local/python27/bin/pip uninstall flask')

这里有需要注意的是可以执行多个任务和函数,并且按照参数顺序依次执行
[root@web2 ~]# /usr/local/python27/bin/fab -f /root/fabfiles.py -list
Available commands:

    good
    hello
[root@web2 ~]# /usr/local/python27/bin/fab -f /root/fabfiles.py hello good
hello world!
i am good!

Done.
[root@web2 ~]# /usr/local/python27/bin/fab -f /root/fabfiles.py good hello
i am good!
hello world!

Done.


所以这里可以先执行清理在执行安装启动
[root@web2 ~]# /usr/local/python27/bin/fab -f /root/install_flask.py -list
Available commands:

    clear_up
    start_up
[root@web2 ~]# /usr/local/python27/bin/fab -f /root/install_flask.py clear_up start_up
[localhost] local: rm -rf /tmp/static /tmp/templates /tmp/app.py
[localhost] local: /usr/local/python27/bin/pip uninstall flask
Uninstalling Flask-0.12.2:
  /usr/local/python27/bin/flask
  /usr/local/python27/lib/python2.7/site-packages/Flask-0.12.2.dist-info/DESCRIPTION.rst
  /usr/local/python27/lib/python2.7/site-packages/Flask-0.12.2.dist-info/INSTALLER
  /usr/local/python27/lib/python2.7/site-packages/Flask-0.12.2.dist-info/LICENSE.txt
  /usr/local/python27/lib/python2.7/site-packages/Flask-0.12.2.dist-info/METADATA
  /usr/local/python27/lib/python2.7/site-packages/Flask-0.12.2.dist-info/RECORD
  /usr/local/python27/lib/python2.7/site-packages/Flask-0.12.2.dist-info/WHEEL
  /usr/local/python27/lib/python2.7/site-packages/Flask-0.12.2.dist-info/entry_points.txt
  /usr/local/python27/lib/python2.7/site-packages/Flask-0.12.2.dist-info/metadata.json
  /usr/local/python27/lib/python2.7/site-packages/Flask-0.12.2.dist-info/top_level.txt
  /usr/local/python27/lib/python2.7/site-packages/flask/__init__.py
  /usr/local/python27/lib/python2.7/site-packages/flask/__init__.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/__main__.py
  /usr/local/python27/lib/python2.7/site-packages/flask/__main__.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/_compat.py
  /usr/local/python27/lib/python2.7/site-packages/flask/_compat.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/app.py
  /usr/local/python27/lib/python2.7/site-packages/flask/app.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/blueprints.py
  /usr/local/python27/lib/python2.7/site-packages/flask/blueprints.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/cli.py
  /usr/local/python27/lib/python2.7/site-packages/flask/cli.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/config.py
  /usr/local/python27/lib/python2.7/site-packages/flask/config.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/ctx.py
  /usr/local/python27/lib/python2.7/site-packages/flask/ctx.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/debughelpers.py
  /usr/local/python27/lib/python2.7/site-packages/flask/debughelpers.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/ext/__init__.py
  /usr/local/python27/lib/python2.7/site-packages/flask/ext/__init__.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/exthook.py
  /usr/local/python27/lib/python2.7/site-packages/flask/exthook.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/globals.py
  /usr/local/python27/lib/python2.7/site-packages/flask/globals.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/helpers.py
  /usr/local/python27/lib/python2.7/site-packages/flask/helpers.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/json.py
  /usr/local/python27/lib/python2.7/site-packages/flask/json.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/logging.py
  /usr/local/python27/lib/python2.7/site-packages/flask/logging.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/sessions.py
  /usr/local/python27/lib/python2.7/site-packages/flask/sessions.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/signals.py
  /usr/local/python27/lib/python2.7/site-packages/flask/signals.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/templating.py
  /usr/local/python27/lib/python2.7/site-packages/flask/templating.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/testing.py
  /usr/local/python27/lib/python2.7/site-packages/flask/testing.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/views.py
  /usr/local/python27/lib/python2.7/site-packages/flask/views.pyc
  /usr/local/python27/lib/python2.7/site-packages/flask/wrappers.py
  /usr/local/python27/lib/python2.7/site-packages/flask/wrappers.pyc
Proceed (y/n)? y
  Successfully uninstalled Flask-0.12.2
[localhost] local: mkdir /tmp/static
[localhost] local: mkdir /tmp/templates
[localhost] local: /usr/local/python27/bin/pip install flask
Collecting flask
  Using cached Flask-0.12.2-py2.py3-none-any.whl
Requirement already satisfied: itsdangerous>=0.21 in /usr/local/python27/lib/python2.7/site-packages (from flask)
Requirement already satisfied: Jinja2>=2.4 in /usr/local/python27/lib/python2.7/site-packages (from flask)
Requirement already satisfied: Werkzeug>=0.7 in /usr/local/python27/lib/python2.7/site-packages (from flask)
Requirement already satisfied: click>=2.0 in /usr/local/python27/lib/python2.7/site-packages (from flask)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/python27/lib/python2.7/site-packages (from Jinja2>=2.4->flask)
Installing collected packages: flask
Successfully installed flask-0.12.2
[localhost] local: /usr/local/python27/bin/python /tmp/app.py
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

可以看到删除已经存在的目录和文件,已安装的flask之后重新创建目录文件和安装flask并启动成功


做到上面已经把安装flask的基本任务完成,下面就是要在那些目标机上执行此任务

先看结果
[root@web2 ~]# /usr/local/python27/bin/fab -f /root/install_flask.py  deploy
[192.168.222.132] Executing task 'deploy'
[192.168.222.132] sudo: mkdir /var/log/wwww
[192.168.222.132] Login password for 'eddy': 
[192.168.222.132] sudo: chmod 777 /var/log/wwww
[192.168.222.132] run: mkdir /var/log/wwww/html
[192.168.222.132] run: uptime
[192.168.222.132] out:  11:37:37 up 4 min,  2 users,  load average: 0.01, 0.05, 0.02
[192.168.222.132] out: 

[192.168.222.132] put: /tmp/app.py -> /var/log/wwww/html/app.py

Done.
Disconnecting from 192.168.222.132... done.
在132的服务器上执行一系列任务,并拷贝本机app.py文件到132服务器上
[root@localhost ~]# ll /var/log/wwww/
total 4
drwxrwxr-x 2 eddy eddy 4096 Sep 20 11:37 html
[root@localhost ~]# ll /var/log/wwww/html/
total 4
-rw-rw-r-- 1 eddy eddy 155 Sep 20 11:37 app.py


env.hosts = [
		'192.168.222.132'
		]
env.user = 'eddy'

def deploy():
   sudo('mkdir /var/log/wwww') 
   sudo('chmod 777 /var/log/wwww') 
   run('mkdir /var/log/wwww/html') 

   with cd('/var/log/wwww/html'):
       run('uptime')
       put('/tmp/app.py','app.py')

主要添加了以上内容
env.hosts定义了要执行操作的主机
env.user定义了要以那个用户进行任务
sudo()以sudo来执行
run在远端主机中以指定用户直接运行的指令
with cd()进入远端主机的目录
with lcd()进入本地主机的目录
put(local_file,remote_file)把本地文件推送到远端主机上
如果只定义了用户的话会在执行的时候提示输入密码

另外还有更简单的方式完成以上的任务,借助fabtools第三方包来帮助完成
[root@web2 ~]# /usr/local/python27/bin/pip install fabtools
[root@web2 ~]# vim install_flask2.py
#!/usr/local/python27/bin/python
#encoding:utf8

from fabric.api import *
from fabtools import require,nginx
from fabtools.python import virtualenv
env.hosts = [
                '192.168.222.132'
                ]
env.user = 'eddy'
def deploy():
   sudo('rm -rf /var/log/wwww')
   sudo('mkdir /var/log/wwww')
   sudo('chmod 777 /var/log/wwww')
   run('mkdir /var/log/wwww/html')

   with cd('/var/log/wwww/html'):
       run('virtualenv venv')
       put('/tmp/app.py','app.py')

       with virtualenv('venv'):
           require.python.package('flask')
           require.python.package('gunicorn')
           run('gunicorn -w 1 -b 0.0.0.0:8080 app:app')
可以看到fabtools提供很多做好了模块以方便我们使用
简要说明一下with virtualenv()激活虚拟环境,并在虚拟环境中安装相应软件包,已安装的话会自动跳过,

[root@web2 ~]# /usr/local/python27/bin/fab -f /root/install_flask2.py deploy
[192.168.222.132] Executing task 'deploy'
[192.168.222.132] sudo: rm -rf /var/log/wwww
[192.168.222.132] Login password for 'eddy': 
[192.168.222.132] sudo: mkdir /var/log/wwww
[192.168.222.132] sudo: chmod 777 /var/log/wwww
[192.168.222.132] run: mkdir /var/log/wwww/html
[192.168.222.132] run: virtualenv venv
[192.168.222.132] out: New python executable in /var/log/wwww/html/venv/bin/python
[192.168.222.132] out: Installing setuptools, pip, wheel...done.
[192.168.222.132] out: 

[192.168.222.132] put: /tmp/app.py -> /var/log/wwww/html/app.py
[192.168.222.132] run: pip install  flask
[192.168.222.132] out: DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
[192.168.222.132] out: Collecting flask
[192.168.222.132] out: /var/log/wwww/html/venv/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
[192.168.222.132] out:   SNIMissingWarning
[192.168.222.132] out: /var/log/wwww/html/venv/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
[192.168.222.132] out:   InsecurePlatformWarning
[192.168.222.132] out:   Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
[192.168.222.132] out: Collecting click>=2.0 (from flask)
[192.168.222.132] out:   Downloading click-6.7-py2.py3-none-any.whl (71kB)
[192.168.222.132] out: Collecting Jinja2>=2.4 (from flask)
[192.168.222.132] out:   Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB)
[192.168.222.132] out: Collecting Werkzeug>=0.7 (from flask)
[192.168.222.132] out:   Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
[192.168.222.132] out: Collecting itsdangerous>=0.21 (from flask)
[192.168.222.132] out:   Downloading itsdangerous-0.24.tar.gz (46kB)
[192.168.222.132] out: Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->flask)
[192.168.222.132] out:   Downloading MarkupSafe-1.0.tar.gz
[192.168.222.132] out: Building wheels for collected packages: itsdangerous, MarkupSafe
[192.168.222.132] out:   Running setup.py bdist_wheel for itsdangerous: started
[192.168.222.132] out:   Running setup.py bdist_wheel for itsdangerous: finished with status 'error'
[192.168.222.132] out:   Complete output from command /var/log/wwww/html/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4WEkeW/itsdangerous/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpY6wJWFpip-wheel- --python-tag cp26:
[192.168.222.132] out:   Traceback (most recent call last):
[192.168.222.132] out:     File "<string>", line 1, in <module>
[192.168.222.132] out:     File "/tmp/pip-build-4WEkeW/itsdangerous/setup.py", line 20, in <module>
[192.168.222.132] out:       'Programming Language :: Python :: 3',
[192.168.222.132] out:     File "/usr/lib64/python2.6/distutils/core.py", line 138, in setup
[192.168.222.132] out:       ok = dist.parse_command_line()
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/setuptools/dist.py", line 442, in parse_command_line
[192.168.222.132] out:       result = _Distribution.parse_command_line(self)
[192.168.222.132] out:     File "/usr/lib64/python2.6/distutils/dist.py", line 460, in parse_command_line
[192.168.222.132] out:       args = self._parse_command_opts(parser, args)
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/setuptools/dist.py", line 756, in _parse_command_opts
[192.168.222.132] out:       nargs = _Distribution._parse_command_opts(self, parser, args)
[192.168.222.132] out:     File "/usr/lib64/python2.6/distutils/dist.py", line 518, in _parse_command_opts
[192.168.222.132] out:       cmd_class = self.get_command_class(command)
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/setuptools/dist.py", line 576, in get_command_class
[192.168.222.132] out:       self.cmdclass[command] = cmdclass = ep.load()
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2405, in load
[192.168.222.132] out:       return self.resolve()
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2411, in resolve
[192.168.222.132] out:       module = __import__(self.module_name, fromlist=['__name__'], level=0)
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/wheel/bdist_wheel.py", line 407
[192.168.222.132] out:       ignore=lambda x, y: {'PKG-INFO', 'requires.txt', 'SOURCES.txt',
[192.168.222.132] out:                                      ^
[192.168.222.132] out:   SyntaxError: invalid syntax
[192.168.222.132] out:   
[192.168.222.132] out:   ----------------------------------------
[192.168.222.132] out:   Running setup.py clean for itsdangerous
[192.168.222.132] out:   Failed building wheel for itsdangerous
[192.168.222.132] out:   Running setup.py bdist_wheel for MarkupSafe: started
[192.168.222.132] out:   Running setup.py bdist_wheel for MarkupSafe: finished with status 'error'
[192.168.222.132] out:   Complete output from command /var/log/wwww/html/venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4WEkeW/MarkupSafe/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpbodHJ1pip-wheel- --python-tag cp26:
[192.168.222.132] out:   /tmp/pip-build-4WEkeW/MarkupSafe/setup.py:27: DeprecationWarning: Features are deprecated and will be removed in a future version. See https://github.com/pypa/setuptools/issues/65.
[192.168.222.132] out:     Extension('markupsafe._speedups', ['markupsafe/_speedups.c']),
[192.168.222.132] out:   /usr/lib64/python2.6/distutils/core.py:113: DeprecationWarning: Features are deprecated and will be removed in a future version. See https://github.com/pypa/setuptools/issues/65.
[192.168.222.132] out:     _setup_distribution = dist = klass(attrs)
[192.168.222.132] out:   Traceback (most recent call last):
[192.168.222.132] out:     File "<string>", line 1, in <module>
[192.168.222.132] out:     File "/tmp/pip-build-4WEkeW/MarkupSafe/setup.py", line 132, in <module>
[192.168.222.132] out:       try_building_extension()
[192.168.222.132] out:     File "/tmp/pip-build-4WEkeW/MarkupSafe/setup.py", line 111, in try_building_extension
[192.168.222.132] out:       run_setup(True)
[192.168.222.132] out:     File "/tmp/pip-build-4WEkeW/MarkupSafe/setup.py", line 105, in run_setup
[192.168.222.132] out:       features=features,
[192.168.222.132] out:     File "/usr/lib64/python2.6/distutils/core.py", line 138, in setup
[192.168.222.132] out:       ok = dist.parse_command_line()
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/setuptools/dist.py", line 442, in parse_command_line
[192.168.222.132] out:       result = _Distribution.parse_command_line(self)
[192.168.222.132] out:     File "/usr/lib64/python2.6/distutils/dist.py", line 460, in parse_command_line
[192.168.222.132] out:       args = self._parse_command_opts(parser, args)
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/setuptools/dist.py", line 756, in _parse_command_opts
[192.168.222.132] out:       nargs = _Distribution._parse_command_opts(self, parser, args)
[192.168.222.132] out:     File "/usr/lib64/python2.6/distutils/dist.py", line 518, in _parse_command_opts
[192.168.222.132] out:       cmd_class = self.get_command_class(command)
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/setuptools/dist.py", line 576, in get_command_class
[192.168.222.132] out:       self.cmdclass[command] = cmdclass = ep.load()
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2405, in load
[192.168.222.132] out:       return self.resolve()
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2411, in resolve
[192.168.222.132] out:       module = __import__(self.module_name, fromlist=['__name__'], level=0)
[192.168.222.132] out:     File "/var/log/wwww/html/venv/lib/python2.6/site-packages/wheel/bdist_wheel.py", line 407
[192.168.222.132] out:       ignore=lambda x, y: {'PKG-INFO', 'requires.txt', 'SOURCES.txt',
[192.168.222.132] out:                                      ^
[192.168.222.132] out:   SyntaxError: invalid syntax
[192.168.222.132] out:   
[192.168.222.132] out:   ----------------------------------------
[192.168.222.132] out:   Running setup.py clean for MarkupSafe
[192.168.222.132] out:   Failed building wheel for MarkupSafe
[192.168.222.132] out: Failed to build itsdangerous MarkupSafe
[192.168.222.132] out: Installing collected packages: click, MarkupSafe, Jinja2, Werkzeug, itsdangerous, flask
[192.168.222.132] out:   Running setup.py install for MarkupSafe: started
[192.168.222.132] out:     Running setup.py install for MarkupSafe: finished with status 'done'
[192.168.222.132] out:   Running setup.py install for itsdangerous: started
[192.168.222.132] out:     Running setup.py install for itsdangerous: finished with status 'done'
[192.168.222.132] out: Successfully installed Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 click-6.7 flask-0.12.2 itsdangerous-0.24
[192.168.222.132] out: 

[192.168.222.132] run: pip install  gunicorn
[192.168.222.132] out: DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
[192.168.222.132] out: Collecting gunicorn
[192.168.222.132] out: /var/log/wwww/html/venv/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
[192.168.222.132] out:   SNIMissingWarning
[192.168.222.132] out: /var/log/wwww/html/venv/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
[192.168.222.132] out:   InsecurePlatformWarning
[192.168.222.132] out:   Downloading gunicorn-19.7.1-py2.py3-none-any.whl (111kB)
[192.168.222.132] out: Installing collected packages: gunicorn
[192.168.222.132] out: Successfully installed gunicorn-19.7.1
[192.168.222.132] out: 

[192.168.222.132] run: gunicorn -w 1 -b 0.0.0.0:8080 app:app
[192.168.222.132] out: [2017-09-20 11:57:26 +0000] [3106] [INFO] Starting gunicorn 19.7.1
[192.168.222.132] out: [2017-09-20 11:57:26 +0000] [3106] [INFO] Listening at: http://0.0.0.0:8080 (3106)
[192.168.222.132] out: [2017-09-20 11:57:26 +0000] [3106] [INFO] Using worker: sync
[192.168.222.132] out: [2017-09-20 11:57:26 +0000] [3111] [INFO] Booting worker with pid: 3111

以上就是fabric基本使用方式,和一个第三方包fabtools的介绍











 

© 著作权归作者所有

共有 人打赏支持
上一篇: 2.fabric任务
eddy_linux
粉丝 22
博文 135
码字总数 188789
作品 0
成都
程序员
私信 提问
Hyperledger Fabric CA User’s Guide——CA用户指南(一)

Fabric CA用户指南 Hyperledger Fabric CA是一种用于Hyperledger Fabric的认证机构(CA)。 它提供了如下特性: 登记身份(注册ID),或者连接到作为用户注册表的LDAP(LDAP是轻量目录访问协议...

aberic
2018/02/05
0
0
阿里云Fabric单机部署详细步骤

1.Fabric官方提供了专门编译cryptogen的入口,只需要运行以下命令即可: cd ~/go/src/github.com/hyperledger/fabric make cryptogen 运行后系统返回结果: build/bin/cryptogen CGO_CFLAGS...

ly_2018
2018/10/06
0
0
【备忘】2017年最新整理python神经网络深度学习算法全套视频教程

2017年最新整理python神经网络深度学习算法全套视频教程 课程介绍: 此阶段主要介绍了Python语言为工具对每种算法进行结合实例讲解,并使用Python中相关的package来对实际问题进行数据预处理...

qq_38155396
2017/07/01
0
0
投票有礼 | 玩转 Linux,哪些技能会是您的必备之选?

随着 Linux 在服务器和嵌入式市场中的普及,接触 Linux 的人越来越多,从桌面到服务器、从 Ubuntu 到 Centos、从计算机到路由器等等。不管你是 Linux 的初学者,还是玩转高逼格命令行的高手,...

达尔文
2017/07/10
3.5K
25
iTween基础之Value(数值过度)

一、基础介绍;二、基础属性 原文地址:http://blog.csdn.net/dingkun520wy/article/details/50550527 一、基础介绍 Value有一个函数 ValueTo:返回一个“from”和“to”之间的插值,以调用“...

乐逍遥jun
2016/02/22
6
0

没有更多内容

加载失败,请刷新页面

加载更多

OSChina 周六乱弹 —— 我都想和他们组成一个家庭了

Osc乱弹歌单(2019)请戳(这里) 【今日歌曲】 @Sharon啊 :分享王菲的单曲《流年》有生之年狭路相逢终不能幸免,手心突然忽然长出纠缠的曲线。 《流年》- 王菲 手机党少年们想听歌,请使劲...

小小编辑
今天
293
12
CentOS7利用systemctl添加自定义系统服务

CentOS7的服务systemctl脚本存放在:/usr/lib/systemd/,有系统(system)和用户(user)之分,需要开机不登陆就能运行的程序,存在系统服务里,即:/usr/lib/systemd/system目录下. CentOS7的每...

linuxprobe16
今天
1
0
RabbitMQ入门

RabbitMQ是一个由erlang开发的基于AMQP(Advanced Message Queue)协议的开源实现。用于在分布式系统中存储转发消息,在易用性、扩展性、高可用性等方面都非常的优秀。是当前最主流的消息中间...

watermelon11
今天
19
0
今天的学习

自动加载:方法一 function __autoload( $className ){在这里,完成加载B这个类文件的工作。}class A{} //这是一个类$a1 = new A(); //这里没有自动加载的发生,因为A这个类...

墨冥
今天
4
0
印刷工艺步骤

印刷厂从收到订单到交付整个流程,一般涉及到以下步骤 1.设计(经过软件如cdr,psd,ai等等设计需要印刷的名片,宣传单,画册等物料); 2.排版拼版(在电脑软件这区域完成); 3.出版、出硫...

focusone
昨天
4
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部