2011-05-16 10 views
4

私のサーバーと開発マシンの間で自動展開を行うためにCapistranoで遊んでいました。私はCapistranoがbundle execコマンドを使ってサーバを起動できないように見えることを除いて、ほとんど設定しました。私はいつも、次のエラーを受信して​​います:Capistranoを薄いサーバーで展開

EDIT:configファイルを今だけ関連性の最後のセクションをコピーし/var/www/apps/current/thin.ymlで

 
... 
    * executing "sudo -p 'sudo password: ' bundle exec thin start -C /var/www/thin.config.yml" 
    servers: ["85.255.206.157"] 
    [85.255.206.157] executing command 
** [out :: 85.255.206.157] Could not locate Gemfile 
    command finished in 216ms 
failed: "sh -c 'sudo -p '\\''sudo password: '\\'' bundle exec thin start -C /var/www/thin.config.yml'" on 85.255.206.157 

を常駐します。ファイルのコピー全体などは正常に動作します。失敗していると思われるクラスタを開始するだけです。

EDIT:ファイルには、次のように変更されました:

require "bundler/capistrano" 

# define the application and Version Control settings 
set :application, "ESCO Matching Demo" 
set :repository, "svn://192.168.33.70/RubyOnRails/ESCO" 
set :deploy_via, :copy 

# Set the login credentials for Capistrano 
set :user, "kurt" 

# Tell Capistrano where to deploy 
set :deploy_to, "/var/www/apps" 

# Tell Capistrano the servers it can play with 
server "85.255.206.157", :app, :web, :db, :primary => true 

# Generate an additional task to fire up the thin clusters 
namespace :deploy do 
    desc "Start the Thin processes" 
    task :start do 
    sudo "bundle exec thin start -C thin.yml" 
    end 

    desc "Stop the Thin processes" 
    task :stop do 
    sudo "bundle exec thin stop -C thin.yml" 
    end 

    desc "Restart the Thin processes" 
    task :restart do 
    sudo "bundle exec thin restart -C thin.yml" 
    end 

    desc "Create a symlink from the public/cvs folder to the shared/system/cvs folder" 
    task :update_cv_assets, :except => {:no_release => true} do 
    run "ln -s #{shared_path}/cvs #{latest_release}/public/cvs" 
    end 
end 

# Define all the tasks that need to be running manually after Capistrano is finished. 
after "deploy:finalize_update", "deploy:update_cv_assets" 
after "deploy", "deploy:migrate" 

EDIT:これは私のthin.ymlファイルです

ここ はすべてカピストラーノのものを扱う私のdeploy.rbファイルです
--- 
pid: tmp/pids/thin.pid 
address: 0.0.0.0 
timeout: 30 
wait: 30 
port: 4000 
log: log/thin.log 
max_conns: 1024 
require: [] 

environment: production 
max_persistent_conns: 512 
server: 4 
daemonize: true 
chdir: /var/www/apps/current 

EDIT: 次のような問題が発生している今:

最後のステップに私のシステムからキャップdeployコマンドを実行しているとき、私はGemFileエラーを見つけることができません受けてい
  1. :移行が行われていない

  2. サーバのブート

  3. 私ができます」もはや手動でクラスタを起動するように見える。シンのインスタンスが1つだけ起動しています。

