• R/O
  • HTTP
  • SSH
  • HTTPS

mint-server: Commit

Math Interactive's web application


Commit MetaInfo

Revision3aeb2688ee78b831acc9303e67df0f883e1f48a1 (tree)
Time2012-04-02 03:12:29
Authorokkez <okkez000@gmai...>
Commiterokkez

Log Message

remove deploy.rake.

use capistrano instead of vlad.

Change Summary

  • delete: lib/tasks/deploy.rake

Incremental Difference

--- a/lib/tasks/deploy.rake
+++ /dev/null
@@ -1,97 +0,0 @@
1-# -*- coding: utf-8 -*-
2-begin
3- require 'vlad'
4- Vlad.load :app => :thin, :scm => :git, :web => nil
5-rescue LoadError
6- # do nothing
7-
8- # when remote server does not have vlad gem.
9- def remote_task(*args)
10- # nop
11- end
12-end
13-
14-namespace :vlad do
15- desc "full deploy"
16- task :deploy => [
17- :stop_app,
18- :update_src,
19- :update,
20- :update_owner,
21- :update_config,
22- :migrate,
23- :start_app
24- ]
25-
26- remote_task :setup_app do
27- dirs = [deploy_to, releases_path, scm_path, shared_path]
28- dirs += %w(system log pids).map { |d| File.join(shared_path, d) }
29- sudo "chown www-data:www-data #{dirs.join(' ')}"
30- end
31-
32- # Rake.clear_tasks が無いみたいなので直接インスタンス変数を操作した
33- Rake.application.instance_variable_get("@tasks").delete("vlad:update")
34- Rake.application.instance_variable_get("@tasks").delete("vlad:start_app")
35- Rake.application.instance_variable_get("@tasks").delete("vlad:stop_app")
36- Rake.application.instance_variable_get("@tasks").delete("vlad:cleanup")
37-
38- # sf.jp の Git リポジトリは git archive の --remote で直接指定出来ないため
39- task :update_src do
40- sh "#{git_cmd} archive --format=tar HEAD | gzip > #{release_name}.tar.gz"
41- sh "#{rsync_cmd} #{rsync_flags.join(' ')} #{release_name}.tar.gz #{domain}:#{scm_path}"
42- end
43-
44- # サーバーから外には git プロトコルが通らないため再定義した
45- remote_task :update, :roles => :app do
46- symlink = false
47- begin
48- run [
49- "mkdir -p #{release_path}",
50- "tar xfz #{scm_path}/#{release_name}.tar.gz -C #{release_path}",
51- "chmod -R g+w #{latest_release}",
52- "rm -rf #{latest_release}/log #{latest_release}/public/system #{latest_release}/tmp/pids",
53- "mkdir -p #{latest_release}/db #{latest_release}/tmp"
54- ].join(" && ")
55- Rake::Task['vlad:update_symlinks'].invoke
56- symlink = true
57- run "rm -f #{current_path} && ln -s #{latest_release} #{current_path}"
58- run "echo #{now} $USER #{revision} #{File.basename release_path} >> #{deploy_to}/revisions.log"
59- rescue => e
60- run "rm -f #{current_path} && ln -s #{previous_release} #{current_path}" if symlink
61- run "rm -rf #{release_path}"
62- raise e
63- end
64- end
65-
66- remote_task :update_owner, :roles => :app do
67- sudo "chown -R www-data:www-data #{latest_release}"
68- end
69-
70- remote_task :update_config, :roles => :app do
71- run "cp #{shared_path}/database.yml #{shared_path}/smtp.yml #{release_path}/config/"
72- end
73-
74- remote_task :start_app, :roles => :app do
75- sudo "#{thin_command} -C #{thin_conf} restart"
76- end
77-
78- remote_task :stop_app, :roles => :app do
79- sudo "#{thin_command} -C #{thin_conf} stop"
80- end
81-
82- # シンボリックリンクの処理をしておかないと削除時にエラーが発生するため追加
83- remote_task :cleanup do
84- max = keep_releases
85- if releases.length <= max then
86- puts "no old releases to clean up #{releases.length} <= #{max}"
87- else
88- puts "keeping #{max} of #{releases.length} deployed releases"
89-
90- (releases - releases.last(max)).each do |release|
91- path = File.join(releases_path, release)
92- run "find #{path} -type l -exec unlink {} \\;"
93- run "rm -rf #{path}"
94- end
95- end
96- end
97-end
Show on old repository browser