从git部署到生产的最佳解决方案? [英] Best solutions to deploy from git to production?

查看:137
本文介绍了从git部署到生产的最佳解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的共同创始人和我正在为我们的创业者设置我们的服务器。我们使用git进行源代码控制,该项目是通过Ubuntu上的fcgi坐在nginx后面的django。由于我们刚刚开始使用,并且在我们两个方面使部署变得容易,所以我想起了在服务器上安装一个简单的部署脚本,它将自动从git中引入最新的代码更改,然后部署它们。



我知道我可以手动写一个bash或python脚本,这样做,但我希望首先找出是否有其他相对容易使用的软件解决方案我可以绑在一起在这个阶段,我们对持续部署没有什么兴趣,但是我认为该域中可能有一些可能对我们有用的软件包。

解决方案

有几个选项:


  1. 在服务器上托管git仓库,推送到自动检出最新版本。 有关此处的更多信息,请查看这个分离的git树解决方案。


  2. 使用类似面料 rsync 或类似。


通常,我将有一个内联git repo与特定分支(通常为live)的更新后挂接设置。那么这是一个关于我的笔记本电脑上的一个 git remote add -t live live ssh:// ... 的问题,一个 git push live 来推动事情。您还需要重新启动Django服务器才能使新代码生效(可以在挂钩或ssh / fabric中执行此操作)。



对于未来的项目,我正在尝试使用分离的git树(似乎更优雅)结合织物。


My cofounder and I are setting up our server for our startup. We're using git for our source control and the project is django sitting behind nginx via fcgi on Ubuntu. Since we're just getting started, and to make deployments easy on both of us, I have in mind to have a simple deploy script living on the server that will automatically pull in the latest code changes from git and then deploy them.

I know I can manually write a bash or python script that will do this, but I was hoping to first find out if there are other relatively easy to use software solutions that I can just tie into. At this stage, we have little interest in continuous deploy yet but I'm thinking there might be some packages in that domain that could be useful to us.

解决方案

There's a couple of options:

  1. Hosting a git repository on the server to push to, which automagically checks out the latest version. More on this here, also check out this detached git tree solution, too.

  2. Use something like fabric with rsync or similar.

Typically I would have an inline git repo with the post-update hook setup for a specific branch (usually "live"). Then it's a matter of git remote add -t live live ssh://... on my laptop and a git push live to get things pushed. You'll also need something to restart the Django server for the new code to take effect (could do this inside the hook, or ssh/fabric).

For future projects, I'm experimenting with the detached git tree (seems more elegant) combined with fabric.

这篇关于从git部署到生产的最佳解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