如何部署高度迭代的更新

发布于 2024-08-18 09:06:54 字数 927 浏览 4 评论 0原文

我有一组二进制资源(swf 文件),每个大小约为 150Kb。我正在我的家用计算机上本地开发它们,并且我想定期部署它们以供审查。我当前的策略是:

  1. 将 .swf 复制到传输目录中,该目录也是 hg (mercurial) 存储库。
  2. hg Push 将我的 slicehost VPN 的更改
  3. ssh 推送到我的 slicehost VPN 上
    • cd 到我的传输目录并hg up
    • su wwwcp 将更改后的文件放入我的公共文件夹中以供查看。

我想自动化这个过程。最好的情况接近于:

  1. 将 .swf 复制到“快速部署”目录中
  2. 运行单个本地脚本来执行上述所有操作。

我感兴趣的是:

  • 关于在哪里放置密码的建议,因为我需要 su www 将文件传输到公共 Web 目录中。
  • 如何处理本地机器和服务器之间的责任划分。

我认为使用 rsync 是比 hg 更好的工具,因为我实际上不需要这些类型的更改的修订历史记录。我可以将其编写为 python 脚本、shell 脚本,或者被认为是最佳实践。

最终我想将其构建成一个可以满足我适度的部署需求的系统。也许有一个开源部署系统可以处理这种情况和其他类型的情况?我可能会自己推出以满足当前的需求,但从长远来看,我想要相对灵活的东西。

注意:我的家用开发计算机是 OS X,目标服务器是 Ubuntu 的一些最新版本。我更喜欢基于 python 的解决方案,但如果最好从 shell 处理它,那么以这种方式将其组合在一起就没有问题。

I have a set of binary assets (swf files) each about 150Kb in size. I am developing them locally on my home computer and I want to periodically deploy them for review. My current strategy is:

  1. Copy the .swf's into a transfer directory that is also a hg (mercurial) repo.
  2. hg push the changes to my slicehost VPN
  3. ssh onto my slicehost VPN
    • cd to my transfer directory and hg up
    • su www and cp the changed files into my public folder for viewing.

I would like to automate the process. Best case scenario is something close to:

  1. Copy the .swf's into a "quick deploy" directory
  2. Run a single local script to do all of the above.

I am interested in:

  • advice on where to put passwords since I need to su www to transfer files into the public web directories.
  • how the division of responsibility between local machine and server is handled.

I think using rsync is a better tool than hg since I don't really need a revision history of these types of changes. I can write this as a python script, a shell script or however is considered a best practice.

Eventually I would like to build this into a system that can handle my modest deployment needs. Perhaps there is an open-source deployment system that handles this and other types of situations? I'll probably roll-my-own for this current need but long term I'd like something relatively flexible.

Note: My home development computer is OS X and the target server is some recent flavour of Ubuntu. I'd prefer a python based solution but if this is best handled from the shell I have no problems putting it together that way.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放赐 2024-08-25 09:06:54

为了避免 su www 我看到两个简单的选择。

  • 在 Web 服务器能够提供服务的某个路径中,使一个文件夹对您可写,并可由 www 组读取,然后您可以从本地计算机上的某个位置 rsync 到该文件夹​​。

  • 将您的公共 ssh 密钥放入 www 的authorized_keys 中,并 rsync 到 www 用户(在某些设置中安全性可能会降低一些,但不多,而且通常更方便)。

通过将您或其密码放入某个文件中来解决 su www 似乎不太安全。

调用“rsync -avz --partial /some/path www@server:some/other/path”的脚本应该可以快速用Python编写(尽管我不太擅长Python)。

to avoid su www I see two easy choices.

  • make a folder writable to you and readable by www's group in some path that the web-server will be able to serve, then you can rsync to that folder from somewhere on your local machine.

  • put your public ssh key in www's authorized_keys and rsync to the www user (a bit less security in some setups perhaps, but not much, and usually more convenient).

working around su www by putting your or its password in some file would seem far less secure.

A script to invoke "rsync -avz --partial /some/path www@server:some/other/path" should be quick to write in python (although I do not python well).

向地狱狂奔 2024-08-25 09:06:54

如果您对 Python 非常熟悉,我建议您使用 Fabric 来实现自动部署脚本。

除了组权限或 ssh-ing 作为 www(使用基于密钥的身份验证)之外,权限问题的第三种解决方案是将您的用户添加到 /etc/sudoers 并使用 sudo (您可以指定您的用户的确切命令)允许使用 sudo,因此可以将安全影响降到最低)。

If you're at all comfortable in Python, I recommend Fabric for automated deployment scripts.

In addition to group permissions or ssh-ing as www (with key-based auth), a third solution to the permissions issue would be to add your user to /etc/sudoers and use sudo (you can specify the exact command your user is allowed to use sudo for, so you can make the security implications minimal).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文