Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
199e7de97c | ||
|
|
defc40b911 | ||
|
|
37dcba0e33 | ||
|
|
d205e3ba2e | ||
|
|
9905334f01 | ||
|
|
dd292ed7da | ||
|
|
67ffbe2aa2 | ||
|
|
da8bba5941 | ||
|
|
2aa1cbf94f | ||
|
|
34a1163fe9 | ||
|
|
2e5f610b76 | ||
|
|
20392d98a1 | ||
|
|
e8538d9f45 | ||
|
|
4a51a2aa8a |
+1
-2
@@ -3,8 +3,6 @@ script: bundle exec rake spec
|
|||||||
matrix:
|
matrix:
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- rvm: jruby
|
- rvm: jruby
|
||||||
- rvm: rbx
|
|
||||||
- rvm: ree
|
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
@@ -19,4 +17,5 @@ rvm:
|
|||||||
- 1.9.2
|
- 1.9.2
|
||||||
- 1.9.3
|
- 1.9.3
|
||||||
- 2.0.0
|
- 2.0.0
|
||||||
|
- 2.1.0
|
||||||
- jruby
|
- jruby
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ group :development do
|
|||||||
gem 'rr', '~> 1.0.2'
|
gem 'rr', '~> 1.0.2'
|
||||||
gem 'rspec', '~> 2.0'
|
gem 'rspec', '~> 2.0'
|
||||||
gem "simplecov", :require => false
|
gem "simplecov", :require => false
|
||||||
gem 'timecop'
|
gem 'timecop', '0.6.1'
|
||||||
gem 'yard'
|
gem 'yard'
|
||||||
|
gem 'mime-types', '~> 1.25.1'
|
||||||
|
gem 'rdiscount', '~> 1.6.8'
|
||||||
end
|
end
|
||||||
|
|||||||
+33
-29
@@ -8,44 +8,46 @@ PATH
|
|||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
aws-s3 (0.6.2)
|
aws-s3 (0.6.3)
|
||||||
builder
|
builder
|
||||||
mime-types
|
mime-types
|
||||||
xml-simple
|
xml-simple
|
||||||
builder (3.0.0)
|
builder (3.2.2)
|
||||||
diff-lcs (1.1.3)
|
diff-lcs (1.2.5)
|
||||||
dotenv (0.7.0)
|
docile (1.1.3)
|
||||||
|
dotenv (0.10.0)
|
||||||
fakefs (0.3.2)
|
fakefs (0.3.2)
|
||||||
hpricot (0.8.6)
|
hpricot (0.8.6)
|
||||||
hpricot (0.8.6-java)
|
hpricot (0.8.6-java)
|
||||||
mime-types (1.16)
|
mime-types (1.25.1)
|
||||||
multi_json (1.0.4)
|
multi_json (1.9.0)
|
||||||
mustache (0.11.2)
|
mustache (0.99.5)
|
||||||
posix-spawn (0.3.6)
|
posix-spawn (0.3.8)
|
||||||
rake (0.9.2.2)
|
rake (10.1.1)
|
||||||
rdiscount (1.6.5)
|
rdiscount (1.6.8)
|
||||||
ronn (0.7.3)
|
ronn (0.7.3)
|
||||||
hpricot (>= 0.8.2)
|
hpricot (>= 0.8.2)
|
||||||
mustache (>= 0.7.0)
|
mustache (>= 0.7.0)
|
||||||
rdiscount (>= 1.5.8)
|
rdiscount (>= 1.5.8)
|
||||||
rr (1.0.2)
|
rr (1.0.5)
|
||||||
rspec (2.8.0)
|
rspec (2.14.1)
|
||||||
rspec-core (~> 2.8.0)
|
rspec-core (~> 2.14.0)
|
||||||
rspec-expectations (~> 2.8.0)
|
rspec-expectations (~> 2.14.0)
|
||||||
rspec-mocks (~> 2.8.0)
|
rspec-mocks (~> 2.14.0)
|
||||||
rspec-core (2.8.0)
|
rspec-core (2.14.8)
|
||||||
rspec-expectations (2.8.0)
|
rspec-expectations (2.14.5)
|
||||||
diff-lcs (~> 1.1.2)
|
diff-lcs (>= 1.1.3, < 2.0)
|
||||||
rspec-mocks (2.8.0)
|
rspec-mocks (2.14.6)
|
||||||
simplecov (0.5.4)
|
simplecov (0.8.2)
|
||||||
multi_json (~> 1.0.3)
|
docile (~> 1.1.0)
|
||||||
simplecov-html (~> 0.5.3)
|
multi_json
|
||||||
simplecov-html (0.5.3)
|
simplecov-html (~> 0.8.0)
|
||||||
thor (0.16.0)
|
simplecov-html (0.8.0)
|
||||||
timecop (0.3.5)
|
thor (0.18.1)
|
||||||
win32console (1.3.0-x86-mingw32)
|
timecop (0.6.1)
|
||||||
xml-simple (1.0.15)
|
win32console (1.3.2-x86-mingw32)
|
||||||
yard (0.8.2)
|
xml-simple (1.1.3)
|
||||||
|
yard (0.8.7.3)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
java
|
java
|
||||||
@@ -56,12 +58,14 @@ DEPENDENCIES
|
|||||||
aws-s3
|
aws-s3
|
||||||
fakefs (~> 0.3.2)
|
fakefs (~> 0.3.2)
|
||||||
foreman!
|
foreman!
|
||||||
|
mime-types (~> 1.25.1)
|
||||||
posix-spawn (~> 0.3.6)
|
posix-spawn (~> 0.3.6)
|
||||||
rake
|
rake
|
||||||
|
rdiscount (~> 1.6.8)
|
||||||
ronn
|
ronn
|
||||||
rr (~> 1.0.2)
|
rr (~> 1.0.2)
|
||||||
rspec (~> 2.0)
|
rspec (~> 2.0)
|
||||||
simplecov
|
simplecov
|
||||||
timecop
|
timecop (= 0.6.1)
|
||||||
win32console (~> 1.3.0)
|
win32console (~> 1.3.0)
|
||||||
yard
|
yard
|
||||||
|
|||||||
@@ -1 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
|
StopWhenUnneeded=true
|
||||||
|
Wants=<%= process_master_names.join(' ') %>
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|||||||
@@ -13,6 +13,3 @@ StandardOutput=syslog
|
|||||||
StandardError=syslog
|
StandardError=syslog
|
||||||
SyslogIdentifier=%n
|
SyslogIdentifier=%n
|
||||||
KillMode=process
|
KillMode=process
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=<%= app %>-<%= name %>.target
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
StopWhenUnneeded=true
|
StopWhenUnneeded=true
|
||||||
|
Wants=<%= process_names.join(' ') %>
|
||||||
[Install]
|
|
||||||
WantedBy=<%= app %>.target
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ start on starting <%= app %>-<%= name %>
|
|||||||
stop on stopping <%= app %>-<%= name %>
|
stop on stopping <%= app %>-<%= name %>
|
||||||
respawn
|
respawn
|
||||||
|
|
||||||
exec su - <%= user %> -c 'cd <%= engine.root %>; export PORT=<%= port %>;<% engine.env.each_pair do |var,env| %> export <%= var.upcase %>=<%= shell_quote(env) %>; <% end %> <%= process.command %> >> <%= log %>/<%=name%>-<%=num%>.log 2>&1'
|
exec su - <%= user %> -s /bin/sh -c 'cd <%= engine.root %>; export PORT=<%= port %>;<% engine.env.each_pair do |var,env| %> export <%= var.upcase %>=<%= shell_quote(env) %>; <% end %> exec <%= process.command %> >> <%= log %>/<%=name%>-<%=num%>.log 2>&1'
|
||||||
|
|||||||
+10
-14
@@ -83,22 +83,18 @@ class Foreman::CLI < Thor
|
|||||||
engine.load_procfile(procfile)
|
engine.load_procfile(procfile)
|
||||||
end
|
end
|
||||||
|
|
||||||
pid = fork do
|
begin
|
||||||
begin
|
engine.env.each { |k,v| ENV[k] = v }
|
||||||
engine.env.each { |k,v| ENV[k] = v }
|
if args.size == 1 && process = engine.process(args.first)
|
||||||
if args.size == 1 && process = engine.process(args.first)
|
process.exec(:env => engine.env)
|
||||||
process.exec(:env => engine.env)
|
else
|
||||||
else
|
exec args.shelljoin
|
||||||
exec args.shelljoin
|
|
||||||
end
|
|
||||||
rescue Errno::EACCES
|
|
||||||
error "not executable: #{args.first}"
|
|
||||||
rescue Errno::ENOENT
|
|
||||||
error "command not found: #{args.first}"
|
|
||||||
end
|
end
|
||||||
|
rescue Errno::EACCES
|
||||||
|
error "not executable: #{args.first}"
|
||||||
|
rescue Errno::ENOENT
|
||||||
|
error "command not found: #{args.first}"
|
||||||
end
|
end
|
||||||
Process.wait(pid)
|
|
||||||
exit $?.exitstatus
|
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "version", "Display Foreman gem version"
|
desc "version", "Display Foreman gem version"
|
||||||
|
|||||||
+8
-20
@@ -176,19 +176,14 @@ class Foreman::Engine
|
|||||||
#
|
#
|
||||||
# @param [String] signal The signal to send to each process
|
# @param [String] signal The signal to send to each process
|
||||||
#
|
#
|
||||||
def kill_children(signal="SIGTERM")
|
def kill_children( signal="SIGTERM" )
|
||||||
if Foreman.windows?
|
@running.each do |pid, (process, index)|
|
||||||
@running.each do |pid, (process, index)|
|
system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
|
||||||
system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
|
|
||||||
begin
|
|
||||||
Process.kill(signal, pid)
|
|
||||||
rescue Errno::ESRCH, Errno::EPERM
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
begin
|
||||||
Process.kill signal, *@running.keys unless @running.empty?
|
Process.kill( signal, pid )
|
||||||
rescue Errno::ESRCH, Errno::EPERM
|
rescue Errno::ESRCH, Errno::EPERM => err
|
||||||
|
system " %p when sending signal %p to pid %d: %s" %
|
||||||
|
[ err.class, signal, pid, err.message ]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -198,14 +193,7 @@ class Foreman::Engine
|
|||||||
# @param [String] signal The signal to send
|
# @param [String] signal The signal to send
|
||||||
#
|
#
|
||||||
def killall(signal="SIGTERM")
|
def killall(signal="SIGTERM")
|
||||||
if Foreman.windows?
|
kill_children(signal)
|
||||||
kill_children(signal)
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
Process.kill "-#{signal}", Process.pid
|
|
||||||
rescue Errno::ESRCH, Errno::EPERM
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get the process formation
|
# Get the process formation
|
||||||
|
|||||||
@@ -10,16 +10,23 @@ class Foreman::Export::Systemd < Foreman::Export::Base
|
|||||||
clean file
|
clean file
|
||||||
end
|
end
|
||||||
|
|
||||||
write_template "systemd/master.target.erb", "#{app}.target", binding
|
process_master_names = []
|
||||||
|
|
||||||
engine.each_process do |name, process|
|
engine.each_process do |name, process|
|
||||||
next if engine.formation[name] < 1
|
next if engine.formation[name] < 1
|
||||||
write_template "systemd/process_master.target.erb", "#{app}-#{name}.target", binding
|
|
||||||
|
process_names = []
|
||||||
|
|
||||||
1.upto(engine.formation[name]) do |num|
|
1.upto(engine.formation[name]) do |num|
|
||||||
port = engine.port_for(process, num)
|
port = engine.port_for(process, num)
|
||||||
write_template "systemd/process.service.erb", "#{app}-#{name}-#{num}.service", binding
|
write_template "systemd/process.service.erb", "#{app}-#{name}-#{num}.service", binding
|
||||||
|
process_names << "#{app}-#{name}-#{num}.service"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
write_template "systemd/process_master.target.erb", "#{app}-#{name}.target", binding
|
||||||
|
process_master_names << "#{app}-#{name}.target"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
write_template "systemd/master.target.erb", "#{app}.target", binding
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,6 +31,6 @@ describe Foreman::Export::Runit, :fakefs do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "creates a full path to the export directory" do
|
it "creates a full path to the export directory" do
|
||||||
expect { runit.export }.to_not raise_error(Errno::ENOENT)
|
expect { runit.export }.to_not raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-1
@@ -177,5 +177,5 @@ RSpec.configure do |config|
|
|||||||
config.order = 'rand'
|
config.order = 'rand'
|
||||||
config.include FakeFS::SpecHelpers, :fakefs
|
config.include FakeFS::SpecHelpers, :fakefs
|
||||||
config.mock_with :rr
|
config.mock_with :rr
|
||||||
config.backtrace_clean_patterns = []
|
config.backtrace_exclusion_patterns = []
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user