-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCapfile
More file actions
70 lines (52 loc) · 2.19 KB
/
Capfile
File metadata and controls
70 lines (52 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -*- mode:ruby; -*-
#
# Set deploy target host/filesystem and install user/group to use from cap command line as so:
#
# cap deploy -S target=ripple.fcla.edu:/opt/web-services/sies/xmlresolution -S who=daitss:daitss
#
require 'rubygems'
require 'railsless-deploy'
require 'bundler/capistrano'
set :keep_releases, 5 # default is 5
set :bundle_flags, "--deployment"
set :repository, "git://github.com/daitss/xmlresolution.git"
set :scm, "git"
set :branch, "master"
set :use_sudo, false
set :user, "daitss"
set :group, "daitss"
def usage(*messages)
STDERR.puts "Usage: cap deploy -S target=<host:filesystem> -S who=<user:group>"
STDERR.puts messages.join("\n")
STDERR.puts "You may set the remote user and group by using -S who=<user:group>. Defaults to #{user}:#{group}."
STDERR.puts "If you set the user, you must be able to ssh to the target host as that user."
STDERR.puts "You may set the branch in a similar manner: -S branch=<branch name> (defaults to #{variables[:branch]})."
exit
end
usage('The deployment target was not set (e.g., target=ripple.fcla.edu:/opt/web-services/sites/silos).') unless (variables[:target] and variables[:target] =~ %r{.*:.*})
_domain, _filesystem = variables[:target].split(':', 2)
set :deploy_to, _filesystem
set :domain, _domain
set :default_environment, {
'PATH' => "/opt/ruby-1.9.3-p545/bin:$PATH",
'RUBY_VERSION' => 'ruby 1.9.3-p545'
}
if (variables[:who] and variables[:who] =~ %r{.*:.*})
_user, _group = variables[:who].split(':', 2)
set :user, _user
set :group, _group
end
role :app, domain
after "deploy:update", "deploy:layout"
namespace :deploy do
desc "Create the directory hierarchy, as necessary, on the target host"
task :layout, :roles => :app do
['collections', 'schemas', 'bundle'].each do |dir| # want to preserve existing data, so keep state files in the shared directory
realname = File.join(shared_path, dir)
run "mkdir -p #{realname}"
#run "chmod -R ug+rwX #{realname}"
end
#run "find #{shared_path} #{release_path} -type d | xargs chmod 2775"
#run "find #{shared_path} #{release_path} | xargs chgrp #{group}"
end
end