foreman 0.30.1 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,7 +58,7 @@ private ######################################################################
58
58
 
59
59
  procfile.entries.each do |entry|
60
60
  reader, writer = IO.pipe
61
- entry.spawn(concurrency[entry.name], writer, @directory, @environment, base_port).each do |process|
61
+ entry.spawn(concurrency[entry.name], writer, @directory, @environment, port_for(entry, 1, base_port)).each do |process|
62
62
  running_processes[process.pid] = process
63
63
  readers[process] = reader
64
64
  end
@@ -71,6 +71,7 @@ private ######################################################################
71
71
 
72
72
  def kill_all(signal="SIGTERM")
73
73
  running_processes.each do |pid, process|
74
+ info "sending #{signal} to pid #{pid}"
74
75
  Process.kill(signal, pid) rescue Errno::ESRCH
75
76
  end
76
77
  end
@@ -28,21 +28,18 @@ class Foreman::Process
28
28
  private
29
29
 
30
30
  def fork_with_io(command)
31
- io = case RUBY_VERSION
32
- when /^1\.9\./
33
- IO.popen([Foreman.runner, replace_command_env(command)], "w+")
34
- when /^1\.8\./
35
- full_command = replace_command_env(command).gsub("'", "\\'")
36
- IO.popen("#{Foreman.runner} '#{full_command}'", "w+")
37
- else
38
- raise "Unknown Ruby version: #{RUBY_VERSION}"
31
+ reader, writer = IO.pipe
32
+ pid = fork do
33
+ trap("INT", "IGNORE")
34
+ $stdout.reopen writer
35
+ reader.close
36
+ exec Foreman.runner, replace_command_env(command)
39
37
  end
40
- [ io, io.pid ]
38
+ [ reader, pid ]
41
39
  end
42
40
 
43
41
  def run_process(command, pipe)
44
42
  io, @pid = fork_with_io(command)
45
- trap("SIGTERM") { "got sigterm for %d" % @pid }
46
43
  output pipe, "started with pid %d" % @pid
47
44
  Thread.new do
48
45
  until io.eof?
@@ -1,5 +1,5 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.30.1"
3
+ VERSION = "0.31.0"
4
4
 
5
5
  end
@@ -0,0 +1,218 @@
1
+ .\" generated with Ronn/v0.7.3
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
+ .
4
+ .TH "FOREMAN" "1" "November 2011" "Foreman 0.26.0" "Foreman Manual"
5
+ .
6
+ .SH "NAME"
7
+ \fBforeman\fR \- manage Procfile\-based applications
8
+ .
9
+ .SH "SYNOPSIS"
10
+ \fBforeman start [process]\fR
11
+ .
12
+ .br
13
+ \fBforeman export <format> [location]\fR
14
+ .
15
+ .SH "DESCRIPTION"
16
+ \fBForeman\fR is a manager for Procfile\-based applications\. Its aim is to abstract away the details of the Procfile format, and allow you to either run your application directly or export it to some other process management format\.
17
+ .
18
+ .SH "RUNNING"
19
+ \fBforeman start\fR is used to run your application directly from the command line\.
20
+ .
21
+ .P
22
+ If no additional parameters are passed, foreman will run one instance of each type of process defined in your Procfile\.
23
+ .
24
+ .P
25
+ If a parameter is passed, foreman will run one instance of the specified application type\.
26
+ .
27
+ .P
28
+ The following options control how the application is run:
29
+ .
30
+ .TP
31
+ \fB\-c\fR, \fB\-\-concurrency\fR
32
+ Specify the number of each process type to run\. The value passed in should be in the format \fBprocess=num,process=num\fR
33
+ .
34
+ .TP
35
+ \fB\-p\fR, \fB\-\-port\fR
36
+ Specify which port to use as the base for this application\. Should be a multiple of 1000\.
37
+ .
38
+ .SH "EXPORTING"
39
+ \fBforeman export\fR is used to export your application to another process management format\.
40
+ .
41
+ .P
42
+ An location to export can be passed as an argument\. This argument may be either required or optional depending on the export format\.
43
+ .
44
+ .P
45
+ The following options control how the application is run:
46
+ .
47
+ .TP
48
+ \fB\-a\fR, \fB\-\-app\fR
49
+ Use this name rather than the application\'s root directory name as the name of the application when exporting\.
50
+ .
51
+ .TP
52
+ \fB\-c\fR, \fB\-\-concurrency\fR
53
+ Specify the number of each process type to run\. The value passed in should be in the format \fBprocess=num,process=num\fR
54
+ .
55
+ .TP
56
+ \fB\-l\fR, \fB\-\-log\fR
57
+ Specify the directory to place process logs in\.
58
+ .
59
+ .TP
60
+ \fB\-p\fR, \fB\-\-port\fR
61
+ Specify which port to use as the base for this application\. Should be a multiple of 1000\.
62
+ .
63
+ .TP
64
+ \fB\-u\fR, \fB\-\-user\fR
65
+ Specify the user the application should be run as\. Defaults to the app name
66
+ .
67
+ .SH "OPTIONS"
68
+ These options control all modes of foreman\'s operation\.
69
+ .
70
+ .TP
71
+ \fB\-e\fR, \fB\-\-env\fR
72
+ Specify an alternate environment file\. You can specify more than one file by using: \fB\-\-env file1,file2\fR\.
73
+ .
74
+ .TP
75
+ \fB\-f\fR, \fB\-\-procfile\fR
76
+ Specify an alternate location for the application\'s Procfile\. This file\'s containing directory will be assumed to be the root directory of the application\.
77
+ .
78
+ .SH "EXPORT FORMATS"
79
+ foreman currently supports the following output formats:
80
+ .
81
+ .IP "\(bu" 4
82
+ bluepill
83
+ .
84
+ .IP "\(bu" 4
85
+ inittab
86
+ .
87
+ .IP "\(bu" 4
88
+ runit
89
+ .
90
+ .IP "\(bu" 4
91
+ upstart
92
+ .
93
+ .IP "" 0
94
+ .
95
+ .SH "INITTAB EXPORT"
96
+ Will export a chunk of inittab\-compatible configuration:
97
+ .
98
+ .IP "" 4
99
+ .
100
+ .nf
101
+
102
+ # \-\-\-\-\- foreman example processes \-\-\-\-\-
103
+ EX01:4:respawn:/bin/su \- example \-c \'PORT=5000 bundle exec thin start >> /var/log/web\-1\.log 2>&1\'
104
+ EX02:4:respawn:/bin/su \- example \-c \'PORT=5100 bundle exec rake jobs:work >> /var/log/job\-1\.log 2>&1\'
105
+ # \-\-\-\-\- end foreman example processes \-\-\-\-\-
106
+ .
107
+ .fi
108
+ .
109
+ .IP "" 0
110
+ .
111
+ .SH "UPSTART EXPORT"
112
+ Will create a series of upstart scripts in the location you specify\. Scripts will be structured to make the following commands valid:
113
+ .
114
+ .P
115
+ \fBstart appname\fR
116
+ .
117
+ .P
118
+ \fBstop appname\-processname\fR
119
+ .
120
+ .P
121
+ \fBrestart appname\-processname\-3\fR
122
+ .
123
+ .SH "PROCFILE"
124
+ A Procfile should contain both a name for the process and the command used to run it\.
125
+ .
126
+ .IP "" 4
127
+ .
128
+ .nf
129
+
130
+ web: bundle exec thin start
131
+ job: bundle exec rake jobs:work
132
+ .
133
+ .fi
134
+ .
135
+ .IP "" 0
136
+ .
137
+ .P
138
+ A process name may contain letters, numbers amd the underscore character\. You can validate your Procfile format using the \fBcheck\fR command:
139
+ .
140
+ .IP "" 4
141
+ .
142
+ .nf
143
+
144
+ $ foreman check
145
+ .
146
+ .fi
147
+ .
148
+ .IP "" 0
149
+ .
150
+ .SH "ENVIRONMENT"
151
+ If a \fB\.env\fR file exists in the current directory, the default environment will be read from it\. This file should contain key/value pairs, separated by \fB=\fR, with one key/value pair per line\.
152
+ .
153
+ .IP "" 4
154
+ .
155
+ .nf
156
+
157
+ FOO=bar
158
+ BAZ=qux
159
+ .
160
+ .fi
161
+ .
162
+ .IP "" 0
163
+ .
164
+ .SH "DEFAULT OPTIONS"
165
+ If a \fB\.foreman\fR file exists in the current directory, default options will be read from it\. This file should be in YAML format with the long option name as keys\. Example:
166
+ .
167
+ .IP "" 4
168
+ .
169
+ .nf
170
+
171
+ concurrency: alpha=0,bravo=1
172
+ port: 15000
173
+ .
174
+ .fi
175
+ .
176
+ .IP "" 0
177
+ .
178
+ .SH "EXAMPLES"
179
+ Start one instance of each process type, interleave the output on stdout:
180
+ .
181
+ .IP "" 4
182
+ .
183
+ .nf
184
+
185
+ $ foreman start
186
+ .
187
+ .fi
188
+ .
189
+ .IP "" 0
190
+ .
191
+ .P
192
+ Export the application in upstart format:
193
+ .
194
+ .IP "" 4
195
+ .
196
+ .nf
197
+
198
+ $ foreman export upstart /etc/init
199
+ .
200
+ .fi
201
+ .
202
+ .IP "" 0
203
+ .
204
+ .P
205
+ Run one process type from the application defined in a specific Procfile:
206
+ .
207
+ .IP "" 4
208
+ .
209
+ .nf
210
+
211
+ $ foreman start alpha \-p ~/myapp/Procfile
212
+ .
213
+ .fi
214
+ .
215
+ .IP "" 0
216
+ .
217
+ .SH "COPYRIGHT"
218
+ Foreman is Copyright (C) 2010 David Dollar \fIhttp://daviddollar\.org\fR
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 99
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
- - 30
8
- - 1
9
- version: 0.30.1
8
+ - 31
9
+ - 0
10
+ version: 0.31.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - David Dollar
@@ -14,37 +15,40 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-12-23 00:00:00 -05:00
18
- default_executable:
18
+ date: 2012-01-04 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ type: :runtime
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
22
24
  requirements:
23
25
  - - ~>
24
26
  - !ruby/object:Gem::Version
27
+ hash: 29
25
28
  segments:
26
29
  - 1
27
30
  - 0
28
31
  - 5
29
32
  version: 1.0.5
30
- requirement: *id001
31
- name: term-ansicolor
33
+ version_requirements: *id001
32
34
  prerelease: false
33
- type: :runtime
35
+ name: term-ansicolor
34
36
  - !ruby/object:Gem::Dependency
35
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
+ type: :runtime
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
36
40
  requirements:
37
41
  - - ">="
38
42
  - !ruby/object:Gem::Version
43
+ hash: 39
39
44
  segments:
40
45
  - 0
41
46
  - 13
42
47
  - 6
43
48
  version: 0.13.6
44
- requirement: *id002
45
- name: thor
49
+ version_requirements: *id002
46
50
  prerelease: false
47
- type: :runtime
51
+ name: thor
48
52
  description: Process manager for applications with multiple components
49
53
  email: ddollar@gmail.com
50
54
  executables:
@@ -105,7 +109,7 @@ files:
105
109
  - spec/resources/export/upstart/app-bravo.conf
106
110
  - spec/resources/export/upstart/app.conf
107
111
  - spec/spec_helper.rb
108
- has_rdoc: true
112
+ - man/foreman.1
109
113
  homepage: http://github.com/ddollar/foreman
110
114
  licenses: []
111
115
 
@@ -115,23 +119,27 @@ rdoc_options: []
115
119
  require_paths:
116
120
  - lib
117
121
  required_ruby_version: !ruby/object:Gem::Requirement
122
+ none: false
118
123
  requirements:
119
124
  - - ">="
120
125
  - !ruby/object:Gem::Version
126
+ hash: 3
121
127
  segments:
122
128
  - 0
123
129
  version: "0"
124
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
+ none: false
125
132
  requirements:
126
133
  - - ">="
127
134
  - !ruby/object:Gem::Version
135
+ hash: 3
128
136
  segments:
129
137
  - 0
130
138
  version: "0"
131
139
  requirements: []
132
140
 
133
141
  rubyforge_project:
134
- rubygems_version: 1.3.6
142
+ rubygems_version: 1.8.10
135
143
  signing_key:
136
144
  specification_version: 3
137
145
  summary: Process manager for applications with multiple components