Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============================================================================
- # TASKS
- # =============================================================================
- # Define tasks that run on all (or only some) of the machines. You can specify
- # a role (or set of roles) that each task should be executed on. You can also
- # narrow the set of servers to a subset of a role by specifying options, which
- # must match the options given for the servers to select (like :primary => true)
- desc "Mongrel deployment - stops server, backs up sqlite db, updates code from svn, copies db back, migrates, starts mongrel"
- task :deploy_me, :roles => :app do
- stop
- #backup_db
- update_code
- symlink
- migrate
- start
- end
- task :import_data do
- run "cd #{deploy_to}/#{current_dir} && rake RAILS_ENV='production' db:import"
- end
- task :layout do
- run "svn cat svn://apptest.uwec.edu/webdev/app065/trunk/app/views/layouts/public.rhtml > #{deploy_to}/#{current_dir}/app/views/layouts/public.rhtml"
- end
- desc "bumps mongrel"
- task :restart do
- stop
- start
- end
- desc "mongrel_start"
- task :start do
- send(run_method, "cd #{deploy_to}/#{current_dir} && mongrel_rails start -e production -p #{mongrel_port} -d")
- end
- task :stop do
- desc "mongrel stop"
- run "rm -rf #{deploy_to}/#{current_dir}/logs/mongrel*"
- send(run_method, "cd #{deploy_to}/#{current_dir} && mongrel_rails stop") rescue nil
- end
- desc "Create database.yml in shared/config"
- task :after_setup do
- database_configuration = render :template => <<-EOF
- production:
- database: <%= "app065rails_production" %>
- adapter: sqlserver
- mode:odbc
- dsn: <%= dsn %>
- username: <%= dbuser %>
- password: <%= dbpassword %>
- EOF
- run "mkdir -p #{deploy_to}/#{shared_dir}/config"
- put database_configuration, "#{deploy_to}/#{shared_dir}/config/database.yml"
- create_config_file
- end
- desc "Create configuration yaml file"
- task :create_config_file do
- config = render :template => <<EOF
- production:
- email:
- server: smtp.uwec.edu
- port: 25
- domain: uwec.edu
- authentication: none
- username:
- password:
- contact_recipient: pickarpr@uwec.edu
- content_type: text/html
- EOF
- run "mkdir -p #{deploy_to}/#{shared_dir}/config"
- put config, "#{deploy_to}/#{shared_dir}/config/config.yml"
- end
- desc "sets perms on root, links database file, and links rails"
- task :after_update_code, :roles => [:web, :db, :app] do
- run "chmod 755 #{release_path}/public -R"
- run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml"
- run "rm -f #{release_path}/config/config.yml" # removes the checked-out config file rescue nil
- run "ln -nfs #{deploy_to}/#{shared_dir}/config/config.yml #{release_path}/config/config.yml"
- #run "ln -nfs #{root_path}/rails123 #{release_path}/vendor/rails"
- end
- desc "backup the MDH database"
- task :backup_db do
- # the on_rollback handler is only executed if this task is executed within
- # a transaction (see below), AND it or a subsequent task fails.
- on_rollback { delete "/tmp/dump.sql" }
- run "mysqldump -u #{dbuser} -p #{dbpassword} > #{db_filename}" do |ch, stream, out|
- ch.send_data "#{dbpassword}\n" if out =~ /^Enter password:/
- end
- end
- ####### Portion of output ##########
- * executing task stop
- * executing "rm -rf /app/app065/current/logs/mongrel*"
- servers: ["frisbee.lts.uwec.edu"]
- [frisbee.lts.uwec.edu] executing command
- command finished
- * executing "cd /app/app065/current && mongrel_rails stop"
- servers: ["frisbee.lts.uwec.edu"]
- [frisbee.lts.uwec.edu] executing command
- ** [out :: frisbee.lts.uwec.edu] Sending TERM to Mongrel at PID 28116...Process does not exist. Not running.
- ** [out :: frisbee.lts.uwec.edu] Done.
- command finished
- * executing task start
- * executing "cd /app/app065/current && mongrel_rails start -e production -p 5065 -d"
- servers: ["frisbee.lts.uwec.edu"]
- [frisbee.lts.uwec.edu] executing command
- ** [out :: frisbee.lts.uwec.edu] **
- ** [out :: frisbee.lts.uwec.edu] !!! PID file log/mongrel.pid already exists. Mongrel could be running already. Check your log/mongrel.log for errors.
- ** [out :: frisbee.lts.uwec.edu] **
- ** [out :: frisbee.lts.uwec.edu] !!! Exiting with error. You must stop mongrel and clear the .pid before I'll attempt a start.
- command finished
- command "cd /app/app065/current && mongrel_rails start -e production -p 5065 -d" failed on frisbee.lts.uwec.edu
Add Comment
Please, Sign In to add comment