capistrano-buildpack 0.0.8 → 0.0.9

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 CHANGED
@@ -71,6 +71,8 @@ Several other settings are available for controlling SSL:
71
71
  * `ssl_key_path`: a path to a key file on the server. You are responsible for getting it there.
72
72
  * `force_ssl`: Force a redirect to SSL. This will unconditionally redirect to the first domain in `additional_domains`, so if you have multiple you may want to do this in your app instead.
73
73
 
74
+ To run your app as a different user than `:user`, use the `:app_user` setting. This user will not be created for you, you'll need to create it yourself, and it must have a proper home directory.
75
+
74
76
  ## Running remote commands
75
77
 
76
78
  Sometimes you want to run a command on the other end that isn't defined in a Procfile. Do that with `cap remote`:
@@ -9,10 +9,11 @@ end
9
9
  if Capistrano::Configuration.instance
10
10
  Capistrano::Configuration.instance.load do
11
11
 
12
- _cset(:deploy_to) { "/apps/#{application}" }
12
+ _cset(:deploy_to) { "/apps/#{application}" }
13
13
  _cset(:buildpack_url) { abort "Please specify the buildpack URL to use, set :buildpack_url, 'http://example.com/buildpack'" }
14
- _cset(:base_port) { abort "Please specify a base port to use, set :base_port, 6500" }
15
- _cset(:concurrency) { abort "Please specify a concurrency level to use, set :concurrency, 'web-1'" }
14
+ _cset(:base_port) { abort "Please specify a base port to use, set :base_port, 6500" }
15
+ _cset(:concurrency) { abort "Please specify a concurrency level to use, set :concurrency, 'web=1'" }
16
+ _cset(:app_user) { user }
16
17
 
17
18
  _cset :foreman_export_path, "/etc/init"
18
19
  _cset :foreman_export_type, "upstart"
@@ -39,7 +40,7 @@ if Capistrano::Configuration.instance
39
40
  task :setup_env do
40
41
 
41
42
  set(:buildpack_hash) { Digest::SHA1.hexdigest(buildpack_url) }
42
- set(:buildpack_path) { "#{shared_path}/buildpack-#{buildpack_hash}" }
43
+ set(:buildpack_path) { "#{shared_path}/.build/buildpack-#{buildpack_hash}" }
43
44
 
44
45
  default_run_options[:pty] = true
45
46
  default_run_options[:shell] = '/bin/bash'
@@ -50,9 +51,12 @@ if Capistrano::Configuration.instance
50
51
  sudo "mkdir -p #{deploy_to}"
51
52
  sudo "chown -R #{user} #{deploy_to}"
52
53
 
54
+
53
55
  run("[[ ! -e #{buildpack_path} ]] && git clone #{buildpack_url} #{buildpack_path}; exit 0")
54
56
  run("cd #{buildpack_path} && git fetch origin && git reset --hard origin/master")
55
- run("mkdir -p #{shared_path}/build_cache")
57
+ run("mkdir -p #{shared_path}/.build/build_cache")
58
+ sudo "chown -R #{app_user} #{shared_path}"
59
+ sudo "chown -R #{user} #{shared_path}/.build"
56
60
 
57
61
  end
58
62
 
@@ -61,7 +65,7 @@ if Capistrano::Configuration.instance
61
65
  end
62
66
 
63
67
  task "compile" do
64
- run("cd #{buildpack_path} && RACK_ENV=production bin/compile #{release_path} #{shared_path}/build_cache")
68
+ run("cd #{buildpack_path} && RACK_ENV=production bin/compile #{release_path} #{shared_path}/.build/build_cache")
65
69
 
66
70
  env_lines = []
67
71
  deploy_env.each do |k,v|
@@ -78,21 +82,21 @@ if Capistrano::Configuration.instance
78
82
  _ssl_key_path = exists?(:ssl_key_path) ? "SSL_KEY_PATH=#{ssl_key_path}" : ''
79
83
  _force_ssl = exists?(:force_ssl) ? "FORCE_SSL=#{force_ssl}" : ''
80
84
 
81
- sudo "foreman export #{foreman_export_type} #{foreman_export_path} -d #{release_path} -l /var/log/#{application} -a #{application} -u #{user} -p #{base_port} -c #{concurrency}"
82
- sudo "env #{_use_ssl} #{_ssl_cert_path} #{_ssl_key_path} #{_force_ssl} ADDITIONAL_DOMAINS=#{additional_domains.join(',')} BASE_DOMAIN=$CAPISTRANO:HOST$ nginx-foreman export nginx #{nginx_export_path} -d #{release_path} -l /var/log/apps -a #{application} -u #{user} -p #{base_port} -c #{concurrency}"
85
+ sudo "foreman export #{foreman_export_type} #{foreman_export_path} -d #{release_path} -l /var/log/#{application} -a #{application} -u #{app_user} -p #{base_port} -c #{concurrency}"
86
+ sudo "env #{_use_ssl} #{_ssl_cert_path} #{_ssl_key_path} #{_force_ssl} ADDITIONAL_DOMAINS=#{additional_domains.join(',')} BASE_DOMAIN=$CAPISTRANO:HOST$ nginx-foreman export nginx #{nginx_export_path} -d #{release_path} -l /var/log/apps -a #{application} -u #{app_user} -p #{base_port} -c #{concurrency}"
83
87
  sudo "service #{application} restart || service #{application} start"
84
88
  sudo "service nginx reload || service nginx start"
85
89
  end
86
90
 
87
91
  end
88
92
 
89
- before "deploy", "buildpack:setup_env"
90
- before "deploy:setup", "buildpack:setup_env"
91
- before "deploy:setup", "buildpack:setup"
92
- after "deploy:setup", "buildpack:install_foreman_export_nginx"
93
- before "deploy", "buildpack:setup"
93
+ before "deploy", "buildpack:setup_env"
94
+ before "deploy:setup", "buildpack:setup_env"
95
+ before "deploy:setup", "buildpack:setup"
96
+ after "deploy:setup", "buildpack:install_foreman_export_nginx"
97
+ before "deploy", "buildpack:setup"
94
98
  before "deploy:finalize_update", "buildpack:compile"
95
- after "deploy:create_symlink", "buildpack:foreman_export"
99
+ after "deploy:create_symlink", "buildpack:foreman_export"
96
100
 
97
101
  task 'remote' do
98
102
  buildpack.setup_env
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Buildpack
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-buildpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-11 00:00:00.000000000 Z
12
+ date: 2013-01-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Deploy 12-factor applications using Capistrano
15
15
  email: