Tag: capistrano

日志在延迟作业的生产中不起作用

我遇到了一些奇怪的问题,我的delayed_jobs在生产中失败了。 最后,我把它缩小到记录器。 如果我注释掉我的日志函数调用,一切正常。 但是,如果我尝试登录,我会在delayed_job处理程序中得到这个: — !ruby/struct:Delayed::PerformableMethod object: AR:User:1 method: :load_and_update_without_send_later args: [] | closed stream /opt/ruby/lib/ruby/1.8/logger.rb:504:in `write’ /opt/ruby/lib/ruby/1.8/logger.rb:504:in `write’ /opt/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize’ /opt/ruby/lib/ruby/1.8/logger.rb:496:in `write’ /opt/ruby/lib/ruby/1.8/logger.rb:326:in `add’ /opt/ruby/lib/ruby/1.8/logger.rb:374:in `info’ /home/rails/myapp.com/releases/20100203203031/app/models/gmail.rb:35:in `log’ 我的记录器看起来像这样: @@error_log_file = File.open(“#{RAILS_ROOT}/log/error.log”, ‘a’) @@error_log_file.sync = true def log(msg) msg.each do |line| line = “#{Time.now.strftime(‘%H:%M:%S’)} #{line}” @@error_log_file.info(line) # this is line 35 where it’s failing […]

Rails控制台默认环境

在我的开发机器上: $ bundle exec rails console Loading development environment (Rails 3.2.3) 1.9.3p194 :001 > Rails.env => “development” 这是预料之中的。 到现在为止还挺好。 然而在我的生产服务器上(我使用Capistrano部署),我得到了完全相同的结果: $ bundle exec rails console Loading development environment (Rails 3.2.3) 1.9.3p194 :001 > Rails.env => “development” 在任何一台机器上,我都可以这样做: $ bundle exec rails console production Loading development environment (Rails 3.2.3) 1.9.3p194 :001 > Rails.env => “production” 我的问题是:在生产服务器上,不应该bundle […]

将JRuby on Rails应用程序部署到Tomcat的最佳方法是什么?

我正在研究如何将Ruby on Rails应用程序(在JRuby上运行)部署到Tomcat实例进行测试。 tomcat实例正在我可以SSH到的Solaris服务器上运行。 我已经看过使用Capistrano,但似乎没有太多关于使用它来部署到Tomcat,甚至在JRuby下运行它,并且由于Windows / JRuby环境我一直在Capistrano中遇到错误我的电脑正在运行(是的,这是公司 – 不是我的选择,但我必须忍受它)。 我正在使用warble来构建.war文件,一旦我手动复制并部署它,应用程序就会部署并运行正常。 我想要更简单,更自动化的东西来实现它。 以前做过这个的人吗? 网络上的文档似乎很薄。

部署与capistrano失败

我有一个像这样的capistrano require “bundler/capistrano” set :application, “cloudoc” set :repository, “git@github.com:luizkowalski/cloudoc.git” set :scm, :git role :web, “xx.xx.xx.xxx” role :app, “xx.xx.xx.xxx” role :db, “xx.xx.xx.xxx”, :primary => true default_run_options[:pty] = true ssh_options[:forward_agent] = true after “deploy:restart”, “deploy:cleanup” set :user, “deploy” set :use_sudo, true set :deploy_to, “/home/deploy” set :deploy_via, :remote_cache role :web, “xx.xx.xx.xxx” role :app, “xx.xx.xx.xxx” role :db, “xx.xx.xx.xxx”, :primary […]

Capistrano 3在目录中执行

我正在尝试为Capistrano 3编写一个涉及在当前版本目录中执行“composer install”的任务。 它看起来像这样: namespace :composer do desc ‘Install dependencies with Composer’ task :install do on roles(:web) do within release_path do execute “#{fetch(:composer_command)} install” end end end end composer_command在登台和生产文件中设置 – 在我的特定情况下设置为php /home/user/composer.phar 由于某种原因,此命令实际上并不在当前版本目录中运行,而是在父目录中运行(包含当前,共享,版本等) 我深入研究了这一点,发现当我运行单个单词命令时,如: within release_path do execute “pwd” end 它工作正常,并在当前版本目录中运行该命令。 但是……当我运行带空格的命令时,例如: within release_path do execute “pwd && ls” end 它在父目录中运行,而不是由within块设置的目录。 有人可以对此有所了解吗? 谢谢!

rails 4.1无法通过capistrano 3进行部署

使用capistrano部署我的rails应用程序时,我有一个非常奇怪的错误。 有时它是部署,有时不是。 例如,我向css添加一些东西(只有一个字符串),例如.my_some_class{width:10px} ,然后部署失败。 在我添加之前 – 它部署好了。 我确定没有其他任何改变因为我做了实验提交只包含一个css字符串。 我的配置: rails 4.1.0 ruby 2.1.1p76 gem ‘capistrano-rails’, group: :development gem ‘capistrano-rvm’, group: :development gem ‘capistrano-bundler’, group: :development 部署日志结束: Tasks: TOP => deploy:assets:precompile (See full trace by running task with –trace) The deploy has failed with an error: #<SSHKit::Command::Failed: rake exit status: 137 rake stdout: Nothing written rake […]

Capistrano 3改变任务中的ssh_options

我尝试使用不同的ssh_options在同一阶段运行capistrano v.3任务。 我的production.rb说: set :stage, :production set :user, ‘deploy’ set :ssh_options, { user: ‘deploy’ } 通过这种配置,capistrano与用户部署连接,这对于其余的用户来说是正确的。 但我需要在服务器中配置良好的an_other_user将其连接到一个特定任务。 然后我的食谱说: … tasks with original user … task :my_task_with_an_other_user do set :user, ‘an_other_user’ set :ssh_options, { user: ‘an_other_user’ } on roles(:all) do |host| execute :mkdir, ‘-p’, ‘mydir’ end end … other tasks with original user … 执行时: cap […]

为什么我收到此乘客错误无法在任何来源中找到rake-0.9.2.2?

我刚刚创建了一个新的空Rails应用程序,它几乎是空的。 我创建它只是为了试图找出问题,但我收到以下错误。 我正在使用Rails 3.1.0和Ruby 1.9.2 Error message: Could not find rake-0.9.2.2 in any of the sources (Bundler::GemNotFound) Exception class: PhusionPassenger::UnknownError 所以我将rake-0.9.2.2添加到Gemfile并运行bundle,我仍然收到相同的错误消息。 我不知道问题是什么,我甚至试图打开rails日志文件,但那里什么都没有。 我已经多次尝试以不同方式修复错误,但似乎没有任何工作。 我认为它也可能与资产管道有关。 添加细节 我试着打包gem,现在我得到了这个 bundle show mysql2 /releases/20111117205618/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.10 bundle show rails /releases/20111117205618/vendor/bundle/ruby/1.9.1/gems/rails-3.1.0 bundle show bundler /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21 注意bundler gem和其他gem之间的区别。

部署时“预热缓存”

我想知道是否有人有任何插件或capistrano配方,通过在部署时构建所有页面缓存的html或在部署发生之前本地“预热”rails应用程序的页面缓存。 我有一些大多数静态网站没有太大变化,如果已经编写了html,它会运行得更快,而不是要求一个访问者访问该网站。 而不是自己创建(似乎很容易,但它优先级低)它是否已经存在?