天道酬勤,学无止境

Use capifony to deploy to multiple production servers

I have managed to successfully deploy my Symfony2 application to a production web server, but cannot find any documentation on how to deploy to multiple servers with one deploy command. In fact, at this stage it seems that my only option is to have multiple checkouts with separate config files. Is this really the case?

标签

评论

You should take a look to http://capifony.org/

Update:

Here you can find a sample of how to set it up.

Deploying a Rails App to Multiple Servers using Capistrano - Best Practices

I meet this issue and found the solution from Capifony, please try it Capifony: deployment in clustered machines
You just prepare your servers, and setup with Capifony

cap HOSTS="machine1.domain, machine2.domain" deploy:setup

And after that, always use HOSTS variable for your deploy command:

cap HOSTS="machine1.domain, machine2.domain" deploy

or deploy multistage command:

cap HOSTS="machine1.domain, machine2.domain" stage_name deploy

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐
  • Deploying Symfony2 app with Capifony - APC loader still uses previous release
    I've recently upgraded my Symfony2 application to 2.1 and migrated it to a new server, so I figured I'd configure Capifony to make deploying simpler. Everything has gone great except for the fact that it now doesn't make use of the APCLoader, so I've had to comment this out temporarily until it's sorted. Here's the relevant code from app.php: $loader = require_once __DIR__.'/../app/bootstrap.php.cache'; // Use APC for autoloading to improve performance. // Change 'sf2' to a unique prefix in order to prevent cache key conflicts // with other applications also using APC. $loader = new
  • URI 的控制器不可调用,使用注解(The controller for URI is not callable, using annotations)
    问题 我有一个返回 500 的 symfony2 控制器,带有这个日志条目: [2014-03-26 01:25:48] request.INFO: Matched route "searchtempestsite_direct_sponsored" (parameters: "_controller": "SearchTempest\Bundle\SiteBundle\Controller\SearchController::DirectResultsSponsoredAction", "_route": "searchtempestsite_direct_sponsored") [] [] [2014-03-26 01:25:48] request.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The controller for URI "/search/direct/sponsored" is not callable." at [...]/releases/20140326082503/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php line 82 {
  • The controller for URI is not callable, using annotations
    I have a symfony2 controller that is returning 500, with this log entry: [2014-03-26 01:25:48] request.INFO: Matched route "searchtempestsite_direct_sponsored" (parameters: "_controller": "SearchTempest\Bundle\SiteBundle\Controller\SearchController::DirectResultsSponsoredAction", "_route": "searchtempestsite_direct_sponsored") [] [] [2014-03-26 01:25:48] request.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The controller for URI "/search/direct/sponsored" is not callable." at [...]/releases/20140326082503/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller
  • 使用 Capifony 部署 Symfony2 应用程序 - APC 加载程序仍然使用以前的版本(Deploying Symfony2 app with Capifony - APC loader still uses previous release)
    问题 我最近将我的 Symfony2 应用程序升级到 2.1 并将其迁移到新服务器,所以我想我会配置 Capifony 以简化部署。 一切都很顺利,除了它现在不使用 APCLoader,所以我不得不暂时注释掉它,直到它被排序。 这是app.php的相关代码: $loader = require_once __DIR__.'/../app/bootstrap.php.cache'; // Use APC for autoloading to improve performance. // Change 'sf2' to a unique prefix in order to prevent cache key conflicts // with other applications also using APC. $loader = new ApcClassLoader('my_prefix', $loader); $loader->register(true); 问题是'my_prefix'不是每个版本唯一的,因此它最终会尝试查找属于以前版本的缓存文件,这些文件可能仍然存在,也可能不存在。 这显然是一个非常大的问题! 什么是最好的解决方案? 我应该以某种方式编写一个 capifony 将在部署之前运行的任务,将前缀更改为唯一的内容,例如#{latest_release}变量?
  • cap deploy freezes at “Updating parameters” - Capifony
    by trying to deploy my Symfony 2 Project with Capifony it freezes everytime while "Updating parameters". With the following line: "Exception trace:" I don't have root access on my web-server, but ruby, cURL & composer are installed. Has anyone an idea?
  • cap deploy 在“更新参数”时冻结 - Capifony(cap deploy freezes at “Updating parameters” - Capifony)
    问题 通过尝试使用 Capifony 部署我的 Symfony 2 项目,它每次在“更新参数”时都会冻结。 使用以下行:“异常跟踪:” 我在我的网络服务器上没有 root 访问权限,但安装了 ruby​​、cURL 和 composer。 有人有想法吗?
  • Capifony 无法下载作曲家 - 不遵循重定向(Capifony can't download composer - not following redirect)
    问题 我正在使用 Capifony 部署我的 Symfony2 应用程序,但截至今天它无法下载 composer - jenkins 输出: [32m--> Downloading Composer[0m * executing "sh -c 'cd /data/www/testing/s00110/releases/20150426161117 && curl -s http://getcomposer.org/installer | php'" servers: ["*domain*"] [*domain*] executing command ** [out :: *domain*] <html> ** [out :: *domain*] <head><title>302 Found</title></head> ** [out :: *domain*] <body bgcolor="white"> ** [out :: *domain*] <center><h1>302 Found</h1></center> ** [out :: *domain*] <hr><center>nginx</center> ** [out :: *domain*] </body> ** [out :: *domain*] </html> command finished in 46ms
  • Multiple server deploy: asking ssh password for each server
    I'm setting up Capifony (Capistrano for symfony) but I've an issue with ssh password when testing multiple server deploy. Here some versions: daniel@fiji:~$ ruby --version ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux] daniel@fiji:~$ cap --version Capistrano v2.9.0 daniel@fiji:~$ uname -a Linux fiji 3.0.0-13-generic-pae #22-Ubuntu SMP Wed Nov 2 15:17:35 UTC 2011 i686 i686 i386 GNU/Linux And some configurations from deploy.rb: set :domain, "mydomain" ... set :user, "sshuser" set :password, "sshpassword" ... role :web, domain role :app, domain ... Deploying to a single server works great
  • Capifony can't download composer - not following redirect
    I'm using Capifony to deploy my Symfony2 application, but as of today it can't download composer - jenkins output: [32m--> Downloading Composer[0m * executing "sh -c 'cd /data/www/testing/s00110/releases/20150426161117 && curl -s http://getcomposer.org/installer | php'" servers: ["*domain*"] [*domain*] executing command ** [out :: *domain*] <html> ** [out :: *domain*] <head><title>302 Found</title></head> ** [out :: *domain*] <body bgcolor="white"> ** [out :: *domain*] <center><h1>302 Found</h1></center> ** [out :: *domain*] <hr><center>nginx</center> ** [out :: *domain*] </body> ** [out ::
  • Capifony and directory owners
    When I cap deploy my Symfony2 project, then log into my server I see that the the dev (app_dev.php) runs ok but the prod version (app.php) does not. The error is [Tue Jan 03 14:31:48 2012] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Failed to write cache file "/var/www/example/prod/releases/20120103202539/app/cache/prod/classes.php".' in /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache:1079\nStack trace:\n#0 /var/www/example/prod/releases/20120103202539/app/bootstrap.php.cache(1017): Symfony\\Component\\ClassLoader\
  • Problems with cap deploy a symfony2 project, can't find app/bootstrap.php.cache
    I'm trying (for the first time) to use capifony to deploy my site from my github repo. It runs right through to the setup phase and has this error: ** [out :: example.me] PHP Warning: require_once(/var/www/example/prod/releases/20111208212344/app/bootstrap.php.cache): failed to open stream: No such file or directory in /var/www/example/prod/releases/20111208212344/app/console on line 4 ** [out :: example.me] PHP Fatal error: require_once(): Failed opening required '/var/www/example/prod/releases/20111208212344/app/bootstrap.php.cache' (include_path='.:/usr/share/php:/usr/share/pear') in /var
  • Dump Symfony2 assets to Amazon S3
    I'd like to dump my assets to my s3 bucket in production, after deploying with capifony in Symfony 2. I've found some solution, but don't really find out the best to use. It's possible the dump the assets with Zend_Service_Amazon_S3 but I think it's a bit overkill to import the Zend framework only for this. - http://permalink.gmane.org/gmane.comp.php.symfony.symfony2/54 I've also found this: https://github.com/symfony/symfony/pull/108, where I can tell AsseticBundle the bucket name, but I didn't found where to provide the key and secret for my aws account. Can you point out a better solution
  • 如何使用gitlab ci将项目同时部署到i686和x86_64机器上?(how to use gitlab ci to deploy the project to i686 and x86_64 machine at the same time?)
    问题 我是一个使用 gitlab-CI 的新手,我的英语不是很好。 我想用gitlab ci分别将一个项目部署到i686、x86_64 linux机器上。 所以我可以在不同类型的linux centos上生成一个更新包。 现在我使用gitlab-server(192.168.1.240), gitlab runner (192.168.1.184) production server1(192.168.1.162) production server2(192.168.1.163); gitlab-server(240) --> runner(184) ^ ^ product_s1(162) product_s2(163) /etc/gitlab-runner/config.toml: concurrent = 1 [[runners]] url = "http://192.168.1.240/ci" token = "fb8b064e53e31159e268853af6f8ea" name = "production162" executor = "ssh" [runners.ssh] user = "root" host = "192.168.1.162" port = "22" identity_file = "/home/user/.ssh/id_rsa" [
  • 使用Capistrano将Rails应用程序部署到多个Web服务器(Using Capistrano to deploy a Rails application to multiple web servers)
    问题 我目前正在为Rails应用程序设置一个新的生产环境,其中包括多个负载平衡的应用程序服务器(目前只有两个,但是随着时间的推移会增加)。 我想使用Capistrano(我已经将其用于现有的单一服务器)在一个命令中处理将应用程序部署到所有这些服务器的情况。 我能看到的唯一方法是通过为每个应用程序服务器( app1 , app2等)定义一个新的“环境”,来使用capistrano-ext (实际上我已经将其用于部署到测试和登台环境)并使用以下方式执行部署: cap app1 app2 app3 deploy 这是推荐的方法还是有更好的方法? 回答1 是的。 Capistrano本机管理多个服务器。 无需capistrano分机。 您只需要定义多个角色 role :app, "myserver.example.com" role :db, "mysecondserver.example.com" 默认情况下,您的任务将在每台服务器上执行。 但是您可以将一项任务限制为仅一台或某些服务器。 task :migrate, :roles => [:app, :db] do # ... end 在这里,仅将在app和db角色上执行任务。 您可以使用run方法执行相同的操作。 run "rake db:migrate", :roles => :db 耙db:migrate将仅在db服务器上运行。
  • how to use gitlab ci to deploy the project to i686 and x86_64 machine at the same time?
    I am a Newbie using gitlab-CI and my english is not very good. I want to use gitlab ci to deploy one project to i686, x86_64 linux machine respectively. So I can generate an update package on different types linux centos. Now I use gitlab-server(192.168.1.240), gitlab runner (192.168.1.184) production server1(192.168.1.162) production server2(192.168.1.163); gitlab-server(240) --> runner(184) ^ ^ product_s1(162) product_s2(163) /etc/gitlab-runner/config.toml: concurrent = 1 [[runners]] url = "http://192.168.1.240/ci" token = "fb8b064e53e31159e268853af6f8ea" name = "production162" executor =
  • 用友和金蝶ERP产品私有云部署方案
    云社区 博客 博客详情 用友和金蝶ERP产品私有云部署方案 【摘要】 用友 金蝶 私有云 部署 架构图 用友和金蝶ERP产品私有云部署方案 一、 前言 此文档用于用友、金蝶ERP服务端在云环境下部署说明。用友产品包括U8+、U8Cloud、NC、NCCloud;金蝶产品包括K/3 WISE、K3 Cloud(云星空)、EAS、EASCloud。私有云环境是指阿里云、腾讯云、华为云等云服务商提供的云服务器,企业租赁使用,无需购买X86服务器并自建机房,降低前期投入成本。 U8+、K/3 WISE产品将逐步更替,软件形态过渡到云服务形态,云服务形态带来租用模式和买断模式,对于企业新购买产品或更替原U8+、K/3 WISE产品,建议购买U8Cloud、K3 Cloud云系列。租用模式不在本文讨论范围内,买断模式+私有云服务器部署是以下讨论重点。 二、 困境 据统计,ERP产品服务器宕机无法使用,或者前期服务器搭建性能够用,后期企业发展壮大,频繁更换服务器带来ERP系统重新部署,往往企业IT人员无从应对,只能请专业顾问,或购买原厂服务提供远程或现场支持。数据库I/O性能是系统瓶颈,数据安全是首要考虑因素。 软件供应商为解决企业难题,推出云服务ERP产品,由厂商提供服务器后台管控(企业租用模式)和企业购买云服务器托管(软件买断模式),将专业的部分交给供应商,为企业提供更优质的服务
  • Sidekiq部署到多个环境(Sidekiq deploy to multiple environments)
    问题 (有关我的详细配置,请参见下文,这是Henley Chiu的回答的结果)。 我一直在尝试着围绕Sidekiq部署部署我的大脑,但我并没有真正理解它。 我在同一台服务器上有一个具有暂存环境和生产环境的应用程序。 我看到的有关sidekiq部署的所有内容基本上都说“只需将sidekiq / capistrano添加到您的部署文件中即可”,所以我做到了。 然后说明是“这是一个带选项的yml文件”,但似乎什么也没解释。 我需要名称空间吗? 我在初始化文件中看到了这一点,但这似乎是指向服务器外部的。 我早些时候进行了部署,每个阶段似乎都在适当的环境下启动sidekiq,但是它们都在相同的队列中进行处理。 我的生产电子邮件试图由sidekiq阶段处理,但失败了。 我暂时停止了舞台,但最终我将需要再次使用它。 我希望我不要太笨拙,我确实已经试图理解这一点,并且很难找到一个确定的“这是怎么做的”。 对于它的价值,这里是config / sidekiq.yml(在部署过程中可以很好地加载): :concurrency: 5 :verbose: false :pidfile: ./tmp/pids/sidekiq.pid :logfile: ./log/sidekiq.log :queues: - [carrierwave, 7] - [client_emails, 5] - [default
  • Sidekiq deploy to multiple environments
    (See below for my detailed config, which is the result of Henley Chiu's answer). I've been trying to wrap my brain around Sidekiq deploys, and I am not really getting it. I have an app with a staging environment, and a production environment, on the same server. Everything I see about sidekiq deploys basically say "just add sidekiq/capistrano to your deploy file", so I did that. And then the instructions are "here's a yml file with options" but nothing seems to be explained. Do I need namespaces? I see that in an initialize file, but that seems to be to point outside the server. I deployed
  • 生产中的流浪者(Vagrant in production)
    问题 我一直在阅读有关 Vagrant 的文章,我发现它对我的开发非常有用。 我目前正在管理一系列服务(邮件、Web、LDAP、文件共享等),其中一个经常失败并需要快速备份。 是否可以(并推荐)将 Vagrant 用于这些目的? 到目前为止,我已经像真机一样安装了虚拟机。 我还想知道 Vagrant 的替代方案,它允许我设置一个简单的配置文件并放置一个虚拟机,例如,使用 Zimbra,并快速拥有一个备用邮件服务器,启用 RabbitMQ 等。 回答1 Vagrant 应该更像是一个临时环境来测试您的基础架构更改。 它应该是您自动化基础架构更改的测试平台。 我们在我公司使用它的方式是这样的: 在 Vagrant 中为我们的托管服务器创建 VM。 为每个服务器创建人偶定义。 为每台服务器创建黄瓜测试。 通过 puppet 更改基础设施并添加黄瓜测试。 启动我们的服务器以测试故障。 修复错误、发布和/或返回第 4 步。 基本上,当我们对我们的更改感到满意时,我们会将我们的人偶更改拉入生产环境以实现它。 我不建议使用 vagrant 来管理用于实际生产的虚拟机。 我会使用其他东西,比如 razor、virsh、OpenStack 或许多其他 vm 管理系统之一。 回答2 此页面表明 Vagrant push 命令用于部署到生产: https://www.hashicorp.com/blog
  • Deploy Content to Multiple Servers (EC2)
    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