内容部署到多台服务器(EC2) [英] Deploy Content to Multiple Servers (EC2)

查看:221
本文介绍了内容部署到多台服务器(EC2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直工作在一个基于云的(AWS EC2)PHP的Web应用程序,我挣扎有一个问题,当谈到与多台服务器的工作(全部下AWS弹性负载均衡)。在一台服务器,当我上传了最新的文​​件,他们立即在整个应用程序的生产。你必须将文件上传到他们每个人,每次提交修改的时间 - 但这个当使用多台服务器是不正确的。这可能是工作好了,如果你不经常更新任何内容,或者,如果你只是有一个或两个服务器。但是,如果你更新系统多次在一个星期内,横跨十台服务器?

I’ve been working on a cloud based (AWS EC2 ) PHP Web Application, and I’m struggling with one issue when it comes to working with multiple servers (all under an AWS Elastic Load Balancer). On one server, when I upload the latest files, they’re instantly in production across the entire application. But this isn’t true when using multiple servers – you have to upload files to each of them, every time you commit a change. This could work alright if you don’t update anything very often, or if you just have one or two servers. But what if you update the system multiple times in one week, across ten servers?

我正在寻找一种方法来提交从我们的开发或测试服务器上的变化,并立即推出我们所有的生产服务器。理想情况下,更新将在一段时间(即使它只是需要一两秒钟每个服务器)应用到只有一个服务器,这样ELB不会发送流量给它,而文件正在发生变化,从而不破坏任何生产业务,可能是流向ELB。 什么是这样做的最好方法是什么?我的一个想法是使用SVN开发服务器上,但并没有真正推到服务器。我在寻找一个过程,只需要几秒钟就可以提交更新,并随后开始将其应用到服务器上。此外,对于那些你熟悉的AWS,有什么更新的AMI与最新的更新,以便自动定标器总是启动该软件的最新版本,新的情况下,最好的方法是什么?

What I’m looking for is a way to ‘commit’ changes from our dev or testing server and have it ‘pushed’ out to all of our production servers immediately. Ideally the update would be applied to only one server at a time (even though it just takes a second or two per server) so the ELB will not send traffic to it while files are changing so as not to disrupt any production traffic that may be flowing to the ELB . What is the best way of doing this? One of my thoughts would be to use SVN on the dev server, but that doesn’t really ‘push’ to the servers. I’m looking for a process that takes just a few seconds to commit an update and subsequently begin applying it to servers. Also, for those of you familiar with AWS , what’s the best way to update an AMI with the latest updates so the auto-scaler always launches new instances with the latest version of the software?

有必须这样做的很好的方式...... .can't真的图片网站如Facebook,谷歌,苹果,亚马逊,Twitter等经历和一个手动和一个更新数百台服务器或数千个当他们的变化。

There have to be good ways of doing this….can’t really picture sites like Facebook, Google, Apple, Amazon, Twitter, etc. going through and updating hundreds or thousands of servers manually and one by one when they make a change.

在此先感谢您的帮助。我希望我们能找到解决这个问题...。什么有至少100谷歌搜索以我自己和我在最后一天的贸易伙伴已被证明不成功的大部分解决这个问题。

Thanks in advance for your help. I’m hoping we can find some solution to this problem….what has to be at least 100 Google searches by both myself and my business partner over the last day have proven unsuccessful for the most part in solving this problem.

亚历

推荐答案

我们使用scalr.net来管理我们的Web服务器和负载平衡器的实例。它的工作pretty的很好,直到如今。我们有我们每个环境(2生产场,分期,沙箱)的服务器场。我们有一个Web服务器配置的pre角色,所以它的超级容易在需要的时候开启新的实例和规模。从GitHub的Web服务器拉code引导时。

We use scalr.net to manage our web servers and load balancer instances. It worked pretty well until now. we have a server farm for each of our environments (2 production farms, staging, sandbox). We have a pre configured roles for a web servers so it's super easy to open new instances and scale when needed. the web server pull code from github when it boots up.

我们还没有完成我们想要做的部署变化,但基本上在这里是我们如何部署新的版本为我们的生产环境:

We haven't completed all the deployment changes we want to do, but basically here's how we deploy new versions into our production environment:

  1. 我们使用phing来更新每个Web服务的源$ C ​​$ c和部署。我们创建了一个执行一个混帐拉和运行数据库的变化(dbdeploy phing任务)的任务。 http://www.phing.info/trac/
  2. 我们写了一个执行phing shell脚本,我们把它添加到scalr作为脚本。 Scalr有一个很好的界面来管理脚本。

  1. we use phing to update the source code and deployment on each web service. we created a task that execute a git pull and run database changes (dbdeploy phing task). http://www.phing.info/trac/
  2. we wrote a shell script that executes phing and we added it to scalr as a script. Scalr has a nice interface to manage scripts.

#!/bin/sh

cd /var/www
phing -f /var/www/build.xml -Denvironment=production deploy

  • scalr具有在特定场中的所有情况下,执行脚本的选项,所以每个版本中,我们只是推到主分支在github上并执行scalr脚本。

  • scalr has an option to execute scripts on all the instances in a specific farm, so each release we just push to the master branch in github and execute the scalr script.

    我们希望创建一个GitHub的钩子,当我们推到主分支自动部署。 Scalr有API,可以执行脚本,所以这是可能的。

    We want to create a github hook that deploys automatically when we push to the master branch. Scalr has api that can execute scripts, so it's possible.

    这篇关于内容部署到多台服务器(EC2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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