2. deploy.rb anpassen
Jetzt öffnen Sie die soeben erstellte Datei deploy.rb aus dem Verzeichnis config
pico config/deploy.rb
Inhalt
set :application, "set your application name here"
set :repository, "set your repository location here"
# If you have previously been relying upon the code to start, stop
# and restart your mongrel application, or if you rely on the database
# migration code, please uncomment the lines you require below
# If you are deploying a rails app you probably need these:
# load 'ext/rails-database-migrations.rb'
# load 'ext/rails-shared-directories.rb'
# There are also new utility libaries shipped with the core these
# include the following, please see individual files for more
# documentation, or run `cap -vT` with the following lines commented
# out to see what they make available.
# load 'ext/spinner.rb' # Designed for use with script/spin
# load 'ext/passenger-mod-rails.rb' # Restart task for use with mod_rails
# load 'ext/web-disable-enable.rb' # Gives you web:disable and web:enable
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
# set :deploy_to, "/var/www/#{application}"
# If you aren't using Subversion to manage your source code, specify
# your SCM below:
# set :scm, :subversion
# see a full list by running "gem contents capistrano | grep 'scm/'"
role :web, "your web-server here"
Ersetzen Sie diese Datei bitte mit folgendem Inhalt oder laden Sie sich die Datei hier runter.
Beachten Sie bitte, dass diese deploy.rb für mod_rails vorgesehen ist.
set :application, "test"
set :repository, "/var/www/htdocs/webXX/files/repositories/git/test.git"
set :local_repository, "~/projekte/test/.git"
set :webserver, "railshosting.de"
set :deploy_to, "/var/www/htdocs/webXX/files/rails/#{application}"
set :symlink_path, "/var/www/htdocs/webXX/html/rails/#{application}"
set :scm, :git
set :user, "webXX"
ssh_options[:port] = 981
set :use_sudo, false
set :deploy_via, :remote_cache
role :app, webserver
role :web, webserver
role :db, webserver, :primary => true
# copy shared files after update
task :update_config, :roles => :app do
run "cp -Rf #{shared_path}/config/* #{release_path}/config/"
end
# create symlink after setup
task :symlink_config, :roles => :app do
run "mkdir -p /var/www/htdocs/#{user}/html/rails"
run "ln -nfs #{current_path}/public #{symlink_path}"
end
after "deploy:setup", :symlink_config
after "deploy:update_code", :update_config
# mod_rails (phusion_passenger) stuff
namespace :deploy do
desc "Restart Application"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{current_path}/tmp/restart.txt"
end
[:start, :stop].each do |t|
desc "start/stop is not necessary with mod_rails"
task t, :roles => :app do
# nothing
end
end
end
Nachdem Sie das Script für Ihren Account angepasst haben fügen Sie die beiden Dateien zu Ihrem Repository hinzu
git add Capfile config/deploy.rb git commit -m "added capistrano config"
Um das Release Ihrem remote server bekannt zu machen führen Sie einfach folgenden Befehl aus:
git push railshosting.de
|