Skip to content

Instantly share code, notes, and snippets.

@kylog
Last active December 24, 2015 00:59
Show Gist options
  • Save kylog/6720256 to your computer and use it in GitHub Desktop.
Save kylog/6720256 to your computer and use it in GitHub Desktop.
Steps for thin rack on osx. Cleanup needed.
# This is how I invoked thin, inside a puppet directory
#
# The ssl args are so the https termination is at thin; others use nginx for the ssl termination
# (btw, testdir=/Users/kylo/devel/test/foo)
# The -V and -D are just verbosity and debug
bundle exec thin -R ~/config.ru -p 8140 -V -D --ssl --ssl-key-file $testdir/master/conf/ssl/private_keys/localhost.pem --ssl-cert-file $testdir/master/conf/ssl/certs/localhost.pem start
# For some reason I had ssl unhappiness until I got a promiscuous auth.conf:
path ~ ^/.*
auth any
allow *
# Here's config.ru, based on ext/rack/config.ru
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.
# if puppet is not in your RUBYLIB:
# $LOAD_PATH.unshift('/opt/puppet/lib')
$0 = "master"
# if you want debugging:
# ARGV << "--debug"
ARGV << "--logdest" << "/Users/kylo/puppet.log" # b/c thin -l doesn't get puppet logs
ARGV << "--autosign=true"
ARGV << "--no-daemonize"
ARGV << "--debug"
ARGV << "--verbose"
ARGV << "--trace"
ARGV << "--certname" << "localhost"
ARGV << "--rack"
# Rack applications typically don't start as root. Set --confdir and --vardir
# to prevent reading configuration from ~puppet/.puppet/puppet.conf and writing
# to ~puppet/.puppet
ARGV << "--confdir" << "/Users/kylo/devel/test/foo/master/conf"
ARGV << "--vardir" << "/Users/kylo/devel/test/foo/master/var"
# NOTE: it's unfortunate that we have to use the "CommandLine" class
# here to launch the app, but it contains some initialization logic
# (such as triggering the parsing of the config file) that is very
# important. We should do something less nasty here when we've
# gotten our API and settings initialization logic cleaned up.
#
# Also note that the "$0 = master" line up near the top here is
# the magic that allows the CommandLine class to know that it's
# supposed to be running master.
#
# --cprice 2012-05-22
require 'puppet/util/command_line'
# we're usually running inside a Rack::Builder.new {} block,
# therefore we need to call run *here*.
run Puppet::Util::CommandLine.new.execute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment