capistrano

Is there a better way to run a capistrano task from within rake?

江枫思渺然 提交于 2019-12-22 08:49:17
问题 I have a set of rake tasks where I need to invoke capistrano at some point. Edwin Goei's blog suggests shelling out to capistrano via "sh". Is there a simpler way? It would seem you should be able to call the appropriate tasks programmatically. Thanks in advance. 回答1: Yes, Capistrano has programmatic access to the command-line components. If you want to call them from a rake task, though, you need to do a little extra work. task :deploy require 'rubygems' require 'capistrano' require

Deployment using Capistrano + Gitlab using via: remote_cache

萝らか妹 提交于 2019-12-22 06:47:10
问题 I am using capistrano for the deployment of an PHP web application and we are having an internal gitlab server which is not accessible outside the network. I am trying to deploy using remote_cache as it is taking to much time if use it for copy. I have already checked This and This but not getting the desired result. I am trying the below code. set :default_stage, "staging" ssh_options[:forward_agent] = true server "servername", :app, :web, :db, :primary => true set :application, "appname"

Capistrano: deploy.rb file refactoring

三世轮回 提交于 2019-12-22 05:49:07
问题 I have following code in my deploy.rb namespace :app do desc "copies the configuration frile from ~/shared/config/*.yml to ~/config" task :copy_config_files,:roles => :app do run "cp -fv #{deploy_to}/shared/config/hoptoad.rb #{release_path}/config/initializers" run "cp -fv #{deploy_to}/shared/config/app_config.yml #{release_path}/config/app_config.yml" end end I thought it would be a good idea to keep my deploy.rb file clean and I attempted to move above code to capistrano_utilities.rb under

How to do a rolling restart of a cluster of mongrels

百般思念 提交于 2019-12-22 04:43:32
问题 Anybody know a nice way to restart a mongrel cluster via capistrano in a "rolling" style, eg, one mongrel at a time. Would be great to have a bit of wait time in there as well for each, to let the mongrel load the rails app up as well. I've done some searching, and haven't found too much, so looking for help before I dive into the mongrel_cluster gem myself. Thanks! 回答1: I agree with the seesaw approach more than the rolling approach you are seeking. The problem is that you end up in

Capistrano Deploy Wipes Database?

試著忘記壹切 提交于 2019-12-22 03:33:15
问题 I've managed to deploy my app to production using Capistrano, but I don't understand how to deal with my database. I'm using subversion and passenger. When I run cap deploy, the new deployment starts everything fresh. It wipes out the data that was added to the database. Obviously, there must be a solution, but I'm very surprised not to find anything online about how to deal with this. I've read the Capistrano documentation and many tutorials. The best I can find is the Advanced Rails recipes

undefined method `run' for main:Object

感情迁移 提交于 2019-12-22 01:38:11
问题 i'm getting the following output when deploying: cap aborted! NoMethodError: undefined method `run' for main:Object config/deploy.rb:37:in `block (2 levels) in <top (required)>' /var/lib/gems/1.9.1/gems/capistrano-3.2.1/lib/capistrano/dsl/task_enhancements.rb:12:in `block in after' /var/lib/gems/1.9.1/gems/capistrano-3.2.1/lib/capistrano/application.rb:15:in `run' /var/lib/gems/1.9.1/gems/capistrano-3.2.1/bin/cap:3:in `<top (required)>' Tasks: TOP => deploy:permissions (See full trace by

Rails Capistrano 3 - how to share production.log file into the shared folder of Capistrano?

╄→尐↘猪︶ㄣ 提交于 2019-12-21 23:26:06
问题 I'm using Capistrano 3 for deployment with my Rails app. The problem is that every time I deploy my app to the server the ./log/production.log file is reset. I've heard it's possible to have the production.log file into the shared folder and being appended at each deployment. I thought this was made by default by Capistrano but apparently not for me :( Any thoughts? Thanks! 回答1: In your config/deploy.rb you need a line similar to this: set :linked_dirs, %w{log public/system} This will tell

How can I get Capistrano to stop failing at deploy:create_symlink?

爷,独闯天下 提交于 2019-12-21 22:42:20
问题 At least that's where it looks like capistrano is failing. It makes it all the way through the deployment and at the end. here is the output. * executing `deploy:create_symlink' * executing "rm -f ~/xxx.xx.xx/test/current && ln -s ~/xxx.xx.xx/test/releases/20120525193307 ~/xxx.xx.xx/test/current" servers: ["test.xxx.xx.xx"] ["test.xxx.xx.xx"] executing command ** [out :: test.xxx.xx.xx] rm: cannot remove `/var/www/vhosts/xxx.xx.xx/test/current': I command finished in 460ms *** [deploy:create

Capistrano: HowTo deploy MySQL database for a PHP application?

荒凉一梦 提交于 2019-12-21 21:33:32
问题 I am developing a PHP based application and using Capistrano to deploy it to my webserver. Until now, I was not using Databases and hence, the deploy was running all fine. However, now I am trying to use a MySQL database as well with this application and was wondering, if there is a possibility of deploying database, as well on remote server with Capistrano - the way it is done for Rails' databases. Regards Nikhil Gupta 回答1: the whole magic of database deployment is a native functionality of

How to setup a server for deployment and to do a cold deploy with Capistrano?

百般思念 提交于 2019-12-21 20:22:00
问题 What is the proper way to deploy:setup and to do a cold deploy with Capistrano? Using this deploy.rb Capistrano v2.14.2 Vagrant to virtualize my server, this is my scenario: when running deploy:setup , Capistrano makes use of root privileges to prepare the directory structure for deployment: $ cap deploy:setup * 2013-02-28 14:50:21 executing `deploy:setup' * executing "sudo -p 'sudo password: ' mkdir -p /home/vagrant/example /home/vagrant/example/releases /home/vagrant/example/shared /home