capistrano-buildpack 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +21 -10
- data/lib/capistrano-buildpack/tasks.rb +13 -3
- data/lib/capistrano-buildpack/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -33,17 +33,20 @@ Here's a basic Capfile that uses `Capistrano::Buildpack`:
|
|
33
33
|
set :user, "peter"
|
34
34
|
set :base_port, 6700
|
35
35
|
set :concurrency, "web=1"
|
36
|
+
|
37
|
+
read_env 'prod'
|
36
38
|
|
37
|
-
set :deploy_env, {
|
38
|
-
'LANG' => 'en_US.UTF-8',
|
39
|
-
'PATH' => 'bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin',
|
40
|
-
'GEM_PATH' => 'vendor/bundle/ruby/1.9.1:.',
|
41
|
-
'RACK_ENV' => 'production',
|
42
|
-
}
|
43
|
-
|
44
39
|
load 'deploy'
|
45
40
|
require 'capistrano-buildpack'
|
46
41
|
|
42
|
+
This will load a file named `.env.prod` which should consist of environment variables like this:
|
43
|
+
|
44
|
+
SOME_VAR_NAME=some_value
|
45
|
+
SOME_OTHER_VAR=something_else
|
46
|
+
|
47
|
+
This example just unconditionally loads 'prod' but you can have as many different sets as you want,
|
48
|
+
loading them as appropriate in tasks.
|
49
|
+
|
47
50
|
To run a deploy:
|
48
51
|
|
49
52
|
$ cap deploy:setup # create the required directory structure and gem install foreman-export-nginx
|
@@ -61,10 +64,18 @@ Deploy will do the following things:
|
|
61
64
|
The nginx config will list at least one domain for the app: `<application>.<hostname>`, which in this case is `bugsplatdotinfo.examplevps.bugsplat.info`. Anything
|
62
65
|
you add to the `:additional_domains` setting gets tacked on at the end.
|
63
66
|
|
64
|
-
##
|
67
|
+
## Running remote commands
|
68
|
+
|
69
|
+
Sometimes you want to run a command on the other end that isn't defined in a Procfile. Do that with `cap remote`:
|
70
|
+
|
71
|
+
$ cap remote echo hi there
|
72
|
+
|
73
|
+
## Very Important Notes
|
74
|
+
|
75
|
+
`Capistrano::Buildpack` will *not* run `bin/release` from the buildpack, so any environment variables that that attempts to set need to be set using `read_env`.
|
76
|
+
In addition, at the moment the exported nginx config does not have compression turned on.
|
65
77
|
|
66
|
-
|
67
|
-
addition, at the moment the exported nginx config does not have compression turned o
|
78
|
+
Also, note that right now this does not support HTTPS. I'm working on it.
|
68
79
|
|
69
80
|
## Contributing
|
70
81
|
|
@@ -19,12 +19,16 @@ if Capistrano::Configuration.instance
|
|
19
19
|
end
|
20
20
|
|
21
21
|
namespace :buildpack do
|
22
|
-
|
22
|
+
|
23
|
+
task :setup_env do
|
23
24
|
set :deploy_to, "/apps/#{application}"
|
24
25
|
|
25
26
|
default_run_options[:pty] = true
|
26
27
|
default_run_options[:shell] = '/bin/bash'
|
27
|
-
|
28
|
+
end
|
29
|
+
|
30
|
+
task :setup do
|
31
|
+
setup_env
|
28
32
|
set :foreman_export_path, "/etc/init"
|
29
33
|
set :foreman_export_type, "upstart"
|
30
34
|
set :nginx_export_path, "/etc/nginx/conf.d"
|
@@ -42,7 +46,6 @@ if Capistrano::Configuration.instance
|
|
42
46
|
end
|
43
47
|
|
44
48
|
task "install_foreman_export_nginx" do
|
45
|
-
|
46
49
|
sudo "gem install foreman-export-nginx --update"
|
47
50
|
end
|
48
51
|
|
@@ -79,5 +82,12 @@ if Capistrano::Configuration.instance
|
|
79
82
|
end
|
80
83
|
end
|
81
84
|
|
85
|
+
task 'remote' do
|
86
|
+
buildpack.setup_env
|
87
|
+
command=ARGV.values_at(Range.new(ARGV.index('remote')+1,-1))
|
88
|
+
run "cd #{current_path}; foreman run #{command*' '}"
|
89
|
+
exit(0)
|
90
|
+
end
|
91
|
+
|
82
92
|
end
|
83
93
|
end
|