foreman 0.62.0-java → 0.63.0-java

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -43,4 +43,6 @@ David Dollar
43
43
 
44
44
  ## License
45
45
 
46
- MIT
46
+ Foreman is licensed under the MIT license.
47
+
48
+ See LICENSE for the full license text.
data/bin/foreman-runner CHANGED
@@ -34,7 +34,7 @@ shift $((OPTIND-1))
34
34
 
35
35
  if [ "$read_profile" = "1" ]; then
36
36
  if [ -f .profile ]; then
37
- . .profile
37
+ . ./.profile
38
38
  fi
39
39
  fi
40
40
 
@@ -7,10 +7,6 @@ EOF
7
7
 
8
8
  end script
9
9
 
10
- start on (started network-interface
11
- or started network-manager
12
- or started networking)
10
+ start on runlevel [2345]
13
11
 
14
- stop on (stopping network-interface
15
- or stopping network-manager
16
- or stopping networking)
12
+ stop on runlevel [016]
@@ -1,7 +1,7 @@
1
1
  require "foreman"
2
- require "foreman/env"
3
2
  require "foreman/process"
4
3
  require "foreman/procfile"
4
+ require "dotenv"
5
5
  require "tempfile"
6
6
  require "timeout"
7
7
  require "fileutils"
@@ -52,9 +52,6 @@ class Foreman::Engine
52
52
  # Start the processes registered to this +Engine+
53
53
  #
54
54
  def start
55
- # Make sure foreman is the process group leader.
56
- Process.setpgrp unless Foreman.windows?
57
-
58
55
  register_signal_handlers
59
56
  startup
60
57
  spawn_processes
@@ -172,9 +169,7 @@ class Foreman::Engine
172
169
  # @param [String] filename A .env file to load into the environment
173
170
  #
174
171
  def load_env(filename)
175
- Foreman::Env.new(filename).entries do |name, value|
176
- @env[name] = value
177
- end
172
+ @env.update Dotenv::Environment.new(filename)
178
173
  end
179
174
 
180
175
  # Send a signal to all processes started by this +Engine+
@@ -207,7 +202,7 @@ class Foreman::Engine
207
202
  kill_children(signal)
208
203
  else
209
204
  begin
210
- Process.kill "-#{signal}", Process.getpgrp
205
+ Process.kill "-#{signal}", Process.pid
211
206
  rescue Errno::ESRCH, Errno::EPERM
212
207
  end
213
208
  end
@@ -6,7 +6,7 @@ class Foreman::Export::Upstart < Foreman::Export::Base
6
6
  def export
7
7
  super
8
8
 
9
- Dir["#{location}/#{app}*.conf"].each do |file|
9
+ (Dir["#{location}/#{app}-*.conf"] << "#{location}/#{app}.conf").each do |file|
10
10
  clean file
11
11
  end
12
12
 
@@ -83,7 +83,7 @@ private
83
83
 
84
84
  def parse(filename)
85
85
  File.read(filename).gsub("\r\n","\n").split("\n").map do |line|
86
- if line =~ /^([A-Za-z0-9_]+):\s*(.+)$/
86
+ if line =~ /^([A-Za-z0-9_-]+):\s*(.+)$/
87
87
  [$1, $2]
88
88
  end
89
89
  end.compact
@@ -1,5 +1,5 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.62.0"
3
+ VERSION = "0.63.0"
4
4
 
5
5
  end
data/man/foreman.1 CHANGED
@@ -46,10 +46,6 @@ Specify an alternate Procfile to load, implies \fB\-d\fR at the Procfile root\.
46
46
  \fB\-p\fR, \fB\-\-port\fR
47
47
  Specify which port to use as the base for this application\. Should be a multiple of 1000\.
48
48
  .
49
- .TP
50
- \fB\-t\fR, \fB\-\-tmux\fR
51
- Runs the processes in a tmux session\. Creates one window for each process and an extra window containing the output of each window (requires gawk)\.
52
- .
53
49
  .P
