Permalink
Browse files

adding vagrant and puppet for development server provisioning

  • Loading branch information...
1 parent f2eb94a commit 3137cacb39f556ed7291bfc99cbb86ea0972943f Martin Moscosa committed Apr 14, 2012
View
@@ -7,3 +7,5 @@ nbproject/
*.kpf
.idea
src/inc/img/event_icons/
+.DS_Store
+.vagrant
View
@@ -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
View
@@ -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
View
@@ -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',
+}
View
@@ -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
+
Oops, something went wrong.

0 comments on commit 3137cac

Please sign in to comment.