我按照说明设置了capifony.现在我在第4步中设置生产服务器.这是我的配置文件:
# deploy.rb
set :application, "MyFirm"
set :deploy_to, "/var/www/myfirm.com"
set :domain, "dev.myfirm.com"
set :scm, :gitrepoit
set :repository, "ssh://myfirm@94.147.25.115:/home/myfirm/myfirm.git"
set :user, "ec2-user"
set :domain, "ec2-46-137-123-97.eu-west-1.compute.amazonaws.com"
ssh_options[:keys] = [File.join("foo.key")]
role :web, domain
role :app, domain
role :db, domain, :primary => true
set :use_sudo, false
set :keep_releases, 3
Run Code Online (Sandbox Code Playgroud)
但是当我执行时cap deploy:setup
,虽然我在配置文件中设置了公钥,但它要求我输入密码......
* executing `deploy:setup'
* executing "mkdir -p /var/www/myfirm.com /var/www/myfirm.com/
releases /var/www/myfirm.com/shared /var/www/myfirm.com/shared/app/
logs /var/www/myfirm.com/shared/web/uploads"
servers: ["ec2-46-137-123-97.eu-west-1.compute.amazonaws.com"]
Password:
Run Code Online (Sandbox Code Playgroud)
任何的想法?
capifony 2.1.1
至少那个看起来像capistrano失败的地方.它一直贯穿整个部署并最终完成.这是输出.
* executing `deploy:create_symlink'
* executing "rm -f ~/xxx.xx.xx/test/current && ln -s ~/xxx.xx.xx/test/releases/20120525193307 ~/xxx.xx.xx/test/current"
servers: ["test.xxx.xx.xx"]
["test.xxx.xx.xx"] executing command
** [out :: test.xxx.xx.xx] rm: cannot remove `/var/www/vhosts/xxx.xx.xx/test/current': I command finished in 460ms
*** [deploy:create_symlink] rolling back
*** no previous release to rollback to, rollback of symlink skipped
* executing "rm -rf /var/www/vhosts/xxx.xx.xx/test/releases/20120525195909; true"
servers: ["test.xxx.xx.xx"]
[test.xxx.xx.xx] executing command
command finished in 524ms
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'default' -c 'rm -f /var/www/vhosts/xxx.xx.xx/test/current && ln -s /var/www/vhosts/xxx.xx.xx/test/releases/20120525195909 /var/www/vhosts/xxx.xx.xx/test/current'" on xxx.xx.xx
Run Code Online (Sandbox Code Playgroud)
该应用程序正在使用capistrano(2.12.0)capistrano-ext(1.2.1)显然有更多的宝石只是试图把看似相关的东西,请让我知道更多的信息会有所帮助.
这是deploy.rb
require …
Run Code Online (Sandbox Code Playgroud) 这是我的 deploy.rb
set :application, "admin"
set :repository, "here is my bitbucket repository"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :branch, "master"
set :rails_env, "production"
set :deploy_via, :copy
set :ssh_options, { forward_agent: true, port: 2020 }
set :keep_releases, 5
server "admin.mydomain.com", :app, :web, :db, primary: true
set :deploy_to "/var/www/vhosts/admin"
Run Code Online (Sandbox Code Playgroud)
我已经提到了两个用于配置capistrano的链接
当我跑 cap deploy:setup
我收到错误了
cap aborted!
cannot load such file -- deploy
/home/seting/Documents/site/admin/Capfile:1:in `load'
/home/seting/Documents/site/admin/Capfile:1:in `<top (required)>'
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.0/lib/capistrano/application.rb:22:in `load_rakefile' …
Run Code Online (Sandbox Code Playgroud) 出于某种原因,每当我将所有图像从所有用户中删除时,Capistrano都会删除我数据库中的所有图像.通常,我所做的是必须使用capistrano删除的相同图像重新填充数据库.我已经附上了我的deploy.rb文件,有人可以给我一些见解.
require "bundler/capistrano"
set :rvm_ruby_string, '1.9.3p429'
set :rvm_type, :user
set :user, ""
set :password, ""
set :domain, ""
set :applicationdir, ""
set :scm, :git
set :repository, ""
set :git_enable_submodules, 1 # if you have vendored rails
set :branch, "release"
set :rails_env, 'production'
#set :git_shallow_clone, 1
set :scm_verbose, true
# roles (servers)
role :web, domain
role :app, domain
role :db, domain, :primary => true
set :port, 22
# deploy config
set :deploy_to, applicationdir
set :deploy_via, :remote_cache
# additional settings
default_run_options[:pty] = …
Run Code Online (Sandbox Code Playgroud) 我试图用Capistrano 3创建Unicorn重启任务:
首先,我设置*unicorn_pid*变量:
set :unicorn_pid, "#{shared_path}/tmp/pids/unicorn.pid"
然后我将它传递给重启任务:
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :kill, "-USR2 `cat #{fetch(:unicorn_pid)}`" if test "[ -f #{fetch(:unicorn_pid)} ]"
within release_path do
execute :bundle, "exec unicorn -D -c config/unicorn.rb -E #{fetch(:stage)}"
end
end
end
Run Code Online (Sandbox Code Playgroud)
但是当我跑步时cap production deploy:restart
我看到:
DEBUG [f4159760] Running /usr/bin/env [ -f /var/www/shared/tmp/pids/unicorn.pid ] on dev.project.net
DEBUG [f4159760] Command: [ -f /var/www/shared/tmp/pids/unicorn.pid ]
Run Code Online (Sandbox Code Playgroud)
所以,而不是/home/user/project/shared/
路径,#{shared_path}转换为/var/www/shared/
但是当我直接在任务中指定这个路径时,没有unicorn_pid变量,我在输出中看到:
INFO [567856e3] Running /usr/bin/env kill -USR2 `cat …
Run Code Online (Sandbox Code Playgroud) 我跑的时候
cap production rvm1:install:ruby
Run Code Online (Sandbox Code Playgroud)
我在控制台输出结束时收到此错误:
Command: cd ~/apps/foo/releases/20140121133714 && ( PATH=/opt/ruby/bin:$PATH /usr/bin/env /tmp/foo/rvm-auto.sh rvm install . )
Run Code Online (Sandbox Code Playgroud)
无法确定使用哪个Ruby; .应包含.rvmrc或.versions.conf或.ruby-version或.rbfu-version或.rbenv-version,或Gemfile中的相应行.
帽子流产!
在.ruby-version
我的应用程序的根目录添加了一个我得到的内容
DEBUG [af3b80bc] Command: cd ~/apps/foo/releases/20140121160854 && /usr/bin/env /tmp/foo/rvm-auto.sh rvm install .
DEBUG [af3b80bc] ruby-2.0.0-p247 is not installed.
DEBUG [af3b80bc] To install do: 'rvm install ruby-2.0.0-p247'
DEBUG [af3b80bc] ruby-2.0.0-p247 is not installed.
DEBUG [af3b80bc] Searching for binary rubies, this might take some time.
DEBUG [af3b80bc] ruby-2.0.0-p247 is not installed.
DEBUG [af3b80bc] Searching for binary rubies, this might …
Run Code Online (Sandbox Code Playgroud) 在我们升级到Rails 4和Cap 3.1之前,以下任务正在进行
desc 'Restart application'
task :restart do
on roles(:web), in: :sequence, wait: 5 do
execute :touch, release_path.join('tmp/restart.txt')
end
end
Run Code Online (Sandbox Code Playgroud)
首先,我知道Cap 3.1没有隐式调用:重启,所以我添加了以下内容:
after :publishing, :restart
Run Code Online (Sandbox Code Playgroud)
但是,它尝试"触摸"restart.txt文件失败,以便Apache重新加载应用程序.
cap aborted!
touch stdout: Nothing written
touch stderr: Nothing written
config/deploy.rb:46:in `block (3 levels) in <top (required)>'
config/deploy.rb:45:in `block (2 levels) in <top (required)>'
Tasks: TOP => deploy:restart
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Command::Failed: touch stdout: Nothing written
touch stderr: Nothing written
> …
Run Code Online (Sandbox Code Playgroud) 我有一个在有乘客和apache的ubuntu 12服务器上运行的rails 3应用程序。我正在使用Capistrano部署我的应用程序,并设置了以下变量...
set :user, "deployer"
set :use_sudo, false
Run Code Online (Sandbox Code Playgroud)
如果deploy_to文件夹归部署者用户所有,则文件将被正确部署,但是乘客无法启动,因为它试图访问部署者用户所拥有的app文件夹中的文件。我尝试创建一个新组,并将www-data和deployer连同文件一起分配给该组,但是这没有用,乘客在启动时仍然超时。我还尝试将所有文件设置为不安全的文件,例如chmod 777,但仍然无法正常工作。我也尝试设置PassengerDefaultUser,但重启后也无济于事。但是,如果我将文件夹反复递归到www-data,它将启动,但是现在capistrano无法部署到该文件夹,因为它是www-data而不是部署者所有的。
是否有一个简单的解决方法可以在乘客端或Capistrano端进行此工作?我不确定www-data用户密码是什么,因此使用该用户进行部署不是一种选择。
我正在使用Capistrano 3与我的Rails应用程序进行部署.问题是,每次将应用程序部署到服务器时,都会重置./log/production.log文件.我听说可以将production.log文件放到共享文件夹中,并在每个部署中附加.
我认为这是由Capistrano默认制作但显然不适合我:(
有什么想法吗?
谢谢!
在部署Rails 3应用程序时,我们遇到以下错误.请帮助解决此问题.
$ cap deploy
triggering load callbacks
* 2015-03-17 19:25:22 executing `deploy'
* 2015-03-17 19:25:22 executing `deploy:update'
** transaction: start
* 2015-03-17 19:25:22 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@github.com:BoTreeConsultingTeam/IntegrityMatters.git master"
command finished in 3579ms
* executing "if [ -d /home/ubuntu/integrity_matters/shared/cached-copy ]; then cd /home/ubuntu/integrity_matters/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard eb49600f7de21f4b2b1de8884f70dd5a88837f41 && git clean -q -d -x -f; else git clone …
Run Code Online (Sandbox Code Playgroud) capistrano ×10
capistrano3 ×4
amazon-ec2 ×2
deployment ×1
paperclip ×1
passenger ×1
ruby ×1
rvm ×1
ssh-keys ×1
symfony ×1
ubuntu ×1
unicorn ×1