-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rough sketch of Nginx & FPM based module
- Loading branch information
0 parents
commit 2f1ed08
Showing
7 changed files
with
170 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,8 @@ | ||
name 'thsutton-nginx' | ||
author 'thsutton' | ||
description 'Install and configure Nginx.' | ||
summary 'Install and configure Nginx.' | ||
license 'BSD3' | ||
source 'https://github.com/thsutton/puppet-tomcat.git' | ||
project_page '' | ||
version '0.0.1' |
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 @@ | ||
Puppet Module: Drupal | ||
===================== | ||
|
||
This module makes it straightforward to configure Nginx, PHP FPM and | ||
MySQL to host Drupal web-sites. Its Nginx configuration is based on | ||
that of the Aegir hosting platform, and includes support for several | ||
popular Drupal modules. | ||
|
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,21 @@ | ||
# = Class: drupal::configuration | ||
# | ||
# This class creates the Drupal-specific configuration files for use | ||
# by Nginx vhosts, etc. | ||
# | ||
# == Requires | ||
# | ||
# Nothing | ||
# | ||
# == Sample Usage: | ||
# | ||
# class { 'drupal::configuration' : | ||
# include_support => ['ad'], | ||
# } | ||
# | ||
class drupal::configuration ( $include_support = [] ) { | ||
file { '/etc/nginx/drupal-site.conf' : | ||
ensure => present, | ||
content = template('drupal/nginx-drupal.erb'), | ||
} | ||
} |
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,30 @@ | ||
# | ||
# = Class: drupal | ||
# | ||
# Install and configure services to host Drupal sites. | ||
# | ||
# == Requires: | ||
# | ||
# thsutton-nginx | ||
# thsutton-mysql | ||
# thsutton-php | ||
# | ||
# == Sample Usage: | ||
# | ||
# include drupal | ||
# | ||
class drupal { | ||
|
||
include nginx | ||
include php::fpm | ||
include mysql::server | ||
|
||
# php::extension { 'apc' : ensure => present } | ||
# php::extension { 'gd' : ensure => present } | ||
# php::extension { 'mysql' : ensure => present } | ||
|
||
# php::fpm::pool { 'www' : ensure => absent } | ||
# php::fpm::pool { 'drupal': ensure => present } | ||
|
||
include drupal::configuration | ||
} |
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 @@ | ||
|
||
# == Sample Usage: | ||
# | ||
# drupal::site { 'robocop' : | ||
# ensure => present, | ||
# path => '/var/www/robocop/', | ||
# dbhost => 'db1.ocp.com', | ||
# dbname => 'robocop_site', | ||
# dbuser => 'robocop', | ||
# dbpass => 'robopass', | ||
# pool => 'ocp', | ||
# } | ||
# | ||
define drupal::site ( | ||
$ensure => present | ||
, $path | ||
, $dbname | ||
, $dbuser | ||
, $dbpass | ||
, $dbhost = 'localhost' | ||
, $pool = 'www' | ||
, $ssl = undef | ||
) { | ||
|
||
case $ensure { | ||
'present' : { | ||
# Require File[$path] | ||
|
||
# Require Php::Fpm::Pool[$pool] | ||
} | ||
} | ||
|
||
# MySQL configuration | ||
mysql_user { "$dbuser@$dbhost" : | ||
ensure => $ensure, | ||
password => mysql_hash($dbpass) | ||
} | ||
mysql_database { "$dbhost/$dbname" : | ||
ensure => $ensure, | ||
} | ||
mysql_grant { "$dbuser@$dbhost/$dbname" | ||
ensure => $ensure, | ||
privileges => all | ||
} | ||
|
||
file { "/etc/nginx/sites-available/drupal-$title" : | ||
ensure => $ensure, | ||
content => template('drupal/nginx-site.erb'), | ||
} | ||
|
||
file { "/etc/nginx/sites-enabled/drupal-$title" : | ||
ensure => $ensure ? { | ||
enabled, present => 'link', | ||
default => 'absent', | ||
}, | ||
target => "/etc/nginx/sites-available/drupal-$title", | ||
require => File["/etc/nginx/sites-available/drupal-$title"], | ||
notify => Class['nginx::service'], | ||
} | ||
|
||
Class['drupal::configuration'] -> Defined::Type["$title"] | ||
} | ||
|
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,13 @@ | ||
### | ||
### THIS FILE IS MANAGED BY PUPPET | ||
### | ||
|
||
# | ||
# This file contains Drupal-specific configuration directives which | ||
# should be included directly within the server block for a Drupal | ||
# site. | ||
# | ||
# This file is based on the similar file generated by the Aegir | ||
# project. | ||
# | ||
|
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,27 @@ | ||
## | ||
## THIS FILE IS MANAGED BY PUPPET! | ||
## | ||
|
||
server { | ||
listen *; | ||
root <%= path %>; | ||
|
||
index index.php index.html; | ||
server_name <%= "hello" %>; | ||
|
||
location @drupal { | ||
fastcgi_pass 127.0.0.1:9000; | ||
} | ||
|
||
#error_page 404 /404.html; | ||
#location = /404.html { | ||
# root /usr/share/nginx/www; | ||
#} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/www; | ||
} | ||
|
||
# include <% drupal_path %>; | ||
} |