Capistrano 3不会设置rails_env并进行部署

时间:2018-09-29 09:57:45

标签: ruby-on-rails deployment capistrano capistrano3

Capfile

require "capistrano/setup"
require "capistrano/deploy"

require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

require 'capistrano/rails'
require 'capistrano/passenger'

require 'capistrano/rvm'
set :rvm_type, :user
set :rvm_ruby_version, '2.5.1'

Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

staging.rb

server 'IP', user: 'deploy', roles: %w{app db web}
set :deploy_to, '/home/deploy/project-name'
set :stage, :staging
set :rails_env, "staging"

deploy.rb

set :application, "project-name"
set :repo_url, "git@bitbucket.org:url"

append :linked_files, "config/database.yml", "config/secrets.yml"
append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "vendor/bundle", "public/system", "public/uploads"

以及

之后
cap staging deploy

网站给我这个错误:

'development' database is not configured. Available: ["staging"] (ActiveRecord::AdapterNotSpecified)

我正在尝试Internet上的研究问题,但没有结果,总是将应用设置为开发状态

1 个答案:

答案 0 :(得分:0)

我有OMG

rails_env development;

插入

rails_env staging;

在/ etc / nginx / sites-enabled / default文件中