foreman-upstart-scaling 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,6 @@ kill timeout 20
6
6
 
7
7
  instance $<%= app.upcase %>_<%= process.name.upcase %>_INSTANCE
8
8
 
9
- # TODO sudo overwrites this those env vars
10
9
  env PORT=<%= port %>
11
10
  <% engine.environment.each_pair do |var,value| %>
12
11
  env <%= var.upcase %>=<%= value %>
@@ -14,7 +13,7 @@ env <%= var.upcase %>=<%= value %>
14
13
 
15
14
  script
16
15
  cd <%= engine.directory %>
17
- name="<%= app %>-<%=process.name%>-$<%= app.upcase %>_<%= process.name.upcase %>_INSTANCE"
16
+ export name="<%= app %>-<%=process.name%>-$<%= app.upcase %>_<%= process.name.upcase %>_INSTANCE"
18
17
 
19
18
  # This little dance pipes output into logger with three
20
19
  # goals in mind:
@@ -54,9 +53,13 @@ script
54
53
  rm $stdout_fifo
55
54
  rm $stderr_fifo
56
55
 
56
+ # store ENV, as `sudo -i` don't preserve it
57
+
58
+ echo "PORT=$PORT <%= app.upcase %>_<%= process.name.upcase %>_INSTANCE=$<%= app.upcase %>_<%= process.name.upcase %>_INSTANCE<% engine.environment.each_pair do |var,value| %> <%= var.upcase %>=<%= value %><% end %>" > /tmp/$name.env
59
+
57
60
  # Run the service in the usual way. Our output is already
58
61
  # going to the fifos; that won't change when the new
59
62
  # program executes.
60
- exec sudo -H -i -u <%= user %> '<%= process.command %>'
63
+ exec sudo -u <%= user %> $(cat /tmp/$name.env) -i '<%= process.command %>'
61
64
  end script
62
65
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman-upstart-scaling
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-05 00:00:00.000000000Z
12
+ date: 2012-06-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: foreman
16
- requirement: &70179280215540 !ruby/object:Gem::Requirement
16
+ requirement: &70094252389680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.46.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70179280215540
24
+ version_requirements: *70094252389680
25
25
  description: Upstart exporter for foreman, that supports worker scaling via env vars.
26
26
  email: fabio.kung@gmail.com
27
27
  executables: []