overman 0.0.1 → 0.87.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +52 -0
  3. data/bin/foreman-runner +41 -0
  4. data/bin/overman +7 -0
  5. data/data/example/Procfile +4 -0
  6. data/data/example/Procfile.without_colon +2 -0
  7. data/data/example/error +7 -0
  8. data/data/example/log/neverdie.log +4 -0
  9. data/data/example/spawnee +14 -0
  10. data/data/example/spawner +7 -0
  11. data/data/example/ticker +14 -0
  12. data/data/example/utf8 +11 -0
  13. data/data/export/bluepill/master.pill.erb +28 -0
  14. data/data/export/daemon/master.conf.erb +14 -0
  15. data/data/export/daemon/process.conf.erb +8 -0
  16. data/data/export/daemon/process_master.conf.erb +2 -0
  17. data/data/export/launchd/launchd.plist.erb +33 -0
  18. data/data/export/runit/log/run.erb +7 -0
  19. data/data/export/runit/run.erb +4 -0
  20. data/data/export/supervisord/app.conf.erb +31 -0
  21. data/data/export/systemd/master.target.erb +5 -0
  22. data/data/export/systemd/process.service.erb +21 -0
  23. data/data/export/upstart/master.conf.erb +2 -0
  24. data/data/export/upstart/process.conf.erb +15 -0
  25. data/data/export/upstart/process_master.conf.erb +2 -0
  26. data/lib/foreman/cli.rb +162 -0
  27. data/lib/foreman/distribution.rb +9 -0
  28. data/lib/foreman/engine/cli.rb +105 -0
  29. data/lib/foreman/engine.rb +494 -0
  30. data/lib/foreman/env.rb +29 -0
  31. data/lib/foreman/export/base.rb +171 -0
  32. data/lib/foreman/export/bluepill.rb +12 -0
  33. data/lib/foreman/export/daemon.rb +28 -0
  34. data/lib/foreman/export/inittab.rb +42 -0
  35. data/lib/foreman/export/launchd.rb +22 -0
  36. data/lib/foreman/export/runit.rb +34 -0
  37. data/lib/foreman/export/supervisord.rb +16 -0
  38. data/lib/foreman/export/systemd.rb +34 -0
  39. data/lib/foreman/export/upstart.rb +46 -0
  40. data/lib/foreman/export.rb +36 -0
  41. data/lib/foreman/helpers.rb +45 -0
  42. data/lib/foreman/process.rb +81 -0
  43. data/lib/foreman/procfile.rb +94 -0
  44. data/lib/foreman/vendor/thor/lib/thor/actions/create_file.rb +103 -0
  45. data/lib/foreman/vendor/thor/lib/thor/actions/create_link.rb +59 -0
  46. data/lib/foreman/vendor/thor/lib/thor/actions/directory.rb +118 -0
  47. data/lib/foreman/vendor/thor/lib/thor/actions/empty_directory.rb +135 -0
  48. data/lib/foreman/vendor/thor/lib/thor/actions/file_manipulation.rb +327 -0
  49. data/lib/foreman/vendor/thor/lib/thor/actions/inject_into_file.rb +103 -0
  50. data/lib/foreman/vendor/thor/lib/thor/actions.rb +318 -0
  51. data/lib/foreman/vendor/thor/lib/thor/base.rb +656 -0
  52. data/lib/foreman/vendor/thor/lib/thor/command.rb +133 -0
  53. data/lib/foreman/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +85 -0
  54. data/lib/foreman/vendor/thor/lib/thor/core_ext/io_binary_read.rb +12 -0
  55. data/lib/foreman/vendor/thor/lib/thor/core_ext/ordered_hash.rb +129 -0
  56. data/lib/foreman/vendor/thor/lib/thor/error.rb +32 -0
  57. data/lib/foreman/vendor/thor/lib/thor/group.rb +281 -0
  58. data/lib/foreman/vendor/thor/lib/thor/invocation.rb +177 -0
  59. data/lib/foreman/vendor/thor/lib/thor/line_editor/basic.rb +35 -0
  60. data/lib/foreman/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
  61. data/lib/foreman/vendor/thor/lib/thor/line_editor.rb +17 -0
  62. data/lib/foreman/vendor/thor/lib/thor/parser/argument.rb +70 -0
  63. data/lib/foreman/vendor/thor/lib/thor/parser/arguments.rb +175 -0
  64. data/lib/foreman/vendor/thor/lib/thor/parser/option.rb +146 -0
  65. data/lib/foreman/vendor/thor/lib/thor/parser/options.rb +220 -0
  66. data/lib/foreman/vendor/thor/lib/thor/parser.rb +4 -0
  67. data/lib/foreman/vendor/thor/lib/thor/rake_compat.rb +71 -0
  68. data/lib/foreman/vendor/thor/lib/thor/runner.rb +322 -0
  69. data/lib/foreman/vendor/thor/lib/thor/shell/basic.rb +436 -0
  70. data/lib/foreman/vendor/thor/lib/thor/shell/color.rb +149 -0
  71. data/lib/foreman/vendor/thor/lib/thor/shell/html.rb +126 -0
  72. data/lib/foreman/vendor/thor/lib/thor/shell.rb +81 -0
  73. data/lib/foreman/vendor/thor/lib/thor/util.rb +268 -0
  74. data/lib/foreman/vendor/thor/lib/thor/version.rb +3 -0
  75. data/lib/foreman/vendor/thor/lib/thor.rb +492 -0
  76. data/lib/foreman/version.rb +5 -0
  77. data/lib/foreman.rb +17 -0
  78. data/man/overman.1 +284 -0
  79. data/spec/foreman/cli_spec.rb +111 -0
  80. data/spec/foreman/engine_spec.rb +114 -0
  81. data/spec/foreman/export/base_spec.rb +19 -0
  82. data/spec/foreman/export/bluepill_spec.rb +37 -0
  83. data/spec/foreman/export/daemon_spec.rb +97 -0
  84. data/spec/foreman/export/inittab_spec.rb +40 -0
  85. data/spec/foreman/export/launchd_spec.rb +31 -0
  86. data/spec/foreman/export/runit_spec.rb +36 -0
  87. data/spec/foreman/export/supervisord_spec.rb +38 -0
  88. data/spec/foreman/export/systemd_spec.rb +155 -0
  89. data/spec/foreman/export/upstart_spec.rb +118 -0
  90. data/spec/foreman/export_spec.rb +24 -0
  91. data/spec/foreman/helpers_spec.rb +26 -0
  92. data/spec/foreman/process_spec.rb +71 -0
  93. data/spec/foreman/procfile_spec.rb +57 -0
  94. data/spec/foreman_spec.rb +16 -0
  95. data/spec/helper_spec.rb +19 -0
  96. data/spec/resources/Procfile +5 -0
  97. data/spec/resources/Procfile.bad +2 -0
  98. data/spec/resources/bin/echo +2 -0
  99. data/spec/resources/bin/env +2 -0
  100. data/spec/resources/bin/test +2 -0
  101. data/spec/resources/bin/utf8 +2 -0
  102. data/spec/resources/export/bluepill/app-concurrency.pill +49 -0
  103. data/spec/resources/export/bluepill/app.pill +81 -0
  104. data/spec/resources/export/daemon/app-alpha-1.conf +7 -0
  105. data/spec/resources/export/daemon/app-alpha-2.conf +7 -0
  106. data/spec/resources/export/daemon/app-alpha.conf +2 -0
  107. data/spec/resources/export/daemon/app-bravo-1.conf +7 -0
  108. data/spec/resources/export/daemon/app-bravo.conf +2 -0
  109. data/spec/resources/export/daemon/app.conf +14 -0
  110. data/spec/resources/export/inittab/inittab.concurrency +4 -0
  111. data/spec/resources/export/inittab/inittab.default +6 -0
  112. data/spec/resources/export/launchd/launchd-a.default +29 -0
  113. data/spec/resources/export/launchd/launchd-b.default +29 -0
  114. data/spec/resources/export/launchd/launchd-c.default +30 -0
  115. data/spec/resources/export/runit/app-alpha-1/log/run +7 -0
  116. data/spec/resources/export/runit/app-alpha-1/run +4 -0
  117. data/spec/resources/export/runit/app-alpha-2/log/run +7 -0
  118. data/spec/resources/export/runit/app-alpha-2/run +4 -0
  119. data/spec/resources/export/runit/app-bravo-1/log/run +7 -0
  120. data/spec/resources/export/runit/app-bravo-1/run +4 -0
  121. data/spec/resources/export/supervisord/app-alpha-1.conf +42 -0
  122. data/spec/resources/export/supervisord/app-alpha-2.conf +22 -0
  123. data/spec/resources/export/systemd/app-alpha.1.service +18 -0
  124. data/spec/resources/export/systemd/app-alpha.2.service +18 -0
  125. data/spec/resources/export/systemd/app-alpha.target +2 -0
  126. data/spec/resources/export/systemd/app-bravo.1.service +18 -0
  127. data/spec/resources/export/systemd/app-bravo.target +2 -0
  128. data/spec/resources/export/systemd/app.target +5 -0
  129. data/spec/resources/export/upstart/app-alpha-1.conf +11 -0
  130. data/spec/resources/export/upstart/app-alpha-2.conf +11 -0
  131. data/spec/resources/export/upstart/app-alpha.conf +2 -0
  132. data/spec/resources/export/upstart/app-bravo-1.conf +11 -0
  133. data/spec/resources/export/upstart/app-bravo.conf +2 -0
  134. data/spec/resources/export/upstart/app.conf +2 -0
  135. data/spec/spec_helper.rb +177 -0
  136. metadata +147 -16
  137. data/lib/overman/version.rb +0 -5
  138. data/lib/overman.rb +0 -1
@@ -0,0 +1,49 @@
1
+ Bluepill.application("app", :foreground => false, :log_file => "/var/log/bluepill.log") do |app|
2
+
3
+ app.uid = "app"
4
+ app.gid = "app"
5
+
6
+
7
+
8
+
9
+ app.process("alpha-1") do |process|
10
+ process.start_command = %Q{./alpha}
11
+
12
+ process.working_dir = "/tmp/app"
13
+ process.daemonize = true
14
+ process.environment = {"PORT"=>"5000"}
15
+ process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
16
+ process.stop_grace_time = 45.seconds
17
+
18
+ process.stdout = process.stderr = "/var/log/app/app-alpha-1.log"
19
+
20
+ process.monitor_children do |children|
21
+ children.stop_command "kill {{PID}}"
22
+ end
23
+
24
+ process.group = "app-alpha"
25
+ end
26
+
27
+
28
+ app.process("alpha-2") do |process|
29
+ process.start_command = %Q{./alpha}
30
+
31
+ process.working_dir = "/tmp/app"
32
+ process.daemonize = true
33
+ process.environment = {"PORT"=>"5001"}
34
+ process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
35
+ process.stop_grace_time = 45.seconds
36
+
37
+ process.stdout = process.stderr = "/var/log/app/app-alpha-2.log"
38
+
39
+ process.monitor_children do |children|
40
+ children.stop_command "kill {{PID}}"
41
+ end
42
+
43
+ process.group = "app-alpha"
44
+ end
45
+
46
+
47
+
48
+
49
+ end
@@ -0,0 +1,81 @@
1
+ Bluepill.application("app", :foreground => false, :log_file => "/var/log/bluepill.log") do |app|
2
+
3
+ app.uid = "app"
4
+ app.gid = "app"
5
+
6
+
7
+
8
+
9
+ app.process("alpha-1") do |process|
10
+ process.start_command = %Q{./alpha}
11
+
12
+ process.working_dir = "/tmp/app"
13
+ process.daemonize = true
14
+ process.environment = {"PORT"=>"5000"}
15
+ process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
16
+ process.stop_grace_time = 45.seconds
17
+
18
+ process.stdout = process.stderr = "/var/log/app/app-alpha-1.log"
19
+
20
+ process.monitor_children do |children|
21
+ children.stop_command "kill {{PID}}"
22
+ end
23
+
24
+ process.group = "app-alpha"
25
+ end
26
+
27
+ app.process("bravo-1") do |process|
28
+ process.start_command = %Q{./bravo}
29
+
30
+ process.working_dir = "/tmp/app"
31
+ process.daemonize = true
32
+ process.environment = {"PORT"=>"5100"}
33
+ process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
34
+ process.stop_grace_time = 45.seconds
35
+
36
+ process.stdout = process.stderr = "/var/log/app/app-bravo-1.log"
37
+
38
+ process.monitor_children do |children|
39
+ children.stop_command "kill {{PID}}"
40
+ end
41
+
42
+ process.group = "app-bravo"
43
+ end
44
+
45
+ app.process("foo_bar-1") do |process|
46
+ process.start_command = %Q{./foo_bar}
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 = %Q{./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
81
+ end
@@ -0,0 +1,7 @@
1
+ start on starting app-alpha
2
+ stop on stopping app-alpha
3
+ respawn
4
+
5
+ env PORT=5000
6
+
7
+ exec start-stop-daemon --start --chuid app --chdir /tmp/app --make-pidfile --pidfile /var/run/app/app-alpha-1.pid --exec ./alpha >> /var/log/app/app-alpha-1.log 2>&1
@@ -0,0 +1,7 @@
1
+ start on starting app-alpha
2
+ stop on stopping app-alpha
3
+ respawn
4
+
5
+ env PORT=5001
6
+
7
+ exec start-stop-daemon --start --chuid app --chdir /tmp/app --make-pidfile --pidfile /var/run/app/app-alpha-2.pid --exec ./alpha >> /var/log/app/app-alpha-2.log 2>&1
@@ -0,0 +1,2 @@
1
+ start on starting app
2
+ stop on stopping app
@@ -0,0 +1,7 @@
1
+ start on starting app-bravo
2
+ stop on stopping app-bravo
3
+ respawn
4
+
5
+ env PORT=5100
6
+
7
+ exec start-stop-daemon --start --chuid app --chdir /tmp/app --make-pidfile --pidfile /var/run/app/app-bravo-1.pid --exec ./bravo >> /var/log/app/app-bravo-1.log 2>&1
@@ -0,0 +1,2 @@
1
+ start on starting app
2
+ stop on stopping app
@@ -0,0 +1,14 @@
1
+ pre-start script
2
+
3
+ bash << "EOF"
4
+ mkdir -p /var/log/app
5
+ chown -R app /var/log/app
6
+ mkdir -p /var/run/app
7
+ chown -R app /var/run/app
8
+ EOF
9
+
10
+ end script
11
+
12
+ start on runlevel [2345]
13
+
14
+ stop on runlevel [016]
@@ -0,0 +1,4 @@
1
+ # ----- foreman app processes -----
2
+ AP01:4:respawn:/bin/su - app -c 'cd /tmp/app;export PORT=5000;./alpha >> /var/log/app/alpha-1.log 2>&1'
3
+ AP02:4:respawn:/bin/su - app -c 'cd /tmp/app;export PORT=5001;./alpha >> /var/log/app/alpha-2.log 2>&1'
4
+ # ----- end foreman app processes -----
@@ -0,0 +1,6 @@
1
+ # ----- foreman app processes -----
2
+ AP01:4:respawn:/bin/su - app -c 'cd /tmp/app;export PORT=5000;./alpha >> /var/log/app/alpha-1.log 2>&1'
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'
6
+ # ----- end foreman app processes -----
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>Label</key>
6
+ <string>app-alpha-1</string>
7
+ <key>EnvironmentVariables</key>
8
+ <dict>
9
+ <key>PORT</key>
10
+ <string>5000</string>
11
+ </dict>
12
+ <key>ProgramArguments</key>
13
+ <array>
14
+ <string>./alpha</string>
15
+ </array>
16
+ <key>KeepAlive</key>
17
+ <true/>
18
+ <key>RunAtLoad</key>
19
+ <true/>
20
+ <key>StandardOutPath</key>
21
+ <string>/var/log/app/app-alpha-1.log</string>
22
+ <key>StandardErrorPath</key>
23
+ <string>/var/log/app/app-alpha-1.log</string>
24
+ <key>UserName</key>
25
+ <string>app</string>
26
+ <key>WorkingDirectory</key>
27
+ <string>/tmp/app</string>
28
+ </dict>
29
+ </plist>
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>Label</key>
6
+ <string>app-bravo-1</string>
7
+ <key>EnvironmentVariables</key>
8
+ <dict>
9
+ <key>PORT</key>
10
+ <string>5100</string>
11
+ </dict>
12
+ <key>ProgramArguments</key>
13
+ <array>
14
+ <string>./bravo</string>
15
+ </array>
16
+ <key>KeepAlive</key>
17
+ <true/>
18
+ <key>RunAtLoad</key>
19
+ <true/>
20
+ <key>StandardOutPath</key>
21
+ <string>/var/log/app/app-bravo-1.log</string>
22
+ <key>StandardErrorPath</key>
23
+ <string>/var/log/app/app-bravo-1.log</string>
24
+ <key>UserName</key>
25
+ <string>app</string>
26
+ <key>WorkingDirectory</key>
27
+ <string>/tmp/app</string>
28
+ </dict>
29
+ </plist>
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>Label</key>
6
+ <string>app-alpha-1</string>
7
+ <key>EnvironmentVariables</key>
8
+ <dict>
9
+ <key>PORT</key>
10
+ <string>5000</string>
11
+ </dict>
12
+ <key>ProgramArguments</key>
13
+ <array>
14
+ <string>./alpha</string>
15
+ <string>charlie</string>
16
+ </array>
17
+ <key>KeepAlive</key>
18
+ <true/>
19
+ <key>RunAtLoad</key>
20
+ <true/>
21
+ <key>StandardOutPath</key>
22
+ <string>/var/log/app/app-alpha-1.log</string>
23
+ <key>StandardErrorPath</key>
24
+ <string>/var/log/app/app-alpha-1.log</string>
25
+ <key>UserName</key>
26
+ <string>app</string>
27
+ <key>WorkingDirectory</key>
28
+ <string>/tmp/app</string>
29
+ </dict>
30
+ </plist>
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ LOG=/var/log/app/alpha-1
5
+
6
+ test -d "$LOG" || mkdir -p -m 2750 "$LOG" && chown app "$LOG"
7
+ exec chpst -u app svlogd "$LOG"
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ cd /tmp/app
3
+ exec 2>&1
4
+ exec chpst -u app -e /tmp/init/app-alpha-1/env ./alpha bar=baz
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ LOG=/var/log/app/alpha-2
5
+
6
+ test -d "$LOG" || mkdir -p -m 2750 "$LOG" && chown app "$LOG"
7
+ exec chpst -u app svlogd "$LOG"
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ cd /tmp/app
3
+ exec 2>&1
4
+ exec chpst -u app -e /tmp/init/app-alpha-2/env ./alpha bar=baz
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ LOG=/var/log/app/bravo-1
5
+
6
+ test -d "$LOG" || mkdir -p -m 2750 "$LOG" && chown app "$LOG"
7
+ exec chpst -u app svlogd "$LOG"
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ cd /tmp/app
3
+ exec 2>&1
4
+ exec chpst -u app -e /tmp/init/app-bravo-1/env ./bravo
@@ -0,0 +1,42 @@
1
+ [program:app-alpha-1]
2
+ command=./alpha
3
+ autostart=true
4
+ autorestart=true
5
+ stdout_logfile=/var/log/app/alpha-1.log
6
+ stderr_logfile=/var/log/app/alpha-1.error.log
7
+ user=app
8
+ directory=/tmp/app
9
+ environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",PORT="5000"
10
+
11
+ [program:app-bravo-1]
12
+ command=./bravo
13
+ autostart=true
14
+ autorestart=true
15
+ stdout_logfile=/var/log/app/bravo-1.log
16
+ stderr_logfile=/var/log/app/bravo-1.error.log
17
+ user=app
18
+ directory=/tmp/app
19
+ environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",PORT="5100"
20
+
21
+ [program:app-foo_bar-1]
22
+ command=./foo_bar
23
+ autostart=true
24
+ autorestart=true
25
+ stdout_logfile=/var/log/app/foo_bar-1.log
26
+ stderr_logfile=/var/log/app/foo_bar-1.error.log
27
+ user=app
28
+ directory=/tmp/app
29
+ environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",PORT="5200"
30
+
31
+ [program:app-foo-bar-1]
32
+ command=./foo-bar
33
+ autostart=true
34
+ autorestart=true
35
+ stdout_logfile=/var/log/app/foo-bar-1.log
36
+ stderr_logfile=/var/log/app/foo-bar-1.error.log
37
+ user=app
38
+ directory=/tmp/app
39
+ environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",PORT="5300"
40
+
41
+ [group:app]
42
+ programs=app-alpha-1,app-bravo-1,app-foo_bar-1,app-foo-bar-1
@@ -0,0 +1,22 @@
1
+ [program:app-alpha-1]
2
+ command=./alpha
3
+ autostart=true
4
+ autorestart=true
5
+ stdout_logfile=/var/log/app/alpha-1.log
6
+ stderr_logfile=/var/log/app/alpha-1.error.log
7
+ user=app
8
+ directory=/tmp/app
9
+ environment=PORT="5000"
10
+
11
+ [program:app-alpha-2]
12
+ command=./alpha
13
+ autostart=true
14
+ autorestart=true
15
+ stdout_logfile=/var/log/app/alpha-2.log
16
+ stderr_logfile=/var/log/app/alpha-2.error.log
17
+ user=app
18
+ directory=/tmp/app
19
+ environment=PORT="5001"
20
+
21
+ [group:app]
22
+ programs=app-alpha-1,app-alpha-2
@@ -0,0 +1,18 @@
1
+ [Unit]
2
+ PartOf=app.target
3
+ StopWhenUnneeded=yes
4
+
5
+ [Service]
6
+ User=app
7
+ WorkingDirectory=/tmp/app
8
+ Environment=PORT=5000
9
+ Environment=PS=alpha.1
10
+ ExecStart=/bin/bash -lc 'exec -a "app-alpha.1" ./alpha'
11
+ Restart=always
12
+ RestartSec=14s
13
+ StandardInput=null
14
+ StandardOutput=syslog
15
+ StandardError=syslog
16
+ SyslogIdentifier=%n
17
+ KillMode=mixed
18
+ TimeoutStopSec=5
@@ -0,0 +1,18 @@
1
+ [Unit]
2
+ PartOf=app.target
3
+ StopWhenUnneeded=yes
4
+
5
+ [Service]
6
+ User=app
7
+ WorkingDirectory=/tmp/app
8
+ Environment=PORT=5001
9
+ Environment=PS=alpha.2
10
+ ExecStart=/bin/bash -lc 'exec -a "app-alpha.2" ./alpha'
11
+ Restart=always
12
+ RestartSec=14s
13
+ StandardInput=null
14
+ StandardOutput=syslog
15
+ StandardError=syslog
16
+ SyslogIdentifier=%n
17
+ KillMode=mixed
18
+ TimeoutStopSec=5
@@ -0,0 +1,2 @@
1
+ [Unit]
2
+ PartOf=app.target
@@ -0,0 +1,18 @@
1
+ [Unit]
2
+ PartOf=app.target
3
+ StopWhenUnneeded=yes
4
+
5
+ [Service]
6
+ User=app
7
+ WorkingDirectory=/tmp/app
8
+ Environment=PORT=5100
9
+ Environment=PS=bravo.1
10
+ ExecStart=/bin/bash -lc 'exec -a "app-bravo.1" ./bravo'
11
+ Restart=always
12
+ RestartSec=14s
13
+ StandardInput=null
14
+ StandardOutput=syslog
15
+ StandardError=syslog
16
+ SyslogIdentifier=%n
17
+ KillMode=mixed
18
+ TimeoutStopSec=5
@@ -0,0 +1,2 @@
1
+ [Unit]
2
+ PartOf=app.target
@@ -0,0 +1,5 @@
1
+ [Unit]
2
+ Wants=app-alpha.1.service app-bravo.1.service app-foo_bar.1.service app-foo-bar.1.service
3
+
4
+ [Install]
5
+ WantedBy=multi-user.target
@@ -0,0 +1,11 @@
1
+ start on starting app-alpha
2
+ stop on stopping app-alpha
3
+ respawn
4
+
5
+ env PORT=5000
6
+
7
+ setuid app
8
+
9
+ chdir /tmp/app
10
+
11
+ exec ./alpha
@@ -0,0 +1,11 @@
1
+ start on starting app-alpha
2
+ stop on stopping app-alpha
3
+ respawn
4
+
5
+ env PORT=5001
6
+
7
+ setuid app
8
+
9
+ chdir /tmp/app
10
+
11
+ exec ./alpha
@@ -0,0 +1,2 @@
1
+ start on starting app
2
+ stop on stopping app
@@ -0,0 +1,11 @@
1
+ start on starting app-bravo
2
+ stop on stopping app-bravo
3
+ respawn
4
+
5
+ env PORT=5100
6
+
7
+ setuid app
8
+
9
+ chdir /tmp/app
10
+
11
+ exec ./bravo
@@ -0,0 +1,2 @@
1
+ start on starting app
2
+ stop on stopping app
@@ -0,0 +1,2 @@
1
+ start on runlevel [2345]
2
+ stop on runlevel [!2345]