-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add code for rvm::passenger::nginx on ubuntu.
- Loading branch information
Showing
3 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
class rvm::passenger::nginx( | ||
$ruby_version, | ||
$version, | ||
$rvm_prefix = '/usr/local/', | ||
$mininstances = '1', | ||
$maxpoolsize = '6', | ||
$poolidletime = '300', | ||
$maxinstancesperapp = '0', | ||
$spawnmethod = 'smart-lv2' | ||
) { | ||
|
||
case $::operatingsystem { | ||
Ubuntu,Debian: { include rvm::passenger::nginx::ubuntu::pre } | ||
CentOS,RedHat: { include rvm::passenger::nginx::centos::pre } | ||
} | ||
|
||
class { | ||
'rvm::passenger::gem': | ||
ruby_version => $ruby_version, | ||
version => $version, | ||
} | ||
|
||
# TODO: How can we get the gempath automatically using the ruby version | ||
# Can we read the output of a command into a variable? | ||
# e.g. $gempath = `usr/local/rvm/bin/rvm ${ruby_version} exec rvm gemdir` | ||
$gempath = "${rvm_prefix}rvm/gems/${ruby_version}/gems" | ||
$binpath = "${rvm_prefix}rvm/bin/" | ||
|
||
case $::operatingsystem { | ||
Ubuntu,Debian: { | ||
if !defined(Class['rvm::passenger::nginx::ubuntu::post']) { | ||
class { 'rvm::passenger::nginx::ubuntu::post': | ||
ruby_version => $ruby_version, | ||
version => $version, | ||
rvm_prefix => $rvm_prefix, | ||
mininstances => $mininstances, | ||
maxpoolsize => $maxpoolsize, | ||
poolidletime => $poolidletime, | ||
maxinstancesperapp => $maxinstancesperapp, | ||
spawnmethod => $spawnmethod, | ||
gempath => $gempath, | ||
binpath => $binpath; | ||
} | ||
} | ||
} | ||
CentOS,RedHat: { | ||
if !defined(Class['rvm::passenger::nginx::centos::post']) { | ||
class { 'rvm::passenger::nginx::centos::post': | ||
ruby_version => $ruby_version, | ||
version => $version, | ||
rvm_prefix => $rvm_prefix, | ||
mininstances => $mininstances, | ||
maxpoolsize => $maxpoolsize, | ||
poolidletime => $poolidletime, | ||
maxinstancesperapp => $maxinstancesperapp, | ||
spawnmethod => $spawnmethod, | ||
gempath => $gempath, | ||
binpath => $binpath; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
class rvm::passenger::nginx::ubuntu::post( | ||
$ruby_version, | ||
$version, | ||
$rvm_prefix = '/usr/local/', | ||
$mininstances = '1', | ||
$maxpoolsize = '6', | ||
$poolidletime = '300', | ||
$maxinstancesperapp = '0', | ||
$spawnmethod = 'smart-lv2', | ||
$gempath, | ||
$binpath | ||
) { | ||
|
||
exec { | ||
'passenger-install-nginx-module': | ||
command => "${binpath}rvm ${ruby_version} exec passenger-install-nginx-module -a", | ||
creates => "${gempath}/passenger-${version}/ext/nginx/mod_passenger.so", | ||
logoutput => 'on_failure', | ||
require => [Rvm_gem['passenger'], Package['nginx', 'build-essential', 'nginx-dev', | ||
'libcurl4-openssl-dev']], | ||
} | ||
|
||
# file { | ||
# '/etc/nginx/mods-available/passenger.load': | ||
# ensure => file, | ||
# content => "LoadModule passenger_module ${gempath}/passenger-${version}/ext/nginx/mod_passenger.so", | ||
# require => Exec['passenger-install-nginx-module']; | ||
# | ||
# '/etc/nginx/mods-available/passenger.conf': | ||
# ensure => file, | ||
# content => template('rvm/passenger-nginx.conf.erb'), | ||
# require => Exec['passenger-install-nginx-module']; | ||
# | ||
# '/etc/nginx/mods-enabled/passenger.load': | ||
# ensure => 'link', | ||
# target => '../mods-available/passenger.load', | ||
# require => File['/etc/nginx/mods-available/passenger.load']; | ||
# | ||
# '/etc/nginx/mods-enabled/passenger.conf': | ||
# ensure => 'link', | ||
# target => '../mods-available/passenger.conf', | ||
# require => File['/etc/nginx/mods-available/passenger.conf']; | ||
# } | ||
# | ||
# # Add Apache restart hooks | ||
# if defined(Service['nginx']) { | ||
# File['/etc/nginx/mods-available/passenger.load'] ~> Service['nginx'] | ||
# File['/etc/nginx/mods-available/passenger.conf'] ~> Service['nginx'] | ||
# File['/etc/nginx/mods-enabled/passenger.load'] ~> Service['nginx'] | ||
# File['/etc/nginx/mods-enabled/passenger.conf'] ~> Service['nginx'] | ||
# } | ||
# if defined(Service['nginx']) { | ||
# File['/etc/nginx/mods-available/passenger.load'] ~> Service['nginx'] | ||
# File['/etc/nginx/mods-available/passenger.conf'] ~> Service['nginx'] | ||
# File['/etc/nginx/mods-enabled/passenger.load'] ~> Service['nginx'] | ||
# File['/etc/nginx/mods-enabled/passenger.conf'] ~> Service['nginx'] | ||
# } | ||
# if defined(Service['httpd']) { | ||
# File['/etc/nginx/mods-available/passenger.load'] ~> Service['httpd'] | ||
# File['/etc/nginx/mods-available/passenger.conf'] ~> Service['httpd'] | ||
# File['/etc/nginx/mods-enabled/passenger.load'] ~> Service['httpd'] | ||
# File['/etc/nginx/mods-enabled/passenger.conf'] ~> Service['httpd'] | ||
# } | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class rvm::passenger::nginx::ubuntu::pre { | ||
|
||
# Dependencies | ||
if ! defined(Package['nginx']) { package { 'nginx': ensure => installed } } | ||
if ! defined(Package['build-essential']) { package { 'build-essential': ensure => installed } } | ||
if ! defined(Package['nginx-dev']) { package { 'nginx-dev': ensure => installed } } | ||
if ! defined(Package['libcurl4-openssl-dev']) { package { 'libcurl4-openssl-dev': ensure => installed } } | ||
} |