upstart-exporter 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/README.md +10 -0
- data/lib/upstart-exporter/options/validator.rb +8 -1
- data/lib/upstart-exporter/version.rb +1 -1
- data/spec/lib/upstart-exporter_spec.rb +16 -0
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OGNiN2VjMWY1MzJlN2UyNTIyMGZlMDUxNWUxNGZhYmFkZDQ3Njk2OQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NDg0OTBiODNkMmMwNzliNTNiNDUwOGI0YjEzZWE2ZTNhODA1YmJjZQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NGY5N2NiNzEyN2UzNzczNWJhNTE3ZTIyMDc0MzI3NTlhZjUxMTA1MzE1MThl
|
10
|
+
N2NiMTViMzJkNGY0NGJhYjliZTE5YmJmNWM2MGU4ZjU2MWZiYTkxMTMwZGFj
|
11
|
+
NzJkOTMyYmI5NmY2YTNkN2Y3Nzk0NDAzOWZiNmIyMGZlY2Y4MzU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTNjNzExYjFkNDM1YTM0Y2ZjMTEyMzBkMzEzMTBlNzBkNGNhMWQ0NTcxMzg2
|
14
|
+
ZWYyNzU2NWEwNjdmNWNkNmVmZWI0M2YyZWE1YzBmYzQ5ZTJkMzAzMjhhZTA3
|
15
|
+
YTYyMTNlODRhMmIxNmRlZDkwNmVkYmExNTYwYzAxNjFjYmVkMTk=
|
data/README.md
CHANGED
@@ -28,6 +28,7 @@ Configuration
|
|
28
28
|
The export process is configured through the only config, `/etc/upstart-exporter.yaml`,
|
29
29
|
which is a simple YAML file of the following format:
|
30
30
|
|
31
|
+
```yaml
|
31
32
|
---
|
32
33
|
run_user: www # The user under which all installed through upstart-exporter background jobs are run
|
33
34
|
run_group: www # The group of run_user
|
@@ -37,9 +38,11 @@ which is a simple YAML file of the following format:
|
|
37
38
|
respawn: # Controls how often job can fail and be restarted, set to false to prohibit restart after failure
|
38
39
|
count: 10 # Number of allowed restarts in given interval
|
39
40
|
interval: 10 # Interval in seconds
|
41
|
+
```
|
40
42
|
|
41
43
|
The config is not installed by default. If this config is absent, the default values are the following:
|
42
44
|
|
45
|
+
```yaml
|
43
46
|
helper_dir: /var/local/upstart_helpers/
|
44
47
|
upstart_dir: /etc/init/
|
45
48
|
run_user: service
|
@@ -47,6 +50,7 @@ The config is not installed by default. If this config is absent, the default va
|
|
47
50
|
respawn:
|
48
51
|
count: 5
|
49
52
|
interval: 10
|
53
|
+
```
|
50
54
|
|
51
55
|
To give a certain user (i.e. `deployuser`) the ability to use this script, you can place the following lines into `sudoers` file:
|
52
56
|
|
@@ -78,13 +82,17 @@ Procfile v.1
|
|
78
82
|
After upstart-exporter is installed and configured, you may export background jobs
|
79
83
|
from an arbitrary Procfile-like file of the following format:
|
80
84
|
|
85
|
+
```yaml
|
81
86
|
cmdlabel1: cmd1
|
82
87
|
cmdlabel2: cmd2
|
88
|
+
```
|
83
89
|
|
84
90
|
i.e. a file `./myprocfile` containing:
|
85
91
|
|
92
|
+
```yaml
|
86
93
|
my_tail_cmd: /usr/bin/tail -F /var/log/messages
|
87
94
|
my_another_tail_cmd: /usr/bin/tail -F /var/log/messages
|
95
|
+
```
|
88
96
|
|
89
97
|
For security purposes, command labels are allowed to contain only letters, digits, and underscores.
|
90
98
|
|
@@ -94,6 +102,7 @@ Procfile v.2
|
|
94
102
|
Another format of Procfile scripts is YAML config. A configuration script may
|
95
103
|
look like this:
|
96
104
|
|
105
|
+
```yaml
|
97
106
|
version: 2
|
98
107
|
start_on_runlevel: "[2345]"
|
99
108
|
stop_on_runlevel: "[06]"
|
@@ -120,6 +129,7 @@ look like this:
|
|
120
129
|
my_multi_tail_cmd:
|
121
130
|
command: /usr/bin/tail -F /var/log/messages
|
122
131
|
count: 2
|
132
|
+
```
|
123
133
|
|
124
134
|
`start_on_runlevel` and `stop_on_runlevel` are two global options that can't be
|
125
135
|
redefined. For more information on these options look into
|
@@ -57,10 +57,17 @@ module Upstart::Exporter::Options
|
|
57
57
|
:working_directory => validate_path(cmd[:working_directory]),
|
58
58
|
:respawn => validate_respawn(cmd[:respawn]),
|
59
59
|
:count => validate_digits(cmd[:count]),
|
60
|
-
:kill_timeout => validate_digits(cmd[:kill_timeout])
|
60
|
+
:kill_timeout => validate_digits(cmd[:kill_timeout]),
|
61
|
+
:env => validate_env(cmd[:env])
|
61
62
|
}
|
62
63
|
end
|
63
64
|
|
65
|
+
def validate_env(params)
|
66
|
+
return unless params
|
67
|
+
params.each_key {|k| reject_special_symbols(k)}
|
68
|
+
params
|
69
|
+
end
|
70
|
+
|
64
71
|
def validate_respawn(options)
|
65
72
|
return options unless options.is_a?(Hash)
|
66
73
|
|
@@ -47,6 +47,22 @@ commands:
|
|
47
47
|
expect(File.read('/u/p-app-second_cmd.conf')).not_to include("respawn")
|
48
48
|
expect(File.read('/u/p-app-third_cmd.conf')).to include("respawn\nrespawn limit 7 14")
|
49
49
|
end
|
50
|
+
|
51
|
+
it 'correctly sets env variables' do
|
52
|
+
yaml = <<-EOS
|
53
|
+
version: 2
|
54
|
+
env:
|
55
|
+
env-key: env-value
|
56
|
+
commands:
|
57
|
+
first_cmd:
|
58
|
+
command: ping 127.0.0.1
|
59
|
+
EOS
|
60
|
+
|
61
|
+
make_procfile('Procfile', yaml)
|
62
|
+
|
63
|
+
exporter.export
|
64
|
+
expect(File.read('/h/p-app-first_cmd.sh')).to include("env-key=env-value")
|
65
|
+
end
|
50
66
|
end
|
51
67
|
|
52
68
|
describe '#export' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upstart-exporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Averyanov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Gem for converting extended Procfile-like files to upstart scripts
|
15
15
|
email:
|
@@ -20,14 +20,14 @@ executables:
|
|
20
20
|
extensions: []
|
21
21
|
extra_rdoc_files: []
|
22
22
|
files:
|
23
|
-
-
|
24
|
-
-
|
25
|
-
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
30
|
-
-
|
23
|
+
- .gitignore
|
24
|
+
- .rbenv-version
|
25
|
+
- .rspec
|
26
|
+
- .ruby-version
|
27
|
+
- .travis.yml
|
28
|
+
- .yardoc/checksums
|
29
|
+
- .yardoc/objects/root.dat
|
30
|
+
- .yardoc/proxy_types
|
31
31
|
- Gemfile
|
32
32
|
- README.md
|
33
33
|
- Rakefile
|
@@ -86,17 +86,17 @@ require_paths:
|
|
86
86
|
- lib
|
87
87
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- -
|
89
|
+
- - ! '>='
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ! '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.5.2
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: Gem for converting extended Procfile-like files to upstart scripts
|