Commit c9e36ef5c753210511d36d712fa620aa1705688d
- Diff rendering mode:
- inline
- side by side
config/deploy.rb
(89 / 12)
|   | |||
| 1 | set :application, "set your application name here" | ||
| 2 | set :repository, "set your repository location here" | ||
| 1 | set :application, 'gitorious' | ||
| 3 | 2 | ||
| 4 | # If you aren't deploying to /u/apps/#{application} on the target | ||
| 5 | # servers (which is the default), you can specify the actual location | ||
| 6 | # via the :deploy_to variable: | ||
| 7 | # set :deploy_to, "/var/www/#{application}" | ||
| 3 | role :app, 'int.sonianarchive.com' | ||
| 4 | role :web, 'int.sonianarchive.com' | ||
| 5 | role :db, 'int.sonianarchive.com', :primary => true | ||
| 8 | 6 | ||
| 9 | # If you aren't using Subversion to manage your source code, specify | ||
| 10 | # your SCM below: | ||
| 11 | # set :scm, :subversion | ||
| 7 | depend :remote, :command, 'gem' | ||
| 8 | depend :remote, :gem, 'rails', '>=2.0.2' | ||
| 9 | depend :remote, :gem, 'ebb', '>=0.1.0' | ||
| 10 | depend :remote, :gem, 'BlueCloth', '>=1.0.0' | ||
| 11 | depend :remote, :gem, 'mime-types', '>=1.15' | ||
| 12 | depend :remote, :gem, 'textpow', '>=0.10.1' | ||
| 13 | depend :remote, :gem, 'chronic', '>=0.2.3' | ||
| 14 | depend :remote, :gem, 'rmagick', '>=2.3.0' | ||
| 12 | 15 | ||
| 13 | role :app, "your app-server here" | ||
| 14 | role :web, "your web-server here" | ||
| 15 | role :db, "your db-server here", :primary => true | ||
| 16 | set :use_sudo, false | ||
| 17 | set :user, 'git' | ||
| 18 | set :deploy_to, "/var/www/#{application}" | ||
| 19 | |||
| 20 | set :scm, :git | ||
| 21 | set :repository, "/var/git/#{application}.git" | ||
| 22 | set :repository_cache, "git-cache" | ||
| 23 | set :ssh_options, { :forward_agent => true } | ||
| 24 | set :deploy_via, :remote_cache | ||
| 25 | set :branch, "sonian" | ||
| 26 | |||
| 27 | DATABASE_YML = ERB.new <<-EOF | ||
| 28 | base: &base | ||
| 29 | adapter: mysql | ||
| 30 | socket: /var/run/mysqld/mysqld.sock | ||
| 31 | username: root | ||
| 32 | password: | ||
| 33 | development: | ||
| 34 | database: #{application}_development | ||
| 35 | <<: *base | ||
| 36 | test: | ||
| 37 | database: #{application}_test | ||
| 38 | <<: *base | ||
| 39 | production: | ||
| 40 | database: #{application}_production | ||
| 41 | <<: *base | ||
| 42 | EOF | ||
| 43 | |||
| 44 | GITORIOUS_YML = ERB.new <<-EOF | ||
| 45 | cookie_secret: d11c9229c49301cc6c307279b689396b | ||
| 46 | repository_base_path: /var/git | ||
| 47 | extra_html_head_data: | ||
| 48 | system_message: | ||
| 49 | gitorious_client_port: 3000 | ||
| 50 | gitorious_client_host: localhost | ||
| 51 | gitorious_host: int.sonianarchive.com | ||
| 52 | EOF | ||
| 53 | |||
| 54 | after "deploy:setup" do | ||
| 55 | run "mkdir -p #{shared_path}/config" | ||
| 56 | put DATABASE_YML.result, "#{shared_path}/config/database.yml" | ||
| 57 | put GITORIOUS_YML.result, "#{shared_path}/config/gitorious.yml" | ||
| 58 | end | ||
| 59 | |||
| 60 | after "deploy:update_code" do | ||
| 61 | run "ln -nfs #{shared_path}/config/database.yml \ | ||
| 62 | #{release_path}/config/database.yml" | ||
| 63 | run "ln -nfs #{shared_path}/config/gitorious.yml \ | ||
| 64 | #{release_path}/config/gitorious.yml" | ||
| 65 | end | ||
| 66 | |||
| 67 | namespace :deploy do | ||
| 68 | namespace :monit do | ||
| 69 | [ :stop, :start, :restart ].each do |t| | ||
| 70 | desc "#{t.to_s.capitalize} #{application}" | ||
| 71 | task t, :roles => :app do | ||
| 72 | invoke_command "monit -g #{application} #{t.to_s} all", | ||
| 73 | :via => run_method | ||
| 74 | end | ||
| 75 | end | ||
| 76 | end | ||
| 77 | |||
| 78 | desc "start #{application}" | ||
| 79 | task :start, :roles => :app do | ||
| 80 | deploy.monit.start | ||
| 81 | end | ||
| 82 | |||
| 83 | desc "stop #{application}" | ||
| 84 | task :stop, :roles => :app do | ||
| 85 | deploy.monit.stop | ||
| 86 | end | ||
| 87 | |||
| 88 | desc "restart #{application}" | ||
| 89 | task :restart, :roles => :app, :except => { :no_release => true } do | ||
| 90 | deploy.monit.restart | ||
| 91 | end | ||
| 92 | end |

