foreman 0.64.0 → 0.65.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ Bluepill.application("<%= app %>", :foreground => false, :log_file => "/var/log/
7
7
  <% 1.upto(engine.formation[name]) do |num| %>
8
8
  <% port = engine.port_for(process, num) %>
9
9
  app.process("<%= name %>-<%= num %>") do |process|
10
- process.start_command = "<%= process.command %>"
10
+ process.start_command = %Q{<%= process.command %>}
11
11
 
12
12
  process.working_dir = "<%= engine.root %>"
13
13
  process.daemonize = true
@@ -3,5 +3,5 @@ set -e
3
3
 
4
4
  LOG=<%= log %>/<%= name %>-<%= num %>
5
5
 
6
- test -d "$LOG" || mkdir -p m2750 "$LOG" && chown <%= user %> "$LOG"
6
+ test -d "$LOG" || mkdir -p -m 2750 "$LOG" && chown <%= user %> "$LOG"
7
7
  exec chpst -u <%= user %> svlogd "$LOG"
@@ -1,3 +1,4 @@
1
1
  #!/bin/sh
2
2
  cd <%= engine.root %>
3
+ exec 2>&1
3
4
  exec chpst -u <%= user %> -e <%= File.join(location, "#{process_directory}/env") %> <%= process.command %>
@@ -5,7 +5,7 @@ engine.each_process do |name, process|
5
5
  port = engine.port_for(process, num)
6
6
  full_name = "#{app}-#{name}-#{num}"
7
7
  environment = engine.env.merge("PORT" => port.to_s).map do |key, value|
8
- "#{key}=#{shell_quote(value)}"
8
+ "#{key}=\"#{shell_quote(value)}\""
9
9
  end
10
10
  app_names << full_name
11
11
  %>
@@ -1 +1,6 @@
1
1
  [Unit]
2
+ StopWhenUnneeded=true
3
+ Wants=<%= process_master_names.join(' ') %>
4
+
5
+ [Install]
6
+ WantedBy=multi-user.target
@@ -13,6 +13,3 @@ StandardOutput=syslog
13
13
  StandardError=syslog
14
14
  SyslogIdentifier=%n
15
15
  KillMode=process
16
-
17
- [Install]
18
- WantedBy=<%= app %>-<%= name %>.target
@@ -1,5 +1,3 @@
1
1
  [Unit]
2
2
  StopWhenUnneeded=true
3
-
4
- [Install]
5
- WantedBy=<%= app %>.target
3
+ Wants=<%= process_names.join(' ') %>
@@ -1,12 +1,2 @@
1
- pre-start script
2
-
3
- bash << "EOF"
4
- mkdir -p <%= log %>
5
- chown -R <%= user %> <%= log %>
6
- EOF
7
-
8
- end script
9
-
10
1
  start on runlevel [2345]
11
-
12
- stop on runlevel [016]
2
+ stop on runlevel [!2345]
@@ -2,4 +2,13 @@ start on starting <%= app %>-<%= name %>
2
2
  stop on stopping <%= app %>-<%= name %>
3
3
  respawn
4
4
 
5
- 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'
5
+ env PORT=<%= port %>
6
+ <% engine.env.each do |name,value| -%>
7
+ env <%= name.upcase %>='<%= value.gsub(/'/, "'\"'\"'") %>'
8
+ <% end -%>
9
+
10
+ setuid <%= user %>
11
+
12
+ chdir <%= engine.root %>
13
+
14
+ exec <%= process.command %>
@@ -46,10 +46,8 @@ class Foreman::Export::Base
46
46
  def export
47
47
  error("Must specify a location") unless location
48
48
  FileUtils.mkdir_p(location) rescue error("Could not create: #{location}")
49
- FileUtils.mkdir_p(log) rescue error("Could not create: #{log}")
50
- FileUtils.mkdir_p(run) rescue error("Could not create: #{run}")
51
- FileUtils.chown(user, nil, log) rescue error("Could not chown #{log} to #{user}")
52
- FileUtils.chown(user, nil, run) rescue error("Could not chown #{run} to #{user}")
49
+ chown user, log
50
+ chown user, run
53
51
  end
54
52
 
55
53
  def app
@@ -82,6 +80,12 @@ private ######################################################################
82
80
  @@deprecation_warned = true
83
81
  end
84
82
 
83
+ def chown user, dir
84
+ FileUtils.chown user, nil, dir
85
+ rescue
86
+ error("Could not chown #{dir} to #{user}") unless File.writable? dir
87
+ end
88
+
85
89
  def error(message)
86
90
  raise Foreman::Export::Exception.new(message)
87
91
  end
@@ -8,7 +8,12 @@ class Foreman::Export::Launchd < Foreman::Export::Base
8
8
  engine.each_process do |name, process|
9
9
  1.upto(engine.formation[name]) do |num|
10
10
  port = engine.port_for(process, num)
11
- command_args = process.command.split(" ")
11
+ command_args = process.command.split(/\s+/).map{|arg|
12
+ case arg
13
+ when "$PORT" then port
14
+ else arg
15
+ end
16
+ }
12
17
  write_template "launchd/launchd.plist.erb", "#{app}-#{name}-#{num}.plist", binding
13
18
  end
14
19
  end
@@ -10,16 +10,23 @@ class Foreman::Export::Systemd < Foreman::Export::Base
10
10
  clean file
11
11
  end
12
12
 
13
- write_template "systemd/master.target.erb", "#{app}.target", binding
13
+ process_master_names = []
14
14
 
15
15
  engine.each_process do |name, process|
16
16
  next if engine.formation[name] < 1
17
- write_template "systemd/process_master.target.erb", "#{app}-#{name}.target", binding
17
+
18
+ process_names = []
18
19
 
19
20
  1.upto(engine.formation[name]) do |num|
20
21
  port = engine.port_for(process, num)
21
22
  write_template "systemd/process.service.erb", "#{app}-#{name}-#{num}.service", binding
23
+ process_names << "#{app}-#{name}-#{num}.service"
22
24
  end
25
+
26
+ write_template "systemd/process_master.target.erb", "#{app}-#{name}.target", binding
27
+ process_master_names << "#{app}-#{name}.target"
23
28
  end
29
+
30
+ write_template "systemd/master.target.erb", "#{app}.target", binding
24
31
  end
25
32
  end
@@ -59,7 +59,7 @@ class Foreman::Process
59
59
  wrapped_command = "#{runner} -d '#{cwd.shellescape}' -p -- #{expanded_command(env)}"
60
60
  POSIX::Spawn.spawn(*spawn_args(env, wrapped_command.shellsplit, {:out => output, :err => output}))
61
61
  else
62
- wrapped_command = "#{runner} -d '#{cwd.shellescape}' -p -- #{command}"
62
+ wrapped_command = "exec #{runner} -d '#{cwd.shellescape}' -p -- #{command}"
63
63
  Process.spawn env, wrapped_command, :out => output, :err => output
64
64
  end
65
65
  end
@@ -1,5 +1,5 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.64.0"
3
+ VERSION = "0.65.0"
4
4
 
5
5
  end
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "FOREMAN" "1" "April 2014" "Foreman 0.64.0" "Foreman Manual"
4
+ .TH "FOREMAN" "1" "April 2014" "Foreman 0.65.0" "Foreman Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBforeman\fR \- manage Procfile\-based applications
@@ -3,5 +3,5 @@ set -e
3
3
 
4
4
  LOG=/var/log/app/alpha-1
5
5
 
6
- test -d "$LOG" || mkdir -p m2750 "$LOG" && chown app "$LOG"
6
+ test -d "$LOG" || mkdir -p -m 2750 "$LOG" && chown app "$LOG"
7
7
  exec chpst -u app svlogd "$LOG"
@@ -3,5 +3,5 @@ set -e
3
3
 
4
4
  LOG=/var/log/app/alpha-2
5
5
 
6
- test -d "$LOG" || mkdir -p m2750 "$LOG" && chown app "$LOG"
6
+ test -d "$LOG" || mkdir -p -m 2750 "$LOG" && chown app "$LOG"
7
7
  exec chpst -u app svlogd "$LOG"
@@ -3,5 +3,5 @@ set -e
3
3
 
4
4
  LOG=/var/log/app/bravo-1
5
5
 
6
- test -d "$LOG" || mkdir -p m2750 "$LOG" && chown app "$LOG"
6
+ test -d "$LOG" || mkdir -p -m 2750 "$LOG" && chown app "$LOG"
7
7
  exec chpst -u app svlogd "$LOG"
@@ -8,7 +8,7 @@ stdout_logfile=/var/log/app/alpha-1.log
8
8
  stderr_logfile=/var/log/app/alpha-1.error.log
9
9
  user=app
10
10
  directory=/tmp/app
11
- environment=PORT=5000
11
+ environment=PORT="5000"
12
12
  [program:app-bravo-1]
13
13
  command=./bravo
14
14
  autostart=true
@@ -18,7 +18,7 @@ stdout_logfile=/var/log/app/bravo-1.log
18
18
  stderr_logfile=/var/log/app/bravo-1.error.log
19
19
  user=app
20
20
  directory=/tmp/app
21
- environment=PORT=5100
21
+ environment=PORT="5100"
22
22
  [program:app-foo_bar-1]
23
23
  command=./foo_bar
24
24
  autostart=true
@@ -28,7 +28,7 @@ stdout_logfile=/var/log/app/foo_bar-1.log
28
28
  stderr_logfile=/var/log/app/foo_bar-1.error.log
29
29
  user=app
30
30
  directory=/tmp/app
31
- environment=PORT=5200
31
+ environment=PORT="5200"
32
32
  [program:app-foo-bar-1]
33
33
  command=./foo-bar
34
34
  autostart=true
@@ -38,7 +38,7 @@ stdout_logfile=/var/log/app/foo-bar-1.log
38
38
  stderr_logfile=/var/log/app/foo-bar-1.error.log
39
39
  user=app
40
40
  directory=/tmp/app
41
- environment=PORT=5300
41
+ environment=PORT="5300"
42
42
 
43
43
  [group:app]
44
44
  programs=app-alpha-1,app-bravo-1,app-foo_bar-1,app-foo-bar-1
@@ -8,7 +8,7 @@ stdout_logfile=/var/log/app/alpha-1.log
8
8
  stderr_logfile=/var/log/app/alpha-1.error.log
9
9
  user=app
10
10
  directory=/tmp/app
11
- environment=PORT=5000
11
+ environment=PORT="5000"
12
12
  [program:app-alpha-2]
13
13
  command=./alpha
14
14
  autostart=true
@@ -18,7 +18,7 @@ stdout_logfile=/var/log/app/alpha-2.log
18
18
  stderr_logfile=/var/log/app/alpha-2.error.log
19
19
  user=app
20
20
  directory=/tmp/app
21
- environment=PORT=5001
21
+ environment=PORT="5001"
22
22
 
23
23
  [group:app]
24
24
  programs=app-alpha-1,app-alpha-2
metadata CHANGED
@@ -1,32 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.64.0
4
+ version: 0.65.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: 2014-04-22 00:00:00.000000000 Z
12
+ date: 2014-04-23 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: thor
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ~>
18
20
  - !ruby/object:Gem::Version
19
- version: 0.13.6
21
+ version: 0.19.1
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ~>
25
28
  - !ruby/object:Gem::Version
26
- version: 0.13.6
29
+ version: 0.19.1
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: dotenv
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -47,7 +52,6 @@ extra_rdoc_files: []
47
52
  files:
48
53
  - bin/foreman
49
54
  - bin/foreman-runner
50
- - bin/taskman
51
55
  - data/example/error
52
56
  - data/example/log/neverdie.log
53
57
  - data/example/Procfile
@@ -150,26 +154,33 @@ files:
150
154
  homepage: http://github.com/ddollar/foreman
151
155
  licenses:
152
156
  - MIT
153
- metadata: {}
154
157
  post_install_message:
155
158
  rdoc_options: []
156
159
  require_paths:
157
160
  - lib
158
161
  required_ruby_version: !ruby/object:Gem::Requirement
162
+ none: false
159
163
  requirements:
160
- - - '>='
164
+ - - ! '>='
161
165
  - !ruby/object:Gem::Version
162
166
  version: '0'
167
+ segments:
168
+ - 0
169
+ hash: -58308520584427646
163
170
  required_rubygems_version: !ruby/object:Gem::Requirement
171
+ none: false
164
172
  requirements:
165
- - - '>='
173
+ - - ! '>='
166
174
  - !ruby/object:Gem::Version
167
175
  version: '0'
176
+ segments:
177
+ - 0
178
+ hash: -58308520584427646
168
179
  requirements: []
169
180
  rubyforge_project:
170
- rubygems_version: 2.0.0
181
+ rubygems_version: 1.8.23
171
182
  signing_key:
172
- specification_version: 4
183
+ specification_version: 3
173
184
  summary: Process manager for applications with multiple components
174
185
  test_files: []
175
186
  has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: bbb82e88b1e4cc986e7af63cc6d631fa04a3835f
4
- data.tar.gz: 628e407c7dc4c6b1c45feae01f0721226015fc77
5
- SHA512:
6
- metadata.gz: 97b7f37dd66b6d5959c68b02f088e1d13f9ca5e0521020e44134d720ad985498eddb3e6694c1718c84263bbfd50e6ec2a6807ad19ae6c2f615a1c278f1b9f925
7
- data.tar.gz: a5233b13f6516fd91fbdac8919d97b5c9538e84147a937bc6c9b071f0eed55a09f8fe3016c66d67d1036528a104b0eff04ed4d82fcba32bd800466911a1df013
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $:.unshift File.expand_path("../../lib", __FILE__)
4
-
5
- require "foreman/cli"
6
-
7
- Foreman::CLI.engine_class = Foreman::TmuxEngine
8
- Foreman::CLI.start