即时通讯使用capistrano 3.1.4,带capfile
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rvm'
require 'capistrano/rails'
require 'capistrano/rails/assets'
require 'capistrano/faster_assets'
require 'capistrano/rails/migrations'
Run Code Online (Sandbox Code Playgroud)
我设置我的宝石使用figaro和设计.当我ssh到框,并运行(与.bash_profile导出RAILS_ENV =生产)
bundle install # works fine
bundle exec rake db:migrate # works fine
Run Code Online (Sandbox Code Playgroud)
但是当我执行时:
cap production deploy:compile
Run Code Online (Sandbox Code Playgroud)
我得到错误说明没有设置设计密钥,是因为bash -login没有在服务器上运行?
** Invoke deploy:compile_assets (first_time)
** Invoke deploy:set_rails_env
** Execute deploy:compile_assets
** Invoke deploy:assets:precompile (first_time)
** Execute deploy:assets:precompile
DEBUG [05812cf9] Running /usr/bin/env if test ! -d /home/user1/rails/releases/20150507175646; then echo "Directory does not exist '/home/user1/rails/releases/20150507175646'" 1>&2; false; fi as user1@example.com
DEBUG [05812cf9] Command: if test ! …
Run Code Online (Sandbox Code Playgroud) 每当我使用RVM和Capistrano更新Ruby及其Gemlist时,如何更新Passenger使用的Ruby版本?检查我的应用程序是否使用正确的ruby版本和gemset的最佳方法是什么?
我有一个运行在Linode服务器(Ubuntu)上的Rails应用程序,使用NGinx和Passenger.在它运行之前没有任何问题.
以前我的应用程序使用Ruby 1.9.3-p194运行Ruby on Rails 3.2.16
我使用RVM来管理本地和服务器上的ruby版本.在我安装了Ruby-2.1.2并更新了基本的宝石(bundler,nokogiri等等)后,我为我的应用程序创建了我的新gemset.
在开发(本地)中,我使用Ruby 2.1.2,rails 3.1.19(在我升级到Rails 4之前),以及该项目的特定gemset.
我修改了我deploy.rb
的Capistrano,遵循RVM-Capistrano宝石集成
require "rvm/capistrano"
require "bundler/capistrano"
set :user, "myusername"
set :application, "myapp"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :scm, :git
set :repository, "git@github.com:myusername/#{application}.git"
set :branch, "master"
set :rvm_ruby_string, :local # use the same ruby as used locally for deployment
set :rvm_autolibs_flag, "read-only" # more info: rvm help autolibs
set :use_sudo, false
set :deploy_via, :remote_cache
set :keep_releases, 3
default_run_options[:pty] = true
set :ssh_options, { :forward_agent => true }
before …
Run Code Online (Sandbox Code Playgroud) 我正在按照这个片段在Capistrano中添加Sunspot Solr https://gist.github.com/doitian/1795439并且它有效,但是当我运行cap solr:reindex它显示一个问题(如预期的那样)询问我是否要删除所有索引,所以我回答"是",但终端似乎在等待响应.
这是reindex的代码:
desc "reindex the whole database"
task :reindex, :roles => :app do
stop
run "rm -rf #{shared_path}/solr/data"
start
run "cd #{current_path} && #{rake} RAILS_ENV=#{rails_env} sunspot:solr:reindex"
end
Run Code Online (Sandbox Code Playgroud)
这是消息:
* executing "cd /home/user/rapps/app/current && bundle exec rake RAILS_ENV=production sunspot:solr:reindex"
servers: ["9.9.9.9"]
[9.9.9.9] executing command
** [out :: 9.9.9.9] *Note: the reindex task will remove your current indexes and start from scratch.
** [out :: 9.9.9.9] If you have a large dataset, reindexing can take a very long …
Run Code Online (Sandbox Code Playgroud) capistrano ruby-on-rails sunspot sunspot-solr rvm-capistrano
获取github
的bitbucket
信息库.
无法建立主机'github.com(some_ip_address)'的真实性.
这是我的部署文件.deploy:setup
并且deploy:check
工作得很好.
require "bundler/capistrano"
require "rvm/capistrano"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :repository, 'ssh://git@bitbucket.org/username/repo.git'
set :scm :git
set :scm_verbose, true
set :user, 'root'
set :deploy_via, :remote_cache
set :migrate_target, :current
set :branch, 'master'
set :application, 'my_app_name'
set :domain, 'my_domain_ip_address'
set :applicationdir, "/home/deploy/domains/#{application}"
set :deploy_to, "/home/deploy/domains/#{application}"
role :web, domain role :app, domain role :db, domain, :primary => true
set :keep_releases, 5
set :rvm_type, :system
after 'deploy:restart', 'deploy:cleanup'
namespace :deploy do
task :start …
Run Code Online (Sandbox Code Playgroud) deployment capistrano ruby-on-rails bitbucket rvm-capistrano
的Gemfile:
gem 'capistrano', '~> 3.0.0'
gem 'capistrano-rails'
gem 'capistrano-bundler'
gem 'capistrano-rvm'
gem 'capistrano3-puma'
Run Code Online (Sandbox Code Playgroud)
Deploy.rb:
set :rvm_type, :user
set :rvm_ruby_version, '2.1.1'
set :default_env, { rvm_bin_path: '~/.rvm/bin' }
Run Code Online (Sandbox Code Playgroud)
Production.rb
namespace :rails do
desc "Open the rails console on primary app server"
task :console do
on roles(:app), primary: true do
execute_interactively "#{current_path}/script/rails console RAILS_ENV=production"
end
end
def execute_interactively(command)
cmd = "ssh -l deploy 255.255.255.255 -p 21 -t 'cd #{deploy_to}/current && #{command}'"
info "Connecting to 255.255.255.255"
exec cmd
end
end
Run Code Online (Sandbox Code Playgroud)
Capfile:
require 'capistrano/setup'
require …
Run Code Online (Sandbox Code Playgroud) 我目前正在我的Rails 3.2.13应用程序中设置capistrano.我收到以下错误/详细信息(包括"第1行第1列不允许使用控制字符").我已经做了一些搜索,但没有看到任何与我有关的事情.
我正在使用rvm-capistrano和ruby 2.0.0-p195.我最近将我的应用程序所需的环境变量移动到.bashrc中.
...
* 2013-06-10 15:18:32 executing `deploy:assets:update_asset_mtimes'
* executing "[ -e /home/deployer/apps/super_rad_app/shared/assets/manifest* ] && cat /home/deployer/apps/super_rad_app/shared/assets/manifest* || echo"
servers: ["107.20.249.163"]
[107.20.249.163] executing command
command finished in 6238ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/deployer/apps/super_rad_app/releases/20130610221258; true"
servers: ["107.20.249.163"]
[107.20.249.163] executing command
** [out :: 107.20.249.163] Using /home/deployer/.rvm/gems/ruby-2.0.0-p195
command finished in 6623ms
/home/nate/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): control characters are not allowed at line 1 column 1 (Psych::SyntaxError)
from /home/nate/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
from /home/nate/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:153:in `parse'
from /home/nate/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/psych.rb:129:in `load'
from /home/nate/.rvm/gems/ruby-2.0.0-p195/gems/capistrano-2.15.4/lib/capistrano/recipes/deploy/assets.rb:26:in …
Run Code Online (Sandbox Code Playgroud) 为了解决我的问题,在" 生产未定义方法'paginate'中的" will_paginate错误 "中讨论过,我尝试运行:
script/rails runner -e production
Run Code Online (Sandbox Code Playgroud)
和:
bundle exec script/rails runner -e production
Run Code Online (Sandbox Code Playgroud)
在服务器上像这个github问题中建议的那样:https://github.com/mislav/will_paginate/issues/308#issuecomment-17167158
但是我收到以下错误:
bundler: command not found: script/rails
Install missing gem executables with `bundle install`
Run Code Online (Sandbox Code Playgroud)
捆绑安装没有帮助.有什么建议?
我正在使用:Ruby 2.0.0p247,Rails 4.0.0,Ubuntu 12.10 LTS,Unicorn,Capistrano
我正在迁移几年前创建的Rails应用程序,并且很长时间没有将它部署到新服务器上.当时,我使用capistrano没有任何问题,现在,当我运行cap deploy时,我得到以下步骤失败:
* executing "ls -1 /home/deploy/mywebsite.com/shared/assets/.sprockets-manifest* | wc -l"
servers: ["45.79.142.32"]
[45.79.142.32] executing command
command finished in 727ms
* executing "ls /home/deploy/mywebsite.com/shared/assets/.sprockets-manifest*"
servers: ["45.79.142.32"]
[45.79.142.32] executing command
command finished in 783ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/deploy/mywebsite.com/releases/20150812101128; true"
servers: ["45.79.142.32"]
[45.79.142.32] executing command
command finished in 944ms
failed: "rvm_path=/home/deploy/.rvm /home/deploy/.rvm/bin/rvm-shell 'ruby-2.2.2' -c 'ls /home/deploy/mywebsite.com/shared/assets/.sprockets-manifest*'" on 45.79.142.32
Run Code Online (Sandbox Code Playgroud)
我在几个地方读到有关sprockets更改清单文件名或类型的信息(从.sprockets-manifest到.manifest或其他),但我不知道如何以不是黑客的方式解决它.我不确定这是否是由于使用旧的Rails版本或其他东西.这是我使用的版本:
capistrano ruby-on-rails ruby-on-rails-3 sprockets rvm-capistrano
我已经使用Capistrano 3部署了应用程序.我一直在跟踪错误.
`require': cannot load such file -- bundler/setup (LoadError)
Run Code Online (Sandbox Code Playgroud)
这是cron选项卡列表
PATH=/home/deploy/magnificent/shared/bundle/ruby/2.2.0/bin:/usr/local/rvm/gems/ruby-2.2.2/bin:/usr/local/rvm/gems/ruby-2.2.2@global/bin:/usr/local/rvm/rubies/ruby-2.2.2/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
* * * * * /bin/bash -l -c 'cd /home/deploy/magnificent/releases/20150830045359 && bin/rails runner -e production '\''Document.process_pending'\'' >> log/cron_standard.log 2>> log/cron_error.log'
Run Code Online (Sandbox Code Playgroud)
和schedule.rb
env :PATH, ENV['PATH']
set :output, { error: 'log/cron_error.log', standard: 'log/cron_standard.log'}
every 1.minutes do
runner 'Document.process_pending'
end
Run Code Online (Sandbox Code Playgroud)
请注意,所有宝石都安装在default
gemset中
我正在尝试使用Capistrano部署rails应用程序,但它失败了,因为没有清单文件.
这是我跑步时得到的cap production deploy
:
01 mkdir -p /home/deploy/list/releases/20171220202012/assets_manif…
? 01 influencerlist.io 0.048s
WARN Rails assets manifest file not found.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host influencerlist.io: Rails assets manifest file not found.
Caused by:
Capistrano::FileNotFound: Rails assets manifest file not found.
Tasks: TOP => deploy:assets:backup_manifest
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing on host influencerlist.io: Rails assets manifest file not …
Run Code Online (Sandbox Code Playgroud) rvm-capistrano ×10
capistrano ×8
capistrano3 ×2
bitbucket ×1
crontab ×1
deployment ×1
devise ×1
passenger ×1
ruby ×1
rvm ×1
sprockets ×1
sunspot ×1
sunspot-solr ×1
unicorn ×1
whenever ×1