foreman 0.62.0 → 0.63.0
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 +3 -1
- data/bin/foreman-runner +1 -1
- data/data/export/upstart/master.conf.erb +2 -6
- data/lib/foreman/engine.rb +3 -8
- data/lib/foreman/export/upstart.rb +1 -1
- data/lib/foreman/procfile.rb +1 -1
- data/lib/foreman/version.rb +1 -1
- data/man/foreman.1 +1 -5
- data/spec/foreman/cli_spec.rb +1 -1
- data/spec/foreman/export/upstart_spec.rb +16 -0
- data/spec/foreman/procfile_spec.rb +4 -2
- data/spec/resources/export/bluepill/app.pill +35 -0
- data/spec/resources/export/inittab/inittab.default +2 -0
- data/spec/resources/export/supervisord/app-alpha-1.conf +21 -1
- data/spec/resources/export/upstart/app.conf +2 -6
- data/spec/spec_helper.rb +2 -0
- metadata +28 -13
- checksums.yaml +0 -7
- data/lib/foreman/env.rb +0 -29
data/README.md
CHANGED
data/bin/foreman-runner
CHANGED
@@ -7,10 +7,6 @@ EOF
|
|
7
7
|
|
8
8
|
end script
|
9
9
|
|
10
|
-
start on
|
11
|
-
or started network-manager
|
12
|
-
or started networking)
|
10
|
+
start on runlevel [2345]
|
13
11
|
|
14
|
-
stop on
|
15
|
-
or stopping network-manager
|
16
|
-
or stopping networking)
|
12
|
+
stop on runlevel [016]
|
data/lib/foreman/engine.rb
CHANGED
@@ -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
|
-
|
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.
|
205
|
+
Process.kill "-#{signal}", Process.pid
|
211
206
|
rescue Errno::ESRCH, Errno::EPERM
|
212
207
|
end
|
213
208
|
end
|
data/lib/foreman/procfile.rb
CHANGED
data/lib/foreman/version.rb
CHANGED
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 \-
|
233
|
+
$ foreman start alpha \-f ~/myapp/Procfile
|
238
234
|
.
|
239
235
|
.fi
|
240
236
|
.
|
data/spec/foreman/cli_spec.rb
CHANGED
@@ -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
|
20
|
-
procfile["bravo"].should
|
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
|
11
|
-
or started network-manager
|
12
|
-
or started networking)
|
10
|
+
start on runlevel [2345]
|
13
11
|
|
14
|
-
stop on
|
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,29 +1,38 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.63.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- David Dollar
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-
|
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: &70110396465840 !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:
|
24
|
+
version_requirements: *70110396465840
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: dotenv
|
27
|
+
requirement: &70110396464720 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
23
29
|
requirements:
|
24
|
-
- - '>='
|
30
|
+
- - ! '>='
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
32
|
+
version: '0.7'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70110396464720
|
27
36
|
description: Process manager for applications with multiple components
|
28
37
|
email: ddollar@gmail.com
|
29
38
|
executables:
|
@@ -55,7 +64,6 @@ files:
|
|
55
64
|
- lib/foreman/distribution.rb
|
56
65
|
- lib/foreman/engine/cli.rb
|
57
66
|
- lib/foreman/engine.rb
|
58
|
-
- lib/foreman/env.rb
|
59
67
|
- lib/foreman/export/base.rb
|
60
68
|
- lib/foreman/export/bluepill.rb
|
61
69
|
- lib/foreman/export/inittab.rb
|
@@ -116,26 +124,33 @@ files:
|
|
116
124
|
homepage: http://github.com/ddollar/foreman
|
117
125
|
licenses:
|
118
126
|
- MIT
|
119
|
-
metadata: {}
|
120
127
|
post_install_message:
|
121
128
|
rdoc_options: []
|
122
129
|
require_paths:
|
123
130
|
- lib
|
124
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
125
133
|
requirements:
|
126
|
-
- - '>='
|
134
|
+
- - ! '>='
|
127
135
|
- !ruby/object:Gem::Version
|
128
136
|
version: '0'
|
137
|
+
segments:
|
138
|
+
- 0
|
139
|
+
hash: -2345182653779911180
|
129
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
130
142
|
requirements:
|
131
|
-
- - '>='
|
143
|
+
- - ! '>='
|
132
144
|
- !ruby/object:Gem::Version
|
133
145
|
version: '0'
|
146
|
+
segments:
|
147
|
+
- 0
|
148
|
+
hash: -2345182653779911180
|
134
149
|
requirements: []
|
135
150
|
rubyforge_project:
|
136
|
-
rubygems_version:
|
151
|
+
rubygems_version: 1.8.11
|
137
152
|
signing_key:
|
138
|
-
specification_version:
|
153
|
+
specification_version: 3
|
139
154
|
summary: Process manager for applications with multiple components
|
140
155
|
test_files: []
|
141
156
|
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: afe8eb788ae1b342ed0704a9e0504eee90c40549
|
4
|
-
data.tar.gz: 4493993e3ed2b5eeeffe5ae3c0d9c9bac78de32a
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 89be93397c4210acae5b5e0d258e50546d47727edc1cc8fc4908746b6bcb58bcc50e966244d5820fcceb5f2630896317151664c4a52680779b5f96d206950cd6
|
7
|
-
data.tar.gz: da1fc2ca548f01540e0f391841934c8cb7b8a499a18ca42c951270f295b9112685191cc2332a74074b5242ae3c8a10df8f72a2224419d20ad6afd49998d1bc22
|
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
|