Skip to content

Instantly share code, notes, and snippets.

@rockpapergoat
Created November 13, 2012 23:52
Show Gist options
  • Save rockpapergoat/4069232 to your computer and use it in GitHub Desktop.
Save rockpapergoat/4069232 to your computer and use it in GitHub Desktop.
puppet config files
# located here on the master:
# /etc/puppet/rack/puppetmasterd/public/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 << "--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" << "/etc/puppet"
ARGV << "--vardir" << "/var/lib/puppet"
# 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
i'm trying to setup a puppet 3.0.1 master with passenger on centos 6.3 x64 with not much luck so far.
as far as i can tell, puppet + webrick works. i'll have to test again to verify.
the passenger docs are out of date at docs.puppetlabs.com.
on the master itself, i had to install the following to get things going. [aside: it would be nice to include an officially tested/sanctioned bootstrap script for this.]
- puppet-3.0.1
- puppet-server-3.0.1
- httpd
- httpd-devel
- apr-util
- apr-util-devel
- openssl-devel
- curl-devel
- zlib-devel
- gcc-c++
- ruby-devel
- mod_ssl
- rubygem-rake
- rubygem-passenger
under ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux], the following gems are installed:
- daemon_controller (1.1.0)
- fastthread (1.0.7)
- json (1.4.6)
- passenger (3.0.18)
- rack (1.1.0)
- rake (0.8.7)
config files in place, including locations are here:
https://gist.github.com/4069232
with all that installed and configured, running `puppet agent -t --server puppet-test.example.com --certname puppet-test.example.com` throws passenger errors:
# /etc/httpd/conf.d/passenger.conf
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.18
PassengerRuby /usr/bin/ruby
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="Phusion Passenger">
<title>Ruby (Rack) application could not be started</title>
<style type="text/css">
body {
font-family: Verdana, 'Bitstream Vera Sans', Arial, Sans-Serif;
font-size: 10pt;
background: white;
color: #222222;
margin: 0;
padding-top: 3em;
padding-bottom: 3em;
padding-left: 4.5em;
padding-right: 4.5em;
}
h1 {
font-size: 17pt;
font-weight: medium;
color: #533e72;
border-bottom: 1px solid #533e72;
}
h1.title {
margin-top: 0;
}
h1.error_title {
color: red;
border-bottom: 1px solid red;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
dt {
font-weight: bold;
color: #280050;
}
dd {
margin-top: 0.5em;
margin-bottom: 1em;
}
.commands {
border: 1px solid #b594e7;
background: #ddc6ff;
padding: 0.5em;
margin: 0.5em;
font-family: 'Bitstream Vera Sans Mono', 'Courier New', Monospace;
}
table.backtrace th {
background: #8470a6;
color: white;
}
table.backtrace th,
table.backtrace td {
padding: 0.2em;
padding-left: 0.4em;
padding-right: 0.4em;
}
table.backtrace tr td {
background: #ecdfff;
}
table.backtrace tr.even td {
background: #f7f2ff;
}
table.backtrace td.index {
font-weight: bold;
}
#site_footer {
border-top: solid 1px black;
margin-top: 1em;
padding-top: 1em;
font-size: small;
color: #777777;
}
#site_footer a {
color: #65498e;
}
#site_footer a:hover {
color: #9681d9;
}
#site_header .corporate_identity {
display: none;
}
</style>
<link rel="stylesheet" type="text/css" href="http://www.modrails.com/error_pages/1.0/error_page.css">
</head>
<body>
<div id="site_container">
<div id="site_header">
<ul class="corporate_identity">
<li class="logo"><a href="https://www.phusionpassenger.com"><span>Phusion Passenger</span></a></li>
</ul>
</div>
<div id="site_body">
<h1 class="error_title">Ruby (Rack) application could not be started</h1>
<div id="content">
These are the possible causes:
<ul>
<li class="first">
<div class="container">
<div class="content">
There may be a syntax error in the application's code. Please
check for such errors and fix them.
</div>
</div>
</li>
<li>
<div class="container">
<div class="content">
A required library may not installed. Please install all libraries
that this application requires.
</div>
</div>
</li>
<li>
<div class="container">
<div class="content">
The application may not be properly configured. Please check whether all
configuration files are written correctly, fix any incorrect
configurations, and restart this application.
</div>
</div>
</li>
<li class="last">
<div class="container">
<div class="content">
A service that the application relies on (such as the database server
or the Ferret search engine server) may not have been started. Please start
that service.
</div>
</div>
</li>
</ul>
Further information about the error may have been written to the
application's log file. Please check it in order to analyse the problem.
<dl>
<dt>Error message:</dt>
<dd>No such file or directory - config.ru</dd>
<dt>Exception class:</dt>
<dd>Errno::ENOENT</dd>
<dt>Application root:</dt>
<dd>
<tt class="filename">/etc/puppet/rack/puppetmasterd</tt>
</dd>
<dt>Backtrace:</dt>
<dd>
<table class="backtrace">
<tr class="headers">
<th>#</th>
<th>File</th>
<th>Line</th>
<th>Location</th>
</tr>
<tr class="backtrace_line passenger uneven">
<td class="index">0</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/utils.rb</td>
<td class="line">675</td>
<td class="location">in `lstat'</td>
</tr>
<tr class="backtrace_line passenger even">
<td class="index">1</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/utils.rb</td>
<td class="line">675</td>
<td class="location">in `lower_privilege'</td>
</tr>
<tr class="backtrace_line passenger uneven">
<td class="index">2</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/utils.rb</td>
<td class="line">198</td>
<td class="location">in `prepare_app_process'</td>
</tr>
<tr class="backtrace_line passenger even">
<td class="index">3</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/rack/application_spawner.rb</td>
<td class="line">156</td>
<td class="location">in `initialize_server'</td>
</tr>
<tr class="backtrace_line passenger uneven">
<td class="index">4</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/utils.rb</td>
<td class="line">563</td>
<td class="location">in `report_app_init_status'</td>
</tr>
<tr class="backtrace_line passenger even">
<td class="index">5</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/rack/application_spawner.rb</td>
<td class="line">154</td>
<td class="location">in `initialize_server'</td>
</tr>
<tr class="backtrace_line passenger uneven">
<td class="index">6</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb</td>
<td class="line">204</td>
<td class="location">in `start_synchronously'</td>
</tr>
<tr class="backtrace_line passenger even">
<td class="index">7</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb</td>
<td class="line">180</td>
<td class="location">in `start'</td>
</tr>
<tr class="backtrace_line passenger uneven">
<td class="index">8</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/rack/application_spawner.rb</td>
<td class="line">129</td>
<td class="location">in `start'</td>
</tr>
<tr class="backtrace_line passenger even">
<td class="index">9</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb</td>
<td class="line">253</td>
<td class="location">in `spawn_rack_application'</td>
</tr>
<tr class="backtrace_line passenger uneven">
<td class="index">10</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server_collection.rb</td>
<td class="line">132</td>
<td class="location">in `lookup_or_add'</td>
</tr>
<tr class="backtrace_line passenger even">
<td class="index">11</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb</td>
<td class="line">246</td>
<td class="location">in `spawn_rack_application'</td>
</tr>
<tr class="backtrace_line passenger uneven">
<td class="index">12</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server_collection.rb</td>
<td class="line">82</td>
<td class="location">in `synchronize'</td>
</tr>
<tr class="backtrace_line passenger even">
<td class="index">13</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server_collection.rb</td>
<td class="line">79</td>
<td class="location">in `synchronize'</td>
</tr>
<tr class="backtrace_line passenger uneven">
<td class="index">14</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb</td>
<td class="line">244</td>
<td class="location">in `spawn_rack_application'</td>
</tr>
<tr class="backtrace_line passenger even">
<td class="index">15</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb</td>
<td class="line">137</td>
<td class="location">in `spawn_application'</td>
</tr>
<tr class="backtrace_line passenger uneven">
<td class="index">16</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb</td>
<td class="line">275</td>
<td class="location">in `handle_spawn_application'</td>
</tr>
<tr class="backtrace_line passenger even">
<td class="index">17</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb</td>
<td class="line">357</td>
<td class="location">in `__send__'</td>
</tr>
<tr class="backtrace_line passenger uneven">
<td class="index">18</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb</td>
<td class="line">357</td>
<td class="location">in `server_main_loop'</td>
</tr>
<tr class="backtrace_line passenger even">
<td class="index">19</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb</td>
<td class="line">206</td>
<td class="location">in `start_synchronously'</td>
</tr>
<tr class="backtrace_line passenger uneven">
<td class="index">20</td>
<td class="filename">/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/helper-scripts/passenger-spawn-server</td>
<td class="line">99</td>
<td class="location"></td>
</tr>
</table>
</dd>
</dl>
</div>
</div>
<div id="site_footer">
<!--
You are free to modify the footer as you see fit,
but we kindly ask of you to preserve to following
text. Thank you.
-->
<div class="container">
Powered by <a href="https://www.phusionpassenger.com/">Phusion Passenger</a>,
<tt>mod_rails</tt> / <tt>mod_rack</tt> for Apache and Nginx.
</div>
</div>
</div>
</body>
</html>
[main]
logdir = /var/log/puppet
rundir = /var/run/puppet
ssldir = $vardir/ssl
modulepath = $confdir/modules:$confdir/modules-0
server = puppet-test.example.com
[agent]
classfile = $vardir/classes.txt
localconfig = $vardir/localconfig
certname = puppet-test.example.com
server = puppet-test.example.com
report = true
pluginsync = true
[master]
autosign = true
certname = puppet-test.example.com
reports = store,http
dns_alt_names = puppet-test
# /etc/httpd/conf.d/puppetmaster.conf
PassengerHighPerformance on
PassengerMaxPoolSize 12
PassengerPoolIdleTime 1500
# PassengerMaxRequests 1000
PassengerStatThrottleRate 120
RackAutoDetect Off
RailsAutoDetect Off
Listen 8140
<VirtualHost *:8140>
SSLEngine on
SSLProtocol -ALL +SSLv3 +TLSv1
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP
SSLCertificateFile /var/lib/puppet/ssl/certs/puppet-test.example.com.pem
SSLCertificateKeyFile /var/lib/puppet/ssl/private_keys/puppet-test.example.com.pem
SSLCertificateChainFile /var/lib/puppet/ssl/ca/ca_crt.pem
SSLCACertificateFile /var/lib/puppet/ssl/ca/ca_crt.pem
# If Apache complains about invalid signatures on the CRL, you can try disabling
# CRL checking by commenting the next line, but this is not recommended.
SSLCARevocationFile /var/lib/puppet/ssl/ca/ca_crl.pem
SSLVerifyClient optional
SSLVerifyDepth 1
# The `ExportCertData` option is needed for agent certificate expiration warnings
SSLOptions +StdEnvVars +ExportCertData
# This header needs to be set if using a loadbalancer or proxy
RequestHeader unset X-Forwarded-For
RequestHeader set X-SSL-Subject %{SSL_CLIENT_S_DN}e
RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e
RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e
DocumentRoot /etc/puppet/rack/puppetmasterd/public/
RackBaseURI /
<Directory /etc/puppet/rack/puppetmasterd/public/ >
Options None
AllowOverride None
Order allow,deny
allow from all
</Directory>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment