Aru*_*run 1 ruby capistrano ruby-on-rails nginx ruby-on-rails-4
我在尝试将 Rails 应用程序部署到生产环境时看到此错误
SSHKit::Runner::ExecuteError: Exception while executing on host xxx.xxx.xxx.xx: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
NoMethodError: undefined method `fetch' for "QLite version 3.x":String
Run Code Online (Sandbox Code Playgroud)
这个错误是由 th 命令调用的
Command: cd /home/deploy/myapp/releases/20140616034148 && ( RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec rake assets:precompile )
Run Code Online (Sandbox Code Playgroud)
文件
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rails'
require 'capistrano/rvm'
set :rvm_ruby_version, '2.1.2'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
Run Code Online (Sandbox Code Playgroud)
部署文件
lock '3.1.0'
set :application, 'myapp'
set :repo_url, 'git@bitbucket.org:username/myapp.git'
set :deploy_to, '/home/deploy/myapp'
set :branch, "master"
set :linked_files, %w{config/database.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
execute :touch, release_path.join('tmp/restart.txt')
end
end
Run Code Online (Sandbox Code Playgroud)
生产.rb
set :stage, :production
role :app, %w{deploy@xxx.xxx.xxx.xx}
role :web, %w{deploy@xxx.xxx.xxx.xx}
role :db, %w{deploy@xxx.xxx.xxx.xx}
set :password, ask('Server password', nil)
server '107.170.187.98', user: 'deploy', password: fetch(:password), roles: %w{web app}
set :bundle_env_variables, { 'NOKOGIRI_USE_SYSTEM_LIBRARIES' => 1 }
Run Code Online (Sandbox Code Playgroud)
我不明白是什么导致了这个问题。有人可以指出我正确的方向。
检查您在生产服务器上设置的 config/database.yml 文件。它的第一行可能是“QLite version 3.x”——这是因为它曾经是“#SQLite version 3.x”,但最初的“#S”已经不见了。
要解决此问题,只需将“# S”重新添加到它的前面,或者完全删除该行。完成此操作后,您的 Capistrano 部署应该会再次开始工作。
我猜你把你的 config/database.yml 文件从别处粘贴到 Vim 实例中了;出于完全相同的原因,我遇到了与您完全相同的问题。如果在粘贴之前没有将 Vim 置于插入模式,它将粘贴整个内容,但会从前面删除“#S”。
之所以特别删除这三个字母,是因为这些字母实际上是 Vim 命令。如果您未处于插入模式,则在粘贴某些内容时,这些命令将运行。这三个字符粘贴后,依次执行以下操作:
来源:http : //vimdoc.sourceforge.net/htmldoc/
归档时间: |
|
查看次数: |
2591 次 |
最近记录: |