Tag: capistrano

cap使用admin而不是ec2-user

我正在尝试为我的ROR网站做一个“封装ec2onrails:setup”到EC2实例(亚马逊图像),但无论我做什么,身份validation都会一直要求我输入密码。 我在这个和/或其他论坛上尝试了几乎所有我读过的东西: 将公钥从〜/ .ssh复制到ec2-user @_。sa-east-1.compute.amazonaws.com:/ home / ec2-user / .ssh / authorized_keys2(或authorized_keys) 使用Amazon Management Console生成私钥,然后将公钥从服务器复制到我的计算机 使用ssh-add -l添加任何这些键 使用ssh-keychain生成新密钥 使用我机器中已有的公钥/私钥组(id_rsa&id_rsa.pub) 按照上述^^约定命名键 chmod 400为〜/ .ssh中的键 将键移动到〜/ .ec2 设置像这里所述的环境变量 笔记: 使用ssh和AWS .pem密钥连接到服务器工作正常 我在“ssh_options”中设置“keys”值并不重要,Capistrano似乎总是忽略它。 但是,它不会忽略ssh-add -l中列出的键 以下是我尝试设置关键路径的方法 set :ssh_options, {:keys => [“/Users/dalef/.ssh/pk”]} 这是我最新测试的输出代码,使用详细输出 Damians-MacBook-Pro:test dalef$ cap ec2onrails:setup [Deprecation Warning] This API has changed, please hook `deploy:create_symlink` instead of `deploy:symlink`. […]

Capistrano清理任务有时会挂起

为什么capistrano清理任务有时会挂起,我该如何解决? 它就到了这一步,就坐在那里: * 2014-01-06 20:52:21 executing `deploy:cleanup’ * executing “sudo -p ‘sudo password: ‘ ls -1dt /var/www/jobfly/releases/* | tail -n +6 | sudo -p ‘sudo password: ‘ xargs rm -rf” 最奇怪的是,这种情况有时只会发生。 其他时候它执行得很好。 我将此作为deploy.rb中的最后一行: after “deploy:restart”, “deploy:cleanup” # leave the last 5 releases only

切换到Capistrano后,Passenger上的Rails应用程序上的Bundler :: GemfileError

我有一个使用Apache生产的Phusion Passenger运行的rails应用程序。 当我以前手动部署(通过SSH进入服务器并获取最新更新等)时,一切都有效,但我最近切换到Capistrano,让我的团队成员的生活更轻松。 现在,当我尝试访问该站点时,Passenger会抛出以下错误: Exception PhusionPassenger::UnknownError in PhusionPassenger::Rack::ApplicationSpawner (There was an error in your Gemfile, and Bundler cannot continue. (Bundler::GemfileError)) 如果我运行rails console bundle exec rails console production ,并运行app.get(‘/’) ,它会返回状态代码200.因此,只有当请求通过Passenger时才会抛出此GemfileError。 我总是使用rvm和我的每个rails应用程序使用gemsets,但是Capistrano现在将软件包安装在/var/www/mywebsite/shared/bundle 。 在我看来,像rvm和capistrano在处理gem的方式上存在冲突,但这并不能解释为什么它只会在这种环境中产生GemfileError。 乘客错误 错误信息: There was an error in your Gemfile, and Bundler cannot continue. (Bundler::GemfileError) 例外类: PhusionPassenger::UnknownError 应用程序根: /var/www/3eadmin/current 回溯 # File Line Location […]

资产管道在rails生产环境中不起作用

我在使用Rails部署到VPS时遇到问题。 我的应用程序在开发环境中运行良好,但是当我使用Capistrano进行生产时,我遇到了问题。 我使用的是独角兽,rails 3.2.13和ruby 1.9.3 我遇到的问题是当我访问我的生产网站时,我收到了“模板丢失”错误: Template is missing Missing template site/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :haml]}. Searched in: * “/home/deployer/apps/my-app/releases/20130417030832/app/views” * “/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/devise-2.2.3/app/views” * “/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/bundler/gems/piggybak_paypal-b892954868c7/app/views” * “/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/piggybak_variants-0.0.15/app/views” * “/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/piggybak-0.6.28/app/views” * “/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-b8465f738261/app/views” * “/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/kaminari-0.14.1/app/views” 所以,我认为这可能是资产预编译问题。 当我运行rake资产:在我的本地开发环境中进行预编译时,我遇到了问题: /Users/ac/.rvm/rubies/ruby-1.9.3-p392/bin/ruby /Users/ac/.rvm/gems/ruby-1.9.3-p392/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets [RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it. rake aborted! […]

Capistrano无法找到Gemfile或.bundle /目录?

我尝试在Ubuntu服务器上的rails应用程序中使用Capistrano ,并运行cap production deploy获得此消息: Could not locate Gemfile or .bundle/ directory 这是我的设置: lock ‘3.4.0’ `ssh-add` # need this to make key-forwarding work set :application, ‘beaconserver’ set :repo_url, ‘my git’ set :deploy_to, ‘/home/john/projects/beaconserver’ set :log_level, :debug set :keep_releases, 5 set :linked_files, %w(config/database.yml config/secrets.yml) set :linked_dirs, fetch(:linked_dirs, []).push(“bin”, “log”, “tmp/pids”, “tmp/cache”, “tmp/sockets”, “vendor/bundle”, “public/system”) # rbenv 的設定set […]

使用Passenger / Capistrano部署到Nginx服务器后未显示的图像

嗨我正在使用Capistrano将我的第一个Rails应用程序部署到Ubuntu 16服务器,除了图像没有在生产环境中显示外,一切都很顺利。 在生产服务器上,映像位于以下路径中: /myapp/current/public/assets 但是如果我在浏览器中看到这个,我的破碎图像链接给了我这个(见图片),这是标题图像的断开链接。 奇怪的是, /myapp/current/public/assets中有一个.svg文件,它在浏览器中完美显示,在下图中是显示的路径 这是我的Capfile # Load DSL and set up stages require “capistrano/setup” # Include default deployment tasks require “capistrano/deploy” set :rbenv_type, :user # or :system, depends on your rbenv setup set :rbenv_ruby, ‘2.3.1’ require ‘capistrano/rbenv’ require ‘capistrano/bundler’ require ‘capistrano/rails’ # Load custom tasks from `lib/capistrano/tasks` if you have any defined […]

生产中的will_paginate错误NoMethodError(的未定义方法`page’:ActiveRecord :: Relation):

我正在使用will_paginate gem进行类似ajax的“see-more”链接。 它在开发中工作但在生产中失败。 在我的生产日志中,我得到: NoMethodError (undefined method `page’ for []:ActiveRecord::Relation): 我试过,在生产应用程序的根目录中键入: grep will_paginate Gemfile.lock 得到: will_paginate (3.0.4) will_paginate cap bundle:安装不会在我的VPS上安装will_paginate失败,但是当我试图明确要求’will_paginate’时,钢铁在开发中工作并且在生产中失败,但这次是整个站点,不仅仅是我使用过的行动will_paginate。 这需要在unicorn.log中触发错误: No such file to load will_paginate (LoadError) 所以我认为will_paginate不会在我的VPS上正确安装他的目录和捆绑安装,但为什么呢? 我试着输入: gem list 那里没有will_paginate。 所以我明确地说,在我当前的应用程序目录中。 gem install will_paginate,但也没有解决问题。 所以我gem卸载will_paginate和“帽子部署”后我再次gem列表再次在那里没有will_paginate 的Gemfile: gem ‘rails’, ‘3.2.13’ gem ‘pg’ gem ‘will_paginate’ gem ‘sass-rails’ gem ‘jquery-rails’ gem ‘jquery-ui-rails’ gem ‘devise’ gem […]

Thin / Capistrano无法连接到数据库

我正在尝试设置我的Ruby on Rails应用程序以部署到Thin集群。 当我使用bundle exec thin start -C config/thin.yml在服务器上手动启动瘦集群时,一切正常。 但是当我通过Capistrano运行相同的命令时,它就会死掉并显示日志: /shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:45:in `resolve_hash_connection’: database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified) 我很茫然,我使用capistrano脚本中定义的相同用户帐户登录服务器。 我的capistrano瘦任务: namespace :deploy do task :start do run “cd #{current_path}; bundle exec thin start -C config/thin.yml” end task :stop do run “cd #{current_path}; bundle exec thin stop -C config/thin.yml” end task :restart do run “cd […]

在生产服务器(DigitalOcean)上的rails app中使用SMTP(mailgun)发送电子邮件的端口是什么?

我在使用capistrano和mailgun配置的数字海洋液滴中部署了一个rails应用程序,但我在发送电子邮件时遇到问题,我使用delayed_jobs执行任务。 事情是每次它尝试发送电子邮件我得到连接超时(使用RAILS_ENV=production bin/delayed_jobs run在服务器中RAILS_ENV=production bin/delayed_jobs runvalidation)我发现由于某种原因数字海洋不允许默认为您通过端口访问587(事实上,运行telnet smtp.mailgun.org 587需要很长时间才能访问)但显然可以通过2525端口(mailgun也支持该端口并运行telnet smtp.mailgun.org 2525即时连接!)。 但同样,它仍然给我连接超时,所以我有点困惑,不知道该怎么做。 我可能会向DO发票要求打开587端口,直到那时你有什么想法吗?

在Capistrano部署之后,Rails资产没有编译

我正在使用Capistrano部署我的Rails应用程序,似乎资产没有被编译,除非我进入服务器并运行RAILS_ENV=development bundle exec rake assets:precompile手动RAILS_ENV=development bundle exec rake assets:precompile 。 我已经尝试按照capistrano / rails github页面上的说明进行操作,但我不确定我是否错过了某些内容。 运行cap production deploy成功完成。 但我不知道如何检查assets:precompile任务是否实际运行。 运行cap production deploy:assets:precompile也成功完成,但服务器上没有明显变化。 版本 Server version: Apache/2.4.7 (Ubuntu) Phusion Passenger 5.0.22 ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux] Rails 4.2.5 capistrano (3.1.0) capistrano-bundler (1.1.4) capistrano-rails (1.1.6) capistrano-rbenv (2.0.4) Capfile require ‘capistrano/setup’ require ‘capistrano/deploy’ require ‘capistrano/rbenv’ require ‘capistrano/rails/assets’ Dir.glob(‘lib/capistrano/tasks/*.cap’).each […]