UPDATE:ここに は私が展開していますサーバーから宝石のenvの設定です。この情報は、キャップシェルを使用し、次にコマンドを実行することによって得られる。

 
==================================================================== 
Welcome to the interactive Capistrano shell! This is an experimental 
feature, and is liable to change in future releases. Type 'help' for 
a summary of how to use the shell. 
-------------------------------------------------------------------- 
cap> echo $PATH 
[establishing connection(s) to 85.255.206.157] 
Password: 
** [out :: 85.255.206.157] /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games 
cap> gem env 
** [out :: 85.255.206.157] RubyGems Environment: 
** [out :: 85.255.206.157] - RUBYGEMS VERSION: 1.3.6 
** [out :: 85.255.206.157] - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux] 
** [out :: 85.255.206.157] - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8 
** [out :: 85.255.206.157] - RUBY EXECUTABLE: /usr/bin/ruby1.8 
** [out :: 85.255.206.157] - EXECUTABLE DIRECTORY: /usr/bin 
** [out :: 85.255.206.157] - RUBYGEMS PLATFORMS: 
** [out :: 85.255.206.157] - ruby 
** [out :: 85.255.206.157] - x86_64-linux 
** [out :: 85.255.206.157] - GEM PATHS: 
** [out :: 85.255.206.157] - /usr/lib/ruby/gems/1.8 
** [out :: 85.255.206.157] - /home/kurt/.gem/ruby/1.8 
** [out :: 85.255.206.157] - GEM CONFIGURATION: 
** [out :: 85.255.206.157] - :update_sources => true 
** [out :: 85.255.206.157] - :verbose => true 
** [out :: 85.255.206.157] - :benchmark => false 
** [out :: 85.255.206.157] - :backtrace => false 
** [out :: 85.255.206.157] - :bulk_threshold => 1000 
** [out :: 85.255.206.157] - REMOTE SOURCES: 
** [out :: 85.255.206.157] - http://rubygems.org/ 

答えて

10

が最後にenvironemntサーバとうまく再生するバンドルアプリケーションを得るために まず...問題を解決し、以下のスクリプトは、それがやっていることになって何が行われます。

require "bundler/capistrano" 
default_run_options[:pty] = true 

# define the application and Version Control settings 
set :application, "ESCO Matching Demo" 
set :repository, "svn://192.168.33.70/RubyOnRails/ESCO" 
set :deploy_via, :copy 
set :user, "kurt" 
set :deploy_to, "/var/www/apps" 

# Tell Capistrano the servers it can play with 

server "85.255.206.157", :app, :web, :db, :primary => true 

# Generate an additional task to fire up the thin clusters 
namespace :deploy do 
    desc "Start the Thin processes" 
    task :start do 
    run <<-CMD 
     cd /var/www/apps/current; bundle exec thin start -C config/thin.yml 
    CMD 
    end 

    desc "Stop the Thin processes" 
    task :stop do 
    run <<-CMD 
     cd /var/www/apps/current; bundle exec thin stop -C config/thin.yml 
    CMD 
    end 

    desc "Restart the Thin processes" 
    task :restart do 
    run <<-CMD 
     cd /var/www/apps/current; bundle exec thin restart -C config/thin.yml 
    CMD 
    end 

    desc "Create a symlink from the public/cvs folder to the shared/system/cvs folder" 
    task :update_cv_assets, :except => {:no_release => true} do 
    run <<-CMD 
     ln -s /var/www/shared/cvs /var/www/apps/current/public 
    CMD 
    end 
end 

# Define all the tasks that need to be running manually after Capistrano is finished. 
after "deploy:finalize_update", "deploy:update_cv_assets" 
after "deploy", "deploy:migrate" 

このスクリプトは、移動することができます必要な配備構造にうまく行き渡り、Thinプロセスを制御するために必要なコマンドを実行します。 問題は、sudoとして実行してもcdコマンドが実行されなかったことです。これの背後にある理由は、cvがシェル内にのみ存在し、sudoの既知のコマンドではないということです。

第2の問題は、薄い構成でした。 thin.ymlに小さなタイプがあったので、シンサーバは起動できませんでした。以下のスクリプトは、ポート4000〜4003で動作する4つのシン・サーバーのクラスタを起動します。これらの変数の

--- 
pid: tmp/pids/thin.pid 
address: 0.0.0.0 
timeout: 30 
wait: 30 
port: 4000 
log: log/thin.log 
max_conns: 1024 
require: [] 

environment: production 
max_persistent_conns: 512 
servers: 4 
daemonize: true 
chdir: /var/www/apps/current 
+4

は、多分それは大丈夫だ、同じ問題が発生している-C薄いです.yml " – Shtirlic

+0

は次のプロジェクトでスピンを与えて、コマンドをより読みやすくするかもしれません。 –

-2

マン、GEM_HOMEであるか、またはGEM_PATHが指している場所を見つけます。それでなければならない。

+0

どれも変数定義されているシステム –

+0

上で定義されていないが、それでもこれだけ 'ラン「のCD#{CURRENT_PATH}のように行う&& execの薄い開始をバンドル –

関連する問題