Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

Commit

Permalink
adding vagrant and puppet for development server provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Moscosa committed Apr 14, 2012
1 parent f2eb94a commit 3137cac
Show file tree
Hide file tree
Showing 21 changed files with 2,807 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ nbproject/
*.kpf
.idea
src/inc/img/event_icons/
.DS_Store
.vagrant
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "modules/apache"]
path = modules/apache
url = https://github.com/example42/puppet-apache
[submodule "modules/puppi"]
path = modules/puppi
url = https://github.com/example42/puppi
[submodule "modules/puppet-mysql"]
path = modules/puppet-mysql
url = https://github.com/example42/puppet-mysql
22 changes: 22 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant::Config.run do |config|
config.vm.box = 'puppet-centos-56-64'
#config.vm.box_url = 'http://dl.dropbox.com/u/1627760/centos-6.0-x86_64.box'

# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
config.vm.forward_port 80, 8080

# Share an additional folder to the guest VM. The first argument is
# an identifier, the second is the path on the guest to mount the
# folder, and the third is the path on the host to the actual folder.
# config.vm.share_folder "v-data", "/vagrant_data", "../data"

config.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.module_path = "modules"
puppet.manifest_file = "vagrant.pp"
end
end
49 changes: 49 additions & 0 deletions manifests/vagrant.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
node default {
include apache
include puppi
include mysql
include php
include something::db
}


define mysqldb( $user, $password ) {
exec { "create-${name}-db":
unless => "/usr/bin/mysql -u${user} -p${password} ${name}",
command => "/usr/bin/mysql -uroot -p$mysql_password -e \"create database ${name}; grant all on ${name}.* to ${user}@localhost identified by '$password';\"",
require => Service["mysqld"],
}
}

Exec {
path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ]
}

class { "apache": }
php::module { mysql: }

apache::vhost{ 'dev.joind.in':
docroot => '/vagrant/src',
template => '/vagrant/templates/virtualhost/vhost.conf.erb',
}

class something::db {
mysqldb { "joindin":
user => 'joindin',
password => 'password',
}
}

exec { 'patch-db':
command => "/vagrant/src/scripts/patchdb.sh -t /vagrant -d joindin -u joindin -p password -i",
path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ]
}

file { 'database-config':
path => '/vagrant/src/system/application/config/database.php',
source => '/vagrant/templates/database.php.erb',
}
file { 'application-config':
path => '/vagrant/src/system/application/config/config.php',
source => '/vagrant/templates/config.php.erb',
}
27 changes: 27 additions & 0 deletions modules/php/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Puppet module: php

# Written by Lab42 #
# http://www.example42.com

Licence: Apache2


DESCRIPTION:
This module installs php and provides custom defines to manage php modules, pear components and pecl extensions

USAGE:
include php # Installs php
include php::pear # Installs pear support
include php::dev # Installs php-dev
#TODO include php::absent # Remove php package.

php::module { mysql: } # Installs specific module for php

php::pear::module { Crypt-CHAP: } # Installs pear component using OS package
php::pear::module { "XML_Serializer": use_package => "no", preferred_state => "beta" } # Installs pear component with pear command
php::pear::config { "http_proxy": value => "$proxy_server" } # Configures pear environment

php::pecl::module { "xslcache": } # Installs pecl module using OS package
php::pecl::module { "xslcache": use_package => "no", preferred_state => "beta" } # Installs pecl module with pecl command
php::pecl::config { "http_proxy": value => "$proxy_server" } # Configures pecl environment

Loading

0 comments on commit 3137cac

Please sign in to comment.