Thin_Upstart

This is an alternative to Foreman + Upstart generating your Upstart conf files. It ignores your Procfile, and insteads uses your Thin .yml config file. The following files are generated (assuming you call your group of Thin apps 'web-app'):

# App dirs
|- app1
|- app2

# Template dir
|- {{name}}.conf
|- {{name}}-{{app}}.conf

# Files generated
|- output-dir
  |- web-apps.conf
  |- web-apps-app1.conf
  |- web-apps-app2.conf
  |- ...

Installation

gem install Thin_Upstart

Usage: Ruby

require "Thin_Upstart"

Thin_Upstart { |o|
  o.name      "web-apps"
  o.apps      "./apps"
  o.templates "./templates/*.conf" # file glob     
  o.output    "./upstart"        
  o.yml       "config/thin.yml"  
}

If you want to delete files generated by Thin_Upstart, use:

Thin_Upstart.trash "my/conf/dir"

All files that end in ".conf" are deleted if they contain the following string:

# Generated by Thin_Upstart

Usage: Shell

Thin_Upstart 
  --name       web-apps 
  --apps       ./apps
  --templates  ./templates
  --yml        config/thin.yml
  --output     ./output
  --trash      my/conf/dir  # When used, all other options are ignored.
  --help 

Note: Be sure to use quotation marks when using file globs:

Thin_Upstart --templates "template/*.conf"
Thin_Upstart --yml       "config/*.yml"

Usage: Mustache Template

In your Mustache templates, you have access to the following values:

  • name: Name of app group: e.g. My-Web-Apps
  • apps_dir: Full path to directory of apps.
  • app: Name of current app: e.g. Blog
  • app_path: Full path to app.
  • yml: Relative path from current app directory to .yml file
  • yml_path: Full path to app directory.

You can use Mustache values in the file names of the templates. For example:

  • my/template/dir/{name}.conf
  • my/template/dir/{name}-{app}.conf

The files are generated are:

  • my/template/dir/My-Apps.conf
  • my/template/dir/My-Apps-Hi.conf

Run Tests

git clone git@github.com:da99/Thin_Upstart.git
cd Thin_Upstart
bundle update
bundle exec bacon spec/main.rb

"I hate writing."

If you know of existing software that makes the above redundant, please tell me. The last thing I want to do is maintain code.