upstart-exporter 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardoc/checksums +2 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/README.md +106 -0
- data/doc/Upstart/ExportError.html +116 -0
- data/doc/Upstart/Exporter.html +1427 -0
- data/doc/Upstart.html +108 -0
- data/doc/_index.html +128 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +55 -0
- data/doc/css/style.css +322 -0
- data/doc/file.README.html +175 -0
- data/doc/file_list.html +49 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +175 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +167 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +206 -0
- data/doc/top-level-namespace.html +103 -0
- data/lib/upstart-exporter/version.rb +1 -1
- data/upstart-exporter.gemspec +2 -0
- metadata +54 -4
data/.yardoc/checksums
ADDED
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/README.md
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
Gem for exporting user-scripts as Upstart scripts
|
2
|
+
====================
|
3
|
+
|
4
|
+
Purpose
|
5
|
+
-------
|
6
|
+
|
7
|
+
It is often neccessary to run some supporting background tasks for rails projects alongside with the webserver. One of the solutions is use of Foreman gem, which allows to export tasks as Upstart scripts. This solution is dangerous,because it requires root priveleges for foreman executable (in order to add scripts to /etc/init), so it the depoloing user to run any code as root (by placing appropriate script into /etc/init).
|
8
|
+
|
9
|
+
This gem is an attempt to provide a safe way for installing backround jobs, so that they run under some fixed user wwithout root priveleges.
|
10
|
+
|
11
|
+
The only interface to the gem is the script it provides.
|
12
|
+
|
13
|
+
Installing
|
14
|
+
----------
|
15
|
+
|
16
|
+
gem install upstart-exporter
|
17
|
+
|
18
|
+
|
19
|
+
Configuration
|
20
|
+
-------------
|
21
|
+
|
22
|
+
The export process is configured through the only config, /etc/upstart-exporter.yaml, which is a simple YAML file of the following format:
|
23
|
+
|
24
|
+
---
|
25
|
+
run_user: www # The user under which all installed through upstart-exporter background jobs are run
|
26
|
+
helper_dir: /var/helper_dir # Auxilary directory for scripts incapsulating background jobs
|
27
|
+
upstart_dir: /var/upstart_dir # Directory where upstart scripts should be placed
|
28
|
+
|
29
|
+
The config is not installed by default. If this config is absent, the default values are the following:
|
30
|
+
|
31
|
+
helper_dir: /var/local/upstart_helpers/
|
32
|
+
upstart_dir: /etc/init/
|
33
|
+
run_user: service
|
34
|
+
|
35
|
+
To give a user (i.e. deployuser) ability to use this script, one can place
|
36
|
+
|
37
|
+
# Commands required for manipulating jobs
|
38
|
+
Cmnd_Alias UPSTART = /sbin/start, /sbin/stop, /sbin/restart
|
39
|
+
Cmnd_Alias UPEXPORT = /usr/local/bin/upstart-export
|
40
|
+
|
41
|
+
...
|
42
|
+
|
43
|
+
# Add gem's binary path to this
|
44
|
+
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
|
45
|
+
|
46
|
+
...
|
47
|
+
|
48
|
+
# Allow deploy user to manipulate jobs
|
49
|
+
deployuser ALL=(deployuser) NOPASSWD: ALL, (root) NOPASSWD: UPSTART, UPEXPORT
|
50
|
+
|
51
|
+
|
52
|
+
Usage
|
53
|
+
-----
|
54
|
+
|
55
|
+
After upstart-exporter is installed and configured, one may export background jobs from an arbitrary Procfile-like file of the following format:
|
56
|
+
|
57
|
+
cmdlabel1: cmd1
|
58
|
+
cmdlabel2: cmd2
|
59
|
+
|
60
|
+
i.e. a file ./myprocfile containing:
|
61
|
+
|
62
|
+
my_tail_cmd: /usr/bin/tail -F /var/log/messages
|
63
|
+
my_another_tail_cmd: /usr/bin/tail -F /var/log/messages
|
64
|
+
|
65
|
+
For security purposes, command labels are allowed to contain only letters, digits and underscores.
|
66
|
+
|
67
|
+
To export this file one should run
|
68
|
+
|
69
|
+
sudo upstart-export -p ./myprocfile -n myapp
|
70
|
+
|
71
|
+
-hore myapp is the application name. This name only affects the names of generated files. For security purposes, app name is also allowed to contain only letters, digits and underscores. Assuming that default options are used, the following files and folders will be generated:
|
72
|
+
|
73
|
+
in /etc/init/:
|
74
|
+
fb-myapp-my_another_tail_cmd-real.conf
|
75
|
+
fb-myapp-my_another_tail_cmd.conf
|
76
|
+
fb-myapp-my_tail_cmd-real.conf
|
77
|
+
fb-myapp-my_tail_cmd.conf
|
78
|
+
fb-myapp.conf
|
79
|
+
|
80
|
+
in /var/local/upstart\_helpers:
|
81
|
+
|
82
|
+
fb-myapp-my_another_tail_cmd.sh
|
83
|
+
fb-myapp-my_tail_cmd.sh
|
84
|
+
|
85
|
+
Prefix fb- is added to avoid collisions with other upstart jobs. After this my\_tail\_cmd, for example, will be able to be started as an upstart script:
|
86
|
+
|
87
|
+
sudo start fb-myapp-my_tail_cmd
|
88
|
+
|
89
|
+
..
|
90
|
+
|
91
|
+
sudo stop fb-myapp-my_tail_cmd
|
92
|
+
|
93
|
+
It's stdout/stderr will be redirected to /var/log/fb-myapp/my\_tail\_cmd.log.
|
94
|
+
|
95
|
+
To start/stop all application commands at once, one can run:
|
96
|
+
|
97
|
+
sudo start fb-myapp
|
98
|
+
...
|
99
|
+
sudo stop fb-myapp
|
100
|
+
|
101
|
+
To remove upstart scripts and helpers for a particular application one can run
|
102
|
+
|
103
|
+
sudo upstart-export -c -n myapp
|
104
|
+
|
105
|
+
The logs will not be cleared.
|
106
|
+
|
@@ -0,0 +1,116 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Exception: Upstart::ExportError
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../_index.html">Index (E)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../Upstart.html" title="Upstart (module)">Upstart</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">ExportError</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Exception: Upstart::ExportError
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
<dt class="r1">Inherits:</dt>
|
68
|
+
<dd class="r1">
|
69
|
+
<span class="inheritName">RuntimeError</span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
73
|
+
|
74
|
+
<li class="next">RuntimeError</li>
|
75
|
+
|
76
|
+
<li class="next">Upstart::ExportError</li>
|
77
|
+
|
78
|
+
</ul>
|
79
|
+
<a href="#" class="inheritanceTree">show all</a>
|
80
|
+
|
81
|
+
</dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<dt class="r2 last">Defined in:</dt>
|
92
|
+
<dd class="r2 last">lib/upstart-exporter.rb</dd>
|
93
|
+
|
94
|
+
</dl>
|
95
|
+
<div class="clear"></div>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<div id="footer">
|
110
|
+
Generated on Thu Dec 15 17:00:58 2011 by
|
111
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
112
|
+
0.7.4 (ruby-1.8.7).
|
113
|
+
</div>
|
114
|
+
|
115
|
+
</body>
|
116
|
+
</html>
|