Last active
August 29, 2015 14:07
-
-
Save mfournier/e5833dd34d71ed73c458 to your computer and use it in GitHub Desktop.
puppet manifest to run riemann-dash in apache & passenger, on RHEL7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # depends on the following modules: | |
| # - puppetlabs/apache | |
| # - puppetlabs/vcsrepo | |
| # - camptocamp/selinux | |
| class riemann::dash::passenger ($passenger_version = '4.0.50') { | |
| # you'll also need gcc, gcc-c++, make, autoconf, etc, installed | |
| package { ['httpd-devel', 'apr-devel', 'apr-util-devel', 'libcurl-devel', 'openssl-devel', 'zlib-devel']: } -> | |
| package { 'passenger': | |
| ensure => $passenger_version, | |
| provider => 'gem', | |
| } -> | |
| exec { 'build-passenger': | |
| command => '/usr/local/bin/passenger-install-apache2-module -a', | |
| creates => "/usr/local/share/gems/gems/passenger-${passenger_version}/buildout/apache2/mod_passenger.so", | |
| } -> | |
| class { 'apache::mod::passenger': | |
| passenger_root => "/usr/local/share/gems/gems/passenger-${passenger_version}", | |
| passenger_default_ruby => '/usr/bin/ruby', | |
| mod_lib_path => "/usr/local/share/gems/gems/passenger-${passenger_version}/buildout/apache2", | |
| mod_package_ensure => absent, | |
| } | |
| package { ['rubygem-multi_json']: } -> | |
| package { ['sinatra', 'erubis', 'sass']: | |
| provider => 'gem', | |
| } -> | |
| vcsrepo { '/usr/src/riemann-dash': | |
| ensure => 'present', | |
| provider => 'git', | |
| revision => '6c03d5db0ed5561a27a826d5d7c8f4a5c791d5f0', | |
| source => 'https://github.com/aphyr/riemann-dash', | |
| } | |
| file { ['/srv/riemann-dash', '/srv/riemann-dash/rack', '/srv/riemann-dash/rack/public', '/srv/riemann-dash/rack/tmp']: | |
| ensure => directory, | |
| seltype => 'httpd_sys_content_t', | |
| } | |
| file { '/srv/riemann-dash/dashboard': | |
| ensure => directory, | |
| owner => 'nobody', # passenger runs as nobody, not apache ! | |
| group => 'nobody', | |
| seltype => 'httpd_user_rw_content_t', | |
| } | |
| file { '/srv/riemann-dash/config.rb': | |
| ensure => present, | |
| content => 'config.store[:ws_config] = "/srv/riemann-dash/dashboard/config.json"', | |
| notify => Service['httpd'], | |
| seltype => 'httpd_sys_content_t', | |
| } -> | |
| file { '/srv/riemann-dash/rack/config.ru': | |
| ensure => present, | |
| notify => Service['httpd'], | |
| seltype => 'httpd_sys_content_t', | |
| content => '# file managed by puppet | |
| $LOAD_PATH.unshift("/usr/src/riemann-dash/lib") | |
| require "riemann/dash" | |
| Riemann::Dash::App.load "/srv/riemann-dash/config.rb" | |
| run Riemann::Dash::App | |
| ', | |
| } -> | |
| ::apache::mod { ['proxy_wstunnel', 'proxy']: | |
| package_ensure => absent, | |
| } | |
| selboolean { 'httpd_can_network_connect': | |
| value => 'on', | |
| persistent => true, | |
| } -> | |
| ::apache::vhost { $::fqdn: | |
| port => '443', | |
| ssl => true, | |
| docroot => '/var/www/html', | |
| serveraliases => [$::hostname], | |
| custom_fragment => ' | |
| # TODO: add your own authentication mechanism | |
| ProxyPass /riemann/ ws://127.0.0.1:5556/ | |
| <Location /dashboard> | |
| PassengerBaseURI /dashboard | |
| PassengerAppRoot /srv/riemann-dash/rack | |
| </Location> | |
| <Directory /srv/riemann-dash/rack/public> | |
| Allow from all | |
| Options -MultiViews | |
| Require all granted | |
| </Directory> | |
| ', | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment