How to use foreman to export to upstart?

user664833 picture user664833 · Oct 20, 2012 · Viewed 9.7k times · Source

I am trying to export my application to another process management format/system (specifically, upstart). In doing so, I have come across a number of roadblocks, mostly due to lacking documentation.

As a non-root user, I ran the following command (as shown here):

-bash> foreman export upstart /etc/init
ERROR: Could not create: /etc/init

I "could not create" the directory due to inadequate permissions, so I used sudo:

-bash> sudo foreman export upstart /etc/init
Password:
ERROR: Could not chown /var/log/app to app

I "could not chown... to app" because there is no user named app.

Where is app coming from?

How should I use forman to export to upstart?

Answer

user664833 picture user664833 · Oct 20, 2012

app is default for both the name of the app and the name of the user the application should be run as when the corresponding options (--app and --user) are not used. See the foreman man page for the available options, but note that at the time of this writing the official synopsis did not include [options]:

foreman export [options] <format> [location]

Example:

-bash> sudo foreman export --app foo --user bar upstart /etc/init
Password:
[foreman export] writing: foo.conf
[foreman export] writing: foo-web.conf
[foreman export] writing: foo-web-1.conf
[foreman export] writing: foo-worker.conf
[foreman export] writing: foo-worker-1.conf

Result:

-bash> l /etc/init/
total 80
drwxr-xr-x  12 root  wheel   408 20 Oct 09:31 .
drwxr-xr-x  94 root  wheel  3196 20 Oct 08:05 ..
-rw-r--r--   1 root  wheel   236 20 Oct 09:31 foo-web-1.conf
-rw-r--r--   1 root  wheel    41 20 Oct 09:31 foo-web.conf
-rw-r--r--   1 root  wheel   220 20 Oct 09:31 foo-worker-1.conf
-rw-r--r--   1 root  wheel    41 20 Oct 09:31 foo-worker.conf
-rw-r--r--   1 root  wheel   315 20 Oct 09:31 foo.conf

-bash> l /var/log/foo/
total 0
drwxr-xr-x   2 bar     wheel    68 20 Oct 09:31 .
drwxr-xr-x  45 root    wheel  1530 20 Oct 09:31 ..