pleaserun 0.0.27 → 0.0.32

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
- SHA1:
3
- metadata.gz: 5da0f7988a9947a210cbb3fec5070dd95f874e8d
4
- data.tar.gz: 75791509553c575a50dd55ed77aced3e924142cc
2
+ SHA256:
3
+ metadata.gz: 0c919527f537b698a9d75f42af43888ae2c7bd823b3ff1903676a1aae61a2b74
4
+ data.tar.gz: 6cc96e8f6d67f4632350c8ec84ff095f81aeea6efc1aeb5191864f2f246bd40b
5
5
  SHA512:
6
- metadata.gz: 3639a10e3e0f7df7d3de587173706c872e814461185f83b3b242a496d9bb94dbb2e7b8b57be4935494f01d1aece22126b9a5a0cf194109d48797d9a2f93eb588
7
- data.tar.gz: 03331a51f9dd499f01dcc76e1d60d1578a5b5027d757f339712a7a6168923809e55d1e52cd24743ae86e23a495f769bf512f303b94dee55bc2a6eeb2c7e20641
6
+ metadata.gz: 3ffe5a71f474861354e56f4e33c719d85dba13514b8b0139a9e9e20f04d98655531f0043b1f6d4289c71a2d86cb660bff68e09f898eca454566ad4877aa3af16
7
+ data.tar.gz: fc73e14185be3732651e2f8c1d04acb96f37599b9b70b23f29a63a0232b4f672e04c784fce3ba501e89194c52aa610d5c439a4e8874e0309525173317a3f401b
data/CHANGELOG.asciidoc CHANGED
@@ -1,5 +1,19 @@
1
1
  = Pleaserun Changes and Releases
2
2
 
3
+ == 0.0.31 (March 17, 2020)
4
+ * Fixed a code error preventing `runit` in pleaserun from working (#143, #145)
5
+
6
+ == 0.0.30 (August 7, 2017)
7
+ * Released without changelog ???
8
+
9
+ == 0.0.29 (April 17, 2017)
10
+ * `pleaserun --version` will now write the version of pleaserun and exit. (#125)
11
+
12
+ == 0.0.28 (February 6, 2017)
13
+ * sysv and upstart will now `set -a` before loading /etc/default and
14
+ /etc/sysconfig files. This is to bring them in line with what users are
15
+ asking me as well as with what systemd does with these files. (#121)
16
+
3
17
  == 0.0.27 (November 4, 2016)
4
18
  * Fix a bug where upstart jobs would fail to run if the job's user was not root.
5
19
  * upstart: Add nice and limit_open_files support for Upstart 0.6.5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pleaserun (0.0.27)
4
+ pleaserun (0.0.31)
5
5
  cabin (> 0)
6
6
  clamp
7
7
  dotenv
@@ -13,58 +13,46 @@ GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
15
  cabin (0.9.0)
16
- celluloid (0.16.0)
17
- timers (~> 4.0.0)
18
- clamp (1.1.1)
19
- coderay (1.1.0)
20
- diff-lcs (1.2.5)
21
- dotenv (2.1.1)
22
- ffi (1.9.6)
23
- ffi (1.9.6-java)
24
- flores (0.0.3)
16
+ clamp (1.3.2)
17
+ coderay (1.1.3)
18
+ diff-lcs (1.4.4)
19
+ dotenv (2.7.6)
20
+ ffi (1.15.0)
21
+ flores (0.0.7)
25
22
  formatador (0.2.5)
26
- guard (2.12.4)
23
+ guard (2.16.2)
27
24
  formatador (>= 0.2.4)
28
- listen (~> 2.7)
29
- lumberjack (~> 1.0)
25
+ listen (>= 2.7, < 4.0)
26
+ lumberjack (>= 1.0.12, < 2.0)
30
27
  nenv (~> 0.1)
31
28
  notiffany (~> 0.0)
32
29
  pry (>= 0.9.12)
33
30
  shellany (~> 0.0)
34
31
  thor (>= 0.18.1)
35
32
  guard-compat (1.2.1)
36
- guard-rspec (4.5.0)
33
+ guard-rspec (4.7.3)
37
34
  guard (~> 2.1)
38
35
  guard-compat (~> 1.1)
39
36
  rspec (>= 2.99.0, < 4.0)
40
- hitimes (1.2.2)
41
- hitimes (1.2.2-java)
42
37
  insist (1.0.0)
43
- listen (2.8.5)
44
- celluloid (>= 0.15.2)
45
- rb-fsevent (>= 0.9.3)
46
- rb-inotify (>= 0.9)
47
- lumberjack (1.0.9)
48
- method_source (0.8.2)
38
+ listen (3.5.1)
39
+ rb-fsevent (~> 0.10, >= 0.10.3)
40
+ rb-inotify (~> 0.9, >= 0.9.10)
41
+ lumberjack (1.2.8)
42
+ method_source (1.0.0)
49
43
  mustache (0.99.8)
50
- nenv (0.2.0)
51
- net-ssh (2.9.2)
52
- notiffany (0.0.6)
44
+ nenv (0.3.0)
45
+ net-ssh (6.1.0)
46
+ notiffany (0.1.3)
53
47
  nenv (~> 0.1)
54
48
  shellany (~> 0.0)
55
49
  peach (0.5.1)
56
- pry (0.10.1)
57
- coderay (~> 1.1.0)
58
- method_source (~> 0.8.1)
59
- slop (~> 3.4)
60
- pry (0.10.1-java)
61
- coderay (~> 1.1.0)
62
- method_source (~> 0.8.1)
63
- slop (~> 3.4)
64
- spoon (~> 0.0)
65
- rb-fsevent (0.9.4)
66
- rb-inotify (0.9.5)
67
- ffi (>= 0.5.0)
50
+ pry (0.14.1)
51
+ coderay (~> 1.1)
52
+ method_source (~> 1.0)
53
+ rb-fsevent (0.10.4)
54
+ rb-inotify (0.10.1)
55
+ ffi (~> 1.0)
68
56
  rspec (3.0.0)
69
57
  rspec-core (~> 3.0.0)
70
58
  rspec-expectations (~> 3.0.0)
@@ -78,16 +66,10 @@ GEM
78
66
  rspec-support (~> 3.0.0)
79
67
  rspec-support (3.0.4)
80
68
  shellany (0.0.1)
81
- slop (3.6.0)
82
- spoon (0.0.4)
83
- ffi
84
- stud (0.0.22)
85
- thor (0.19.1)
86
- timers (4.0.1)
87
- hitimes
69
+ stud (0.0.23)
70
+ thor (1.1.0)
88
71
 
89
72
  PLATFORMS
90
- java
91
73
  ruby
92
74
 
93
75
  DEPENDENCIES
@@ -100,4 +82,4 @@ DEPENDENCIES
100
82
  rspec (~> 3.0.0)
101
83
 
102
84
  BUNDLED WITH
103
- 1.13.5
85
+ 2.1.2
data/Makefile CHANGED
@@ -1,5 +1,5 @@
1
1
  GEMSPEC=$(shell ls *.gemspec)
2
- VERSION=$(shell awk -F\" '/spec.version/ { print $$2 }' $(GEMSPEC))
2
+ VERSION=$(shell awk -F\" '/VERSION =/ { print $$2 }' lib/pleaserun/version.rb)
3
3
  NAME=$(shell awk -F\" '/spec.name/ { print $$2 }' $(GEMSPEC))
4
4
  GEM=$(NAME)-$(VERSION).gem
5
5
 
data/README.md CHANGED
@@ -1,12 +1,18 @@
1
1
  # Please, Run!
2
2
 
3
- Pleaserun is a tool to generate startup scripts for the wasteland of sorrow
4
- that is process launchers.
3
+ Pleaserun is a tool to generate startup scripts and service definitions. It targets
4
+ service managers such as systemd, Upstart, launchd, sysv init, and runit.
5
5
 
6
6
  Ideally, you should be able to specify a configuration of how to run a given
7
7
  service command (like apache, syslog-ng, whatever), and this tool should
8
8
  be able to spit out a script or config file for your target platform.
9
9
 
10
+ ## Project Principles
11
+
12
+ * Community: If a newbie has a bad time, it's a bug.
13
+ * Engineering: Make it work, then make it right, then make it fast.
14
+ * Capabilities: If it doesn't do a thing today, we can make it do it tomorrow.
15
+
10
16
  ## What's going on here?
11
17
 
12
18
  With pleaserun, you can generate the following launchers/scripts/whatever:
@@ -17,7 +23,7 @@ With pleaserun, you can generate the following launchers/scripts/whatever:
17
23
  * runit
18
24
  * sysv init
19
25
 
20
- Want more? It's easy to add things. [File an issue](../../issues/) and ask away!
26
+ Want more? I want it to be easy to add things and invite you to [file an issue](../../issues/) with your ideas.
21
27
 
22
28
  ## Installation
23
29
 
@@ -151,3 +157,7 @@ Please enjoy running things! If you are not enjoying this program, then somethin
151
157
  If you are having a bad time, it is a bug!
152
158
 
153
159
  All contributions welcome (bug reports, feature requests, bug fixes, new features, etc!)
160
+
161
+ # Code of Conduct
162
+
163
+ This project has a code of conduct and uses the [Contributor Covenant](CODE_OF_CONDUCT.md).
data/lib/pleaserun/cli.rb CHANGED
@@ -4,6 +4,7 @@ require "clamp"
4
4
  require "cabin"
5
5
  require "stud/temporary"
6
6
 
7
+ require "pleaserun/version"
7
8
  require "pleaserun/platform/base"
8
9
  require "pleaserun/installer"
9
10
  require "pleaserun/errors"
@@ -63,7 +64,7 @@ class PleaseRun::CLI < Clamp::Command # rubocop:disable ClassLength
63
64
 
64
65
  def help # rubocop:disable MethodLength
65
66
  return <<-HELP
66
- Welcome to pleaserun!
67
+ Welcome to pleaserun version #{PleaseRun::VERSION}!
67
68
 
68
69
  This program aims to help you generate 'init' scripts/configs for various
69
70
  platforms. The simplest example takes only the command you wish to run.
@@ -103,6 +104,16 @@ are made. If it fails, nagios will not start. Yay!
103
104
  # rubocop:enable MethodLength
104
105
  end
105
106
 
107
+ def run(args)
108
+ # Short circuit for a `fpm --version` or `fpm -v` short invocation that
109
+ # is the user asking us for the version of fpm.
110
+ if args == [ "-v" ] || args == [ "--version" ]
111
+ puts PleaseRun::VERSION
112
+ return 0
113
+ end
114
+ super
115
+ end
116
+
106
117
  def execute
107
118
  setup_logger
108
119
  setup_defaults
@@ -175,9 +186,12 @@ are made. If it fails, nagios will not start. Yay!
175
186
  PleaseRun::Installer.install_actions(runner) if install_actions?
176
187
  else
177
188
  target = install_prefix || Stud::Temporary.directory
178
- actions_script = File.join(target, "install_actions.sh")
179
189
  PleaseRun::Installer.install_files(runner, target, overwrite?)
180
- PleaseRun::Installer.write_actions(runner, actions_script)
190
+
191
+ if install_actions?
192
+ actions_script = File.join(target, "install_actions.sh")
193
+ PleaseRun::Installer.write_actions(runner, actions_script)
194
+ end
181
195
  end
182
196
  return 0
183
197
  end # def run_human
@@ -88,7 +88,7 @@ class PleaseRun::Platform::Base
88
88
 
89
89
  attribute :environment_file, "A file containing environment variables to export for your application" do
90
90
  validate do |env|
91
- insist { env }.is_a?(File)
91
+ insist { env }.is_a?(String)
92
92
  end
93
93
  end
94
94
 
@@ -6,8 +6,8 @@ require "pleaserun/platform/base"
6
6
  # Learn what runit is here: http://smarden.org/runit/
7
7
  class PleaseRun::Platform::Runit < PleaseRun::Platform::Base
8
8
  attribute :service_path, "The path runit service directory",
9
- :default => "/service" do |path|
10
- validate do
9
+ :default => "/service" do
10
+ validate do |path|
11
11
  insist { path }.is_a?(String)
12
12
  end
13
13
  end
@@ -0,0 +1,3 @@
1
+ module PleaseRun
2
+ VERSION = "0.0.32"
3
+ end
data/pleaserun.gemspec CHANGED
@@ -1,8 +1,9 @@
1
+ require File.join(File.dirname(__FILE__), "lib/pleaserun/version")
1
2
  Gem::Specification.new do |spec|
2
3
  files = File.read(__FILE__)[/^__END__$.*/m].split("\n")[1..-1]
3
4
 
4
5
  spec.name = "pleaserun"
5
- spec.version = "0.0.27"
6
+ spec.version = PleaseRun::VERSION
6
7
  spec.summary = "pleaserun"
7
8
  spec.description = "pleaserun"
8
9
  spec.license = "Apache 2.0"
@@ -53,6 +54,7 @@ lib/pleaserun/platform/systemd.rb
53
54
  lib/pleaserun/platform/sysv.rb
54
55
  lib/pleaserun/platform/upstart.rb
55
56
  lib/pleaserun/user/base.rb
57
+ lib/pleaserun/version.rb
56
58
  pleaserun.gemspec
57
59
  spec/pleaserun/cli_spec.rb
58
60
  spec/pleaserun/configurable_spec.rb
@@ -22,5 +22,9 @@ WorkingDirectory={{{chdir}}}
22
22
  {{/nice}}{{#limit_open_files}}LimitNOFILE={{{limit_open_files}}}
23
23
  {{/limit_open_files}}
24
24
 
25
+ # When stopping, how long to wait before giving up and sending SIGKILL?
26
+ # Keep in mind that SIGKILL on a process can cause data loss.
27
+ TimeoutStopSec=infinity
28
+
25
29
  [Install]
26
30
  WantedBy=multi-user.target
@@ -1,3 +1,3 @@
1
1
  {{#all_environment_variables}}
2
- export {{key}}={{#shell_quote}}{{value}}{{/shell_quote}}
2
+ {{key}}={{#shell_quote}}{{value}}{{/shell_quote}}
3
3
  {{/all_environment_variables}}
@@ -42,8 +42,12 @@ nice="{{{nice}}}"
42
42
  # The default behavior is to simply log a message "program stop failed; still running"
43
43
  KILL_ON_STOP_TIMEOUT=0
44
44
 
45
+ # When loading default and sysconfig files, we use `set -a` to make
46
+ # all variables automatically into environment variables.
47
+ set -a
45
48
  [ -r {{{default_file}}} ] && . {{{default_file}}}
46
49
  [ -r {{{sysconfig_file}}} ] && . {{{sysconfig_file}}}
50
+ set +a
47
51
 
48
52
  [ -z "$nice" ] && nice=0
49
53
 
@@ -63,9 +67,11 @@ start() {
63
67
  all support switching users and it invokes execve immediately after chrooting. }}
64
68
 
65
69
  # Ensure the log directory is setup correctly.
66
- [ ! -d "{{{ log_directory }}}" ] && mkdir "{{{ log_directory }}}"
67
- chown "$user":"$group" "{{{ log_directory }}}"
68
- chmod 755 "{{{ log_directory }}}"
70
+ if [ ! -d "{{{ log_directory }}}" ]; then
71
+ mkdir "{{{ log_directory }}}"
72
+ chown "$user":"$group" "{{{ log_directory }}}"
73
+ chmod 755 "{{{ log_directory }}}"
74
+ fi
69
75
 
70
76
  {{#prestart}}
71
77
  if [ "$PRESTART" != "no" ] ; then
@@ -1,3 +1,3 @@
1
1
  {{#all_environment_variables}}
2
- export {{key}}={{#shell_quote}}{{value}}{{/shell_quote}}
2
+ {{key}}={{#shell_quote}}{{value}}{{/shell_quote}}
3
3
  {{/all_environment_variables}}
@@ -38,7 +38,11 @@ end script
38
38
  {{/prestart}}
39
39
 
40
40
  script
41
+ # When loading default and sysconfig files, we use `set -a` to make
42
+ # all variables automatically into environment variables.
43
+ set -a
41
44
  [ -r "{{{default_file}}}" ] && . "{{{default_file}}}"
42
45
  [ -r "{{{sysconfig_file}}}" ] && . "{{{sysconfig_file}}}"
46
+ set +a
43
47
  exec chroot --userspec {{{user}}}:{{{group}}} {{{chroot}}} {{{program}}} {{{shell_args}}} >> {{ log_path_stdout }} 2>> {{ log_path_stderr }}
44
48
  end script
@@ -1,3 +1,3 @@
1
1
  {{#all_environment_variables}}
2
- export {{key}}={{#shell_quote}}{{value}}{{/shell_quote}}
2
+ {{key}}={{#shell_quote}}{{value}}{{/shell_quote}}
3
3
  {{/all_environment_variables}}
@@ -45,6 +45,14 @@ limit stack {{{limit_stack_size}}} {{{limit_stack_size}}}
45
45
  setuid {{{user}}}
46
46
  setgid {{{group}}}
47
47
 
48
+ # Set a really really large kill timeout
49
+ # By default, upstart has a kill timeout of 5 seconds.
50
+ # If the program is being stopped, but hasn't finished by the time this 'kill
51
+ # timeout' has expired, then upstart will destroy the process with SIGKILL.
52
+ # SIGKILL is a way to cause data loss, so we try to disable this feature by
53
+ # default.
54
+ kill timeout 99999999
55
+
48
56
  {{#prestart}}
49
57
  pre-start script
50
58
  {{{ prestart }}}
@@ -60,7 +68,11 @@ end script
60
68
  {{/prestart}}
61
69
 
62
70
  script
71
+ # When loading default and sysconfig files, we use `set -a` to make
72
+ # all variables automatically into environment variables.
73
+ set -a
63
74
  [ -r {{{default_file}}} ] && . {{{default_file}}}
64
75
  [ -r {{{sysconfig_file}}} ] && . {{{sysconfig_file}}}
76
+ set +a
65
77
  exec {{{program}}} {{{shell_args}}}
66
78
  end script
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pleaserun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Sissel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-04 00:00:00.000000000 Z
11
+ date: 2021-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cabin
@@ -129,6 +129,7 @@ files:
129
129
  - lib/pleaserun/platform/sysv.rb
130
130
  - lib/pleaserun/platform/upstart.rb
131
131
  - lib/pleaserun/user/base.rb
132
+ - lib/pleaserun/version.rb
132
133
  - pleaserun.gemspec
133
134
  - spec/pleaserun/cli_spec.rb
134
135
  - spec/pleaserun/configurable_spec.rb
@@ -180,10 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
181
  - !ruby/object:Gem::Version
181
182
  version: '0'
182
183
  requirements: []
183
- rubyforge_project:
184
- rubygems_version: 2.5.1
184
+ rubygems_version: 3.1.2
185
185
  signing_key:
186
186
  specification_version: 4
187
187
  summary: pleaserun
188
188
  test_files: []
189
- has_rdoc: