简体   繁体   English

使用Git / Github进行部署

[英]Deploying with Git/Github

We are trying to setup an automated deployment environemt with Git/Github. 我们正在尝试使用Git / Github设置自动部署environemt。 We have 3 different environments; 我们有3种不同的环境; local, test and live. 本地,测试和生活。 When we add a new feature on local, we first upload files to test server to test the newly created feature. 当我们在本地添加新功能时,我们首先将文件上传到测试服务器以测试新创建的功能。 If everything is OK, we than upload all files to live server. 如果一切正常,我们将所有文件上传到实时服务器。 But this "uploading" process is not a perfect solution, as we sometimes forget to upload some files. 但是这个“上传”过程并不是一个完美的解决方案,因为我们有时会忘记上传一些文件。 Btw we also have mobile app on iPhone and Android, so mobile may be the fourth environment for us. 顺便说一下,我们在iPhone和Android上也有移动应用程序,因此移动设备可能是我们的第四个环境。

What we try to do is to setup an automated deployment environment. 我们尝试做的是设置自动部署环境。 When we commit a new feature to test server, after testing this new feature we want to push it to live server. 当我们提交一个新功能来测试服务器时,在测试这个新功能后,我们想将它推送到实时服务器。

There may be lots of commits on the test server but we want to push specific commits to live server. 测试服务器上可能有很多提交,但我们希望将特定提交推送到实时服务器。 We couldn't find how to cope with 3-4 environments and not to mess codes. 我们找不到如何应对3-4环境而不是乱码。 How will we push correct codes to live server? 我们如何将正确的代码推送到实时服务器? How will we manage our test and live servers? 我们如何管理我们的测试和实时服务器? Are there any good recources telling how to setup different environments and deployment processes with Git/Github? 是否有任何好的资源告诉如何使用Git / Github设置不同的环境和部署过程? Are there any articles to tell us what to do step-by-step? 是否有任何文章告诉我们一步一步做什么?

I've read those articles but none of them tell how to cope with local, test and live environments. 我读过这些文章,但没有一篇讲述如何应对本地,测试和现场环境。

EDIT 2012-03-09: I've found http://beanstalkapp.com/ and http://springloops.com and they both seem very good at deployment. 编辑2012-03-09:我找到了http://beanstalkapp.com/http://springloops.com ,他们似乎都非常善于部署。 I'm not sure if I can trust those services but they both do exactly what I want. 我不确定我是否可以信任这些服务,但他们都完全符合我的要求。 I will test both and share my results here to inform everyone. 我将测试两者并在此分享我的结果以通知所有人。

I've finally found what I was looking for. 我终于找到了我想要的东西。 http://beanstalkapp.com seems the best choice. http://beanstalkapp.com似乎是最好的选择。 It has automatic deployment feature and supports Git. 它具有自动部署功能,并支持Git。 After testing it for a week, I can say that it works very stable and fast. 经过一周的测试,我可以说它的工作非常稳定和快速。 Thanks everyone for helping me and trying to show me the way. 谢谢大家帮助我并试图向我展示道路。

It sounds like you need a Continuous Integration system. 听起来你需要一个持续集成系统。 I have had great success with both Jenkins and Webistrano . 我和Jenkins以及Webistrano都取得了巨大的成功。

With regard to the "what files should we copy?" 关于“我们应该复制哪些文件?” problem. 问题。 Are you using git tags yet? 你使用的是git标签吗? If not, start using them! 如果没有,请开始使用它们!

我最终创建了自己的基本部署工具,它会自动从repo中删除新的更新 - https://github.com/jesalg/SlimJim - 我不认为它会完全符合您的需求,但您可以阅读它是如何设置的也许你可能会从中获得一些想法。

Whether or not git is the right choice, is a good question. 无论git是否是正确的选择,都是一个很好的问题。

But if you're going to do it you should read through the gitworkflows manual page. 但是如果你要这样做,你应该阅读gitworkflows手册页。 Specifically, what it'll recommend and what sounds right given your problem above is that you need to put each separate "thing" to be developed into a topic/feature branch, and then merge that branch into the right tree when its done. 具体来说,根据上面的问题,它会推荐什么以及听起来正确的是你需要将每个单独的“东西”放到主题/功能分支中,然后在完成时将该分支合并到正确的树中。 That lets you separate out things so that you merge what is needed and stable and don't merge what isn't. 这可以让你分离出来,以便你合并所需要的和稳定的东西,而不是合并不需要的东西。

I'm currently using git in such a way and just posted a blog article about here . 我目前正在以这种方式使用git,只是发布了一篇关于这里的博客文章。

What I usually do is use a post-receive hook to look for commits pushed into a release branch, and when found deploys the codebase using the git archive command. 我通常做的是使用post-receive钩子来查找推送到发布分支的提交,并在找到时使用git archive命令部署代码库。

This is fine for small projects, if you have multiple developers working on a project or it's a large and complex codebase I do recommend the use of a Continuous Integration system like Jenkins as suggested in a previous comment. 这对于小型项目来说很好,如果你有多个开发人员在一个项目上工作,或者它是一个庞大而复杂的代码库,我建议使用Jenkins之类的持续集成系统,如之前的评论所示。

Have a look at this and see if it suits your needs (includes a simple bash deployment script) 看看这个并看看它是否适合您的需求(包括一个简单的bash部署脚本)

Cheers 干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在不下载git的情况下将Github Repo部署到Heroku - Deploying Github Repo to Heroku without downloading git GitHub 从其他存储库部署 git-pages 未按预期工作 - GitHub deploying git-pages from other repository not working as intended 新手到GIT - 从Github部署到Google Compute Engine / AWS - Newbie to GIT - deploying from Github to Google Compute Engine / AWS 将git分支及其子模块从Github部署到Heroku - Deploying a git branch together with its submodule from Github to Heroku 在带有孤儿git分支的github上使用nanoc部署静态网页构建时出错 - error deploying static webpage build with nanoc on github with orphan git branch 使用github部署时,未设置git_discovery_across_filesystem - Deploying with github, git_discovery_across_filesystem not set 使用git进行部署 - Deploying with git 将 Spring 应用程序部署到 Heroku 和 ZD3B7C923CB6FD04EBFECZ0EEC0E9 - Get “Cannot find git repository in any parent directory” when deploying Spring app to Heroku with GitHub 使用 GIT_USER= 在 GitHub 页面上部署 Docusaurus V2<github-username> 纱线部署打印“-bash:没有这样的文件” - Deploying Docusaurus V2 on GitHub Pages with GIT_USER=<github-username> yarn deploy prints “-bash: No such file” 部署到Heroku并绕过Github - Deploying to Heroku and Bypassing Github
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM