我将不得不部署一些自定义的机器,这些机器大部分是手工安装的,这意味着:tarball下载并解压缩到一个目录中,python源码包安装在virtualenvs中,以及类似的东西(不,不能更改)。
主要的要求是从新鲜到部署都要快速和自动化,所以一旦有新机器,最好运行一个脚本来完成。
在我看来,这个东西是不容易使用标准木偶等工具部署。 我正在看织物,似乎更适合这种情况。 什么人使用/推荐?
我使用fabric来自动configuration服务器。 你可以很容易地写一些命令来设置nginx,supervisor,virtualenv等。我可以发布我的fabfile的一部分:
@task def setup_sys_installs(): """ Note ---- You can always use 'sudo apt-get build-dep <python-package>' to install some prerequisites for packages like gevent or lxml. """ print('=== SETUP LIBRARIES ====') sudo('apt-get -y update') sudo('apt-get -y install python-virtualenv python-pip python2.7 mercurial') # you need this to pip install any compilled library sudo('apt-get -y install python-dev build-essential') # you need this need this to pip install gevent sudo('apt-get -y install libevent-dev') # you need this need this to pip install psycopg2 sudo ("apt-get -y install libpq-dev") # you need this need this to pip install lxml sudo('apt-get -y install libxml2-dev libxslt-dev') # you need this need this to pip install m2crypto sudo('apt-get -y install swig') @task def sync_virtualenv(): with cd(env.PROJECT_DIR): cmd = "%s/bin/pip install -r requirements/production.txt" % (env.VENV,) sudo(cmd, user=env.VENV_USER) @task def setup_virtualenv(): print('=== SETUP VIRTUALENV ====') with cd(env.HOME): sudo("virtualenv -p /usr/bin/python2.7 venv", user=env.VENV_USER) sync_virtualenv()
给我一个评论,如果你对更多的细节感兴趣。
学习如何打包软件并创build自己的存储库。 这并不难,你不需要再创造一个自动部署的东西,但是可以简单地使用puppet从你自己的yum或者apt仓库中安装你的软件包。