54
50
  \fBforeman run\fR is used to run one\-off commands using the same environment as your defined processes\.
55
51
  .
@@ -234,7 +230,7 @@ Run one process type from the application defined in a specific Procfile:
234
230
  .
235
231
  .nf
236
232
 
237
- $ foreman start alpha \-p ~/myapp/Procfile
233
+ $ foreman start alpha \-f ~/myapp/Procfile
238
234
  .
239
235
  .fi
240
236
  .
@@ -50,7 +50,7 @@ describe "Foreman::CLI", :fakefs do
50
50
  describe "check" do
51
51
  it "with a valid Procfile displays the jobs" do
52
52
  write_procfile
53
- foreman("check").should == "valid procfile detected (alpha, bravo)\n"
53
+ foreman("check").should == "valid procfile detected (alpha, bravo, foo_bar, foo-bar)\n"
54
54
  end
55
55
 
56
56
  it "with a blank Procfile displays an error" do
@@ -29,11 +29,27 @@ describe Foreman::Export::Upstart, :fakefs do
29
29
  mock(FileUtils).rm("/tmp/init/app-alpha-1.conf")
30
30
  mock(FileUtils).rm("/tmp/init/app-bravo.conf")
31
31
  mock(FileUtils).rm("/tmp/init/app-bravo-1.conf")
32
+ mock(FileUtils).rm("/tmp/init/app-foo-bar.conf")
33
+ mock(FileUtils).rm("/tmp/init/app-foo-bar-1.conf")
34
+ mock(FileUtils).rm("/tmp/init/app-foo_bar.conf")
35
+ mock(FileUtils).rm("/tmp/init/app-foo_bar-1.conf")
32
36
 
33
37
  upstart.export
34
38
  upstart.export
35
39
  end
36
40
 
41
+ it "does not delete exported files for similarly named applications" do
42
+ FileUtils.mkdir_p "/tmp/init"
43
+
44
+ ["app2", "app2-alpha", "app2-alpha-1"].each do |name|
45
+ path = "/tmp/init/#{name}.conf"
46
+ FileUtils.touch(path)
47
+ dont_allow(FileUtils).rm(path)
48
+ end
49
+
50
+ upstart.export
51
+ end
52
+
37
53
  it "quotes and escapes environment variables" do
38
54
  engine.env['KEY'] = 'd"\|d'
39
55
  upstart.export
@@ -16,8 +16,10 @@ describe Foreman::Procfile, :fakefs do
16
16
  it "loads a passed-in Procfile" do
17
17
  write_procfile
18
18
  procfile = Foreman::Procfile.new("Procfile")
19
- procfile["alpha"].should == "./alpha"
20
- procfile["bravo"].should == "./bravo"
19
+ procfile["alpha"].should == "./alpha"
20
+ procfile["bravo"].should == "./bravo"
21
+ procfile["foo-bar"].should == "./foo-bar"
22
+ procfile["foo_bar"].should == "./foo_bar"
21
23
  end
22
24
 
23
25
  it "can have a process appended to it" do
@@ -42,5 +42,40 @@ Bluepill.application("app", :foreground => false, :log_file => "/var/log/bluepil
42
42
  process.group = "app-bravo"
43
43
  end
44
44
 
45
+ app.process("foo_bar-1") do |process|
46
+ process.start_command = "./foo_bar"
45
47
 
48
+ process.working_dir = "/tmp/app"
49
+ process.daemonize = true
50
+ process.environment = {"PORT"=>"5200"}
51
+ process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
52
+ process.stop_grace_time = 45.seconds
53
+
54
+ process.stdout = process.stderr = "/var/log/app/app-foo_bar-1.log"
55
+
56
+ process.monitor_children do |children|
57
+ children.stop_command "kill {{PID}}"
58
+ end
59
+
60
+ process.group = "app-foo_bar"
61
+ end
62
+
63
+ app.process("foo-bar-1") do |process|
64
+ process.start_command = "./foo-bar"
65
+
66
+ process.working_dir = "/tmp/app"
67
+ process.daemonize = true
68
+ process.environment = {"PORT"=>"5300"}
69
+ process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
70
+ process.stop_grace_time = 45.seconds
71
+
72
+ process.stdout = process.stderr = "/var/log/app/app-foo-bar-1.log"
73
+
74
+ process.monitor_children do |children|
75
+
76
+ children.stop_command "kill {{PID}}"
77
+ end
78
+
79
+ process.group = "app-foo-bar"
80
+ end
46
81
  end
@@ -1,4 +1,6 @@
1
1
  # ----- foreman app processes -----
2
2
  AP01:4:respawn:/bin/su - app -c 'cd /tmp/app;export PORT=5000;./alpha >> /var/log/app/alpha-1.log 2>&1'
3
3
  AP02:4:respawn:/bin/su - app -c 'cd /tmp/app;export PORT=5100;./bravo >> /var/log/app/bravo-1.log 2>&1'
4
+ AP03:4:respawn:/bin/su - app -c 'cd /tmp/app;export PORT=5200;./foo_bar >> /var/log/app/foo_bar-1.log 2>&1'
5
+ AP04:4:respawn:/bin/su - app -c 'cd /tmp/app;export PORT=5300;./foo-bar >> /var/log/app/foo-bar-1.log 2>&1'
4
6
  # ----- end foreman app processes -----
@@ -19,6 +19,26 @@ stderr_logfile=/var/log/app/bravo-1.error.log
19
19
  user=app
20
20
  directory=/tmp/app
21
21
  environment=PORT=5100
22
+ [program:app-foo_bar-1]
23
+ command=./foo_bar
24
+ autostart=true
25
+ autorestart=true
26
+ stopsignal=QUIT
27
+ stdout_logfile=/var/log/app/foo_bar-1.log
28
+ stderr_logfile=/var/log/app/foo_bar-1.error.log
29
+ user=app
30
+ directory=/tmp/app
31
+ environment=PORT=5200
32
+ [program:app-foo-bar-1]
33
+ command=./foo-bar
34
+ autostart=true
35
+ autorestart=true
36
+ stopsignal=QUIT
37
+ stdout_logfile=/var/log/app/foo-bar-1.log
38
+ stderr_logfile=/var/log/app/foo-bar-1.error.log
39
+ user=app
40
+ directory=/tmp/app
41
+ environment=PORT=5300
22
42
 
23
43
  [group:app]
24
- programs=app-alpha-1,app-bravo-1
44
+ programs=app-alpha-1,app-bravo-1,app-foo_bar-1,app-foo-bar-1
@@ -7,10 +7,6 @@ EOF
7
7
 
8
8
  end script
9
9
 
10
- start on (started network-interface
11
- or started network-manager
12
- or started networking)
10
+ start on runlevel [2345]
13
11
 
14
- stop on (stopping network-interface
15
- or stopping network-manager
16
- or stopping networking)
12
+ stop on runlevel [016]
data/spec/spec_helper.rb CHANGED
@@ -79,6 +79,8 @@ def write_procfile(procfile="Procfile", alpha_env="")
79
79
  file.puts "alpha: ./alpha" + " #{alpha_env}".rstrip
80
80
  file.puts "\n"
81
81
  file.puts "bravo:\t./bravo"
82
+ file.puts "foo_bar:\t./foo_bar"
83
+ file.puts "foo-bar:\t./foo-bar"
82
84
  end
83
85
  File.expand_path(procfile)
84
86
  end
metadata CHANGED
@@ -1,43 +1,38 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.62.0
4
+ version: 0.63.0
5
+ prerelease:
5
6
  platform: java
6
7
  authors:
7
8
  - David Dollar
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-03-08 00:00:00.000000000 Z
12
+ date: 2013-04-15 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: thor
15
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &70217183733900 !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: 0.13.6
20
22
  type: :runtime
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: 0.13.6
24
+ version_requirements: *70217183733900
27
25
  - !ruby/object:Gem::Dependency
28
- name: posix-spawn
29
- requirement: !ruby/object:Gem::Requirement
26
+ name: dotenv
27
+ requirement: &70217183751420 !ruby/object:Gem::Requirement
28
+ none: false
30
29
  requirements:
31
- - - ~>
30
+ - - ! '>='
32
31
  - !ruby/object:Gem::Version
33
- version: 0.3.6
32
+ version: '0.7'
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: 0.3.6
35
+ version_requirements: *70217183751420
41
36
  description: Process manager for applications with multiple components
42
37
  email: ddollar@gmail.com
43
38
  executables:
@@ -69,7 +64,6 @@ files:
69
64
  - lib/foreman/distribution.rb
70
65
  - lib/foreman/engine/cli.rb
71
66
  - lib/foreman/engine.rb
72
- - lib/foreman/env.rb
73
67
  - lib/foreman/export/base.rb
74
68
  - lib/foreman/export/bluepill.rb
75
69
  - lib/foreman/export/inittab.rb
@@ -130,26 +124,27 @@ files:
130
124
  homepage: http://github.com/ddollar/foreman
131
125
  licenses:
132
126
  - MIT
133
- metadata: {}
134
127
  post_install_message:
135
128
  rdoc_options: []
136
129
  require_paths:
137
130
  - lib
138
131
  required_ruby_version: !ruby/object:Gem::Requirement
132
+ none: false
139
133
  requirements:
140
- - - '>='
134
+ - - ! '>='
141
135
  - !ruby/object:Gem::Version
142
136
  version: '0'
143
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
+ none: false
144
139
  requirements:
145
- - - '>='
140
+ - - ! '>='
146
141
  - !ruby/object:Gem::Version
147
142
  version: '0'
148
143
  requirements: []
149
144
  rubyforge_project:
150
- rubygems_version: 2.0.0
145
+ rubygems_version: 1.8.11
151
146
  signing_key:
152
- specification_version: 4
147
+ specification_version: 3
153
148
  summary: Process manager for applications with multiple components
154
149
  test_files: []
155
150
  has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 4bceec3667a30e0e2f03405297ca261a18777b9e
4
- data.tar.gz: 7f1c9dd62f6ac00d05db018b7ba05bdb792d5fe5
5
- SHA512:
6
- metadata.gz: 67dc455b1e317bdf2d917734a0d9a653ef9cbe4a7392ff533b918f070d0563fb3c2fa427165e56a827de1de83271f2d45f254e2ae7c3bbf4514638f359024508
7
- data.tar.gz: 9b8953d964c21f3372ad757dc865cca897bd8cd762a5ae1e81b3348a58b2a7da54dab4b3dba341a2b30e1697c8bec22d9361055ac167714fb7c78b1dd11f976a
data/lib/foreman/env.rb DELETED
@@ -1,29 +0,0 @@
1
- require "foreman"
2
-
3
- class Foreman::Env
4
-
5
- attr_reader :entries
6
-
7
- def initialize(filename)
8
- @entries = File.read(filename).gsub("\r\n","\n").split("\n").inject({}) do |ax, line|
9
- if line =~ /\A([A-Za-z_0-9]+)=(.*)\z/
10
- key = $1
11
- case val = $2
12
- # Remove single quotes
13
- when /\A'(.*)'\z/ then ax[key] = $1
14
- # Remove double quotes and unescape string preserving newline characters
15
- when /\A"(.*)"\z/ then ax[key] = $1.gsub('\n', "\n").gsub(/\\(.)/, '\1')
16
- else ax[key] = val
17
- end
18
- end
19
- ax
20
- end
21
- end
22
-
23
- def entries
24
- @entries.each do |key, value|
25
- yield key, value
26
- end
27
- end
28
-
29
- end