Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 精简型/Capistrano无法连接到数据库_Ruby On Rails_Capistrano_Thin - Fatal编程技术网

Ruby on rails 精简型/Capistrano无法连接到数据库

Ruby on rails 精简型/Capistrano无法连接到数据库,ruby-on-rails,capistrano,thin,Ruby On Rails,Capistrano,Thin,我正在尝试将RubyonRails应用程序部署到瘦集群。当我使用bundle exec thin start-C config/thin.yml在服务器上手动启动精简集群时,一切正常。但是,当我通过Capistrano运行相同的命令时,它将消失,日志显示: /shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u specifi

我正在尝试将RubyonRails应用程序部署到瘦集群。当我使用
bundle exec thin start-C config/thin.yml
在服务器上手动启动精简集群时,一切正常。但是,当我通过Capistrano运行相同的命令时,它将消失,日志显示:

/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u specification.rb:45:在'resolve\u hash\u connection'中:数据库配置未指定适配器(activerecord::AdapterNotSpecified)

我不知所措,我使用capistrano脚本中定义的相同用户帐户登录到服务器

我的capistrano Thin任务:

  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 #{current_path}; bundle exec thin restart -C config/thin.yml"
    end
  end
这是我的thin.yml:

---
chdir: /var/www/rails/myapp/current
environment: staging
address: 0.0.0.0
port: 3000
timeout: 30
log: log/thin.log
pid: tmp/pids/thin.pid
max_conns: 1024
max_persistent_conns: 512
require: []
wait: 30
servers: 2
daemonize: true

任何帮助都将不胜感激

我需要在每个步骤上显式设置RAILS\u ENV

运行“cd#{current_path};RAILS _ENV=#{RAILS _ENV}bundle exec thin start-C config/thin.yml”

Capistrano似乎没有接受我们的环境变量

以下是相关帖子: