foreman_debian 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7971faa8f4ca6bfa0014a2109f40dbb6393c9a38
|
4
|
+
data.tar.gz: 80659136f7cb9233312455d85953c22c78397277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2273945251adfe25774f1da888576d955a88fec40f7b1285c9fd4dfd14e4f64b1715228a9c17f8be5bc83c9e5549c3e876bd63ff7bd2e4ee46ba9c278dd3e19
|
7
|
+
data.tar.gz: 5fbeaec424c57cdbaecd14ea06fd331d08ccaba78aed9b23acf9bef10794c0db032b5e098ebb80e2d0ec7c06ea116736e4682a65c71142527034874b01a2a49c
|
@@ -4,6 +4,10 @@ module ForemanDebian
|
|
4
4
|
option %w(-f --procfile), '<path>', 'alternative Procfile',
|
5
5
|
:attribute_name => :procfile_path_relative
|
6
6
|
|
7
|
+
option %w(-u --user), '<user>', 'Specify the user the application should be run as',
|
8
|
+
:attribute_name => :user,
|
9
|
+
:default => 'root'
|
10
|
+
|
7
11
|
option %w(-c --concurrency), '<encoded_hash>', 'concurrency (job1=0,job2=1)',
|
8
12
|
:attribute_name => :concurrency_encoded,
|
9
13
|
:default => 'all=1'
|
@@ -18,7 +22,7 @@ module ForemanDebian
|
|
18
22
|
jobs[name] = expand_procfile_command(command)
|
19
23
|
end
|
20
24
|
concurrency = decode_concurrency(concurrency_encoded)
|
21
|
-
get_engine.install(jobs, concurrency)
|
25
|
+
get_engine.install(jobs, concurrency, user)
|
22
26
|
end
|
23
27
|
|
24
28
|
def expand_procfile_command(command)
|
@@ -4,15 +4,12 @@ module ForemanDebian
|
|
4
4
|
class Command < Clamp::Command
|
5
5
|
|
6
6
|
option %w(-a --app), '<name>', 'application name',
|
7
|
-
:attribute_name => :
|
7
|
+
:attribute_name => :app,
|
8
8
|
:default => 'app'
|
9
|
-
option %w(-u --user), '<user>', 'Specify the user the application should be run as',
|
10
|
-
:attribute_name => :app_user,
|
11
|
-
:default => 'root'
|
12
9
|
|
13
10
|
# @return [ForemanDebian::Engine]
|
14
11
|
def get_engine
|
15
|
-
ForemanDebian::Engine.new(
|
12
|
+
ForemanDebian::Engine.new(app)
|
16
13
|
end
|
17
14
|
end
|
18
15
|
end
|
@@ -1,35 +1,35 @@
|
|
1
1
|
module ForemanDebian
|
2
2
|
class Engine
|
3
3
|
|
4
|
-
def initialize(app
|
4
|
+
def initialize(app)
|
5
5
|
@app = app
|
6
|
-
@user = user
|
7
|
-
@initd_engine = Initd::Engine.new(@app, @user)
|
8
|
-
@monit_engine = Monit::Engine.new(@app, @user)
|
9
6
|
end
|
10
7
|
|
11
|
-
def install(jobs, concurrency)
|
8
|
+
def install(jobs, concurrency, user)
|
9
|
+
initd_engine = Initd::Engine.new(@app)
|
10
|
+
monit_engine = Monit::Engine.new(@app)
|
12
11
|
jobs.each do |name, command|
|
13
12
|
if job_concurrency(concurrency, name) > 0
|
14
|
-
script = @initd_engine.create_script(name, command)
|
15
|
-
|
16
|
-
|
13
|
+
script = @initd_engine.create_script(name, command, user)
|
14
|
+
initd_engine.install(script)
|
15
|
+
monit_engine.install(name, script)
|
17
16
|
end
|
18
17
|
end
|
19
|
-
|
20
|
-
|
18
|
+
initd_engine.cleanup
|
19
|
+
monit_engine.cleanup
|
21
20
|
end
|
22
21
|
|
23
22
|
def uninstall
|
24
|
-
|
23
|
+
Initd::Engine.new(@app).cleanup
|
24
|
+
Monit::Engine.new(@app).cleanup
|
25
25
|
end
|
26
26
|
|
27
27
|
def start
|
28
|
-
@
|
28
|
+
Initd::Engine.new(@app).start
|
29
29
|
end
|
30
30
|
|
31
31
|
def stop
|
32
|
-
@
|
32
|
+
Initd::Engine.new(@app).stop
|
33
33
|
end
|
34
34
|
|
35
35
|
def job_concurrency(concurrency, name)
|
@@ -4,21 +4,20 @@ module ForemanDebian
|
|
4
4
|
|
5
5
|
include ForemanDebian::EngineHelper
|
6
6
|
|
7
|
-
def initialize(app,
|
7
|
+
def initialize(app, export_path = nil)
|
8
8
|
@app = app
|
9
|
-
@user = user
|
10
9
|
@export_path = Pathname.new(export_path || '/etc/init.d')
|
11
10
|
@system_export_path = Pathname.new('/etc/init.d')
|
12
11
|
setup
|
13
12
|
end
|
14
13
|
|
15
|
-
def create_script(name, command)
|
14
|
+
def create_script(name, command, user)
|
16
15
|
pidfile = pidfile(name)
|
17
16
|
args = Shellwords.split(command)
|
18
17
|
script = args.shift
|
19
18
|
name = "#{@app}-#{name}"
|
20
19
|
script_path = @export_path.join(name)
|
21
|
-
Script.new(script_path, name, name,
|
20
|
+
Script.new(script_path, name, name, user, script, args, pidfile)
|
22
21
|
end
|
23
22
|
|
24
23
|
def install(script)
|