问题标签 [fabric]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
620 浏览

deployment - 跨多个项目共享一个 fabfile

Fabric已成为我部署Django项目和初始配置 Ubuntu切片的首选部署工具。但是,我目前使用Fabric的工作流程不是很干燥,因为我发现自己:

  1. 将Djangofabfile.py项目从一个项目复制到另一个项目,然后
  2. 根据需要为每个项目修改fabfile.py(例如,将webserver_restart任务从 Apache 更改为 Nginx,配置主机和 SSH 端口等)。

此工作流程的一个优点是它fabfile.py成为我的Git存储库的一部分,因此在fabfile.pypip requirements.txt之间,我有一个可重新创建的virtualenv和部署过程。我想保持这种优势,同时变得更加DRY。看来我可以通过以下方式改进我的工作流程:

  1. 能够完成和pip install中定义的常见任务fabfile.py
  2. 拥有一个fab_config包含每个项目的主机配置信息的文件,并根据需要覆盖任何任务

关于如何增加我的Fabric工作流程的DRY ness 有什么建议吗?

0 投票
6 回答
3007 浏览

python - fabric and svn password

Assuming that I cannot run something like this with Fabric:

run("svn update --password 'password' .")

how's the proper way to pass to Fabric the password for the remote interactive command line?

The problem is that the repo is checked out as svn+ssh and I don't have a http/https/svn option

0 投票
2 回答
8817 浏览

python - Activate a python virtual environment using activate_this.py in a fabfile on Windows

I have a Fabric task that needs to access the settings of my Django project.

On Windows, I'm unable to install Fabric into the project's virtualenv (issues with Paramiko + pycrypto deps). However, I am able to install Fabric in my system-wide site-packages, no problem.

I have installed Django into the project's virtualenv and I am able to use all the "> python manage.py" commands easily when I activate the virtualenv with the "VIRTUALENV\Scripts\activate.bat" script.

I have a fabric tasks file (fabfile.py) in my project that provides tasks for setup, test, deploy, etc. Some of the tasks in my fabfile need to access the settings of my django project through "from django.conf import settings".

Since the only usable Fabric install I have is in my system-wide site-packages, I need to activate the virtualenv within my fabfile so django becomes available. To do this, I use the "activate_this" module of the project's virtualenv in order to have access to the project settings and such. Using "print sys.path" before and after I execute activate_this.py, I can tell the python path changes to point to the virtualenv for the project. However, I still cannot import django.conf.settings.

I have been able to successfully do this on *nix (Ubuntu and CentOS) and in Cygwin. Do you use this setup/workflow on Windows? If so Can you help me figure out why this wont work on Windows or provide any tips and tricks to get around this issue?

Thanks and Cheers.


REF:

Local development environment:

  • Python 2.5.4
  • Virtualenv 1.4.6
  • Fabric 0.9.0
  • Pip 0.6.1
  • Django 1.1.1
  • Windows XP (SP3)
0 投票
5 回答
5866 浏览

python - Python Fabric:如何处理任意远程 shell 提示符以进行输入?

这与此处的这个问题有关,但略有不同:我需要 Fabric 将任意字符串传递给远程 shell,而不是只传递“是”或“否”。

例如,如果远程 shell 提示“你叫什么名字?” 然后我需要先喂它,最后喂它。

澄清:我知道我说的是任意输入,但是当我尝试执行 git pull 时,我真的想将它用于 SSH 密钥 passwd 提示

更新 #1:得到 Jeff Forcier @bitprophet 的回复

0 投票
3 回答
1184 浏览

python - Python Fabric 错误

我正在运行结构(Django 部署到 apache),一切似乎都运行良好,直到我完成安装站点的任务:

我不断收到此错误:

我一遍又一遍地浏览了 fabfile.py ,我看不出为什么会出现错误……有什么想法吗?

0 投票
3 回答
3873 浏览

postgresql - 如何使用fabric创建postgresql用户

我想为我的设置结构脚本创建一个数据库用户,但 createuser 具有交互式密码输入功能,并且接缝不喜欢结构。

0 投票
2 回答
1039 浏览

python - 为什么 Fabric 显示与服务器断开连接消息将近 2 分钟?

Disconnecting from username@server... done.每当我发出 fab 命令时,Fabric会显示近 2 分钟,然后才会显示新的命令提示符。

使用向内部服务器和 Rackspace 云服务器发出的 Fabric 命令时存在此问题。下面我包含了来自服务器的 auth.log,但我在 MacBook 上的日志中没有看到任何内容。

关于问题是什么的任何想法?

服务器的 SSH auth.log 与 LogLevel VERBOSE

服务器配置

  • 操作系统:Ubuntu 9.10 和 Ubuntu 6.10(用这些操作系统测试了 4 台服务器)
  • OpenSSH:Ubuntu 软件包版本 1.5.1p1-6ubuntu2

客户端配置

  • 操作系统:Mac OS X 10.6.3
  • 面料版本 0.9
  • 虚拟环境 1.4.7
  • 点子版本 0.7

用于测试的简单 fabfile.py

即使我只是fab -H server_ip host_type使用以下 fabfile 运行,问题仍然存在。

关于问题原因的思考

我不确定这个问题持续了多长时间,但以下是自从我开始注意到使用 Fabric 断开服务器连接速度慢以来发生的一些变化。

  1. 我使用 virtualenv 1.4.7、virtualenvwrapper 2.1 和 pip 0.7 重新创建了我的 virtualenv。不确定这是否相关,但这是一个想法,因为我从 virtualenv 中运行我的 fabfile。
  2. 我启用了 OS X 的防火墙。我禁用了 OS X 的防火墙,问题仍然存在,所以这不是问题。
0 投票
1 回答
436 浏览

python - 部署脚本的存储位置

假设我有一个 Python 项目的以下目录结构:

config/ scripts/ src/

结构部署脚本应该放在哪里?显然,我认为它应该在脚本中,但对我来说,将启动项目的实际代码存储在脚本中似乎更合适。

0 投票
1 回答
532 浏览

deployment - 支持 sqlalchemy-migrate 部署的 Fabfile?

我的数据库迁移(使用 sqlalchemy-migrate)在我的开发环境中运行良好。但是,我对如何将其集成到我的部署过程中感到有些困惑。

我想使用fabric 在远程服务器上执行manage.py 文件,但我不确定该文件中的存储库值使用什么。引用 'appname/migrations' 和 '/usr/local/pylons/appname/env/lib/python2.6/site-packages/appname-05.egg/appname/migrations/' 都因 migrate.versioning 而失败。 exceptions.InvalidRepositoryError

有没有人有一个与 sqlalchemy-migrate 配合得很好的 fabfile 和 manage.py?

0 投票
2 回答
908 浏览

python - Python Web 项目剖析:开发、打包、部署

我是 Python 新手(来自 Java+Ant),想知道是否有人可以详细说明如何最好地使用 Fabric+Pip+Virtualenv 来设置 Python Web 应用程序包框架。

最终目标是能够使用单个命令执行以下任何操作:

  • 在一个新的开发箱上设置一个开发环境(安装所有的 deps)
  • 运行所有测试
  • 打包并部署到登台
  • 将登台部署到生产环境
  • 其他典型的开发流程任务:迁移模式等。

我正在使用 Debian+git+Tornado,但如果可能的话,我想保持这个 OS/SCM/框架不可知。

我已经进行了一些搜索,但我还没有找到从上到下涵盖此内容的明确内容。我会发现这很有帮助,我想还有其他一些前 Java/PHP/其他人也会这样做。

谢谢!