Permalink
Browse files

Merge pull request #9 from shanethehat/vagrant

Vagrant development environment
  • Loading branch information...
2 parents accf30e + bf3ad2f commit 56dac496840327aa5a54a4b8b5f10ee5fc9775d6 Clair committed Mar 19, 2013
View
@@ -9,3 +9,4 @@
.idea/workspace.xml
.idea/libraries/sass_stdlib.xml
.idea/scopes/scope_settings.xml
+.vagrant
View
@@ -0,0 +1,9 @@
+[submodule "puppet/modules/puppi"]
+ path = puppet/modules/puppi
+ url = https://github.com/example42/puppi
+[submodule "puppet/modules/apache"]
+ path = puppet/modules/apache
+ url = https://github.com/example42/puppet-apache
+[submodule "puppet/modules/php"]
+ path = puppet/modules/php
+ url = https://github.com/example42/puppet-php
View
@@ -6,29 +6,83 @@ way to claim and track their presentations over time.
This version is the next generation version, providing a responsive cross-device site for screens of all devices
-You can install joind.in on an existing PHP platform using the following instructions
+You can either install joind.in on an existing PHP platform, or use our vagrant setup.
+## Quick start with Vagrant
-## Quick Start
+You can set up a development virtual machine running joind.in by following these simple instructions.
-1. Create a vhost entry for the site. The docroot should be `/web`.
+1. Install requirements. (Note: these are not required by joind.in itself, but are required for this quick start guide.)
+ - VirtualBox (https://www.virtualbox.org/) (versions 4.0 and 4.1 are currently supported)
+ - Ruby (http://www.ruby-lang.org/)
+ - Vagrant (http://vagrantup.com/)
+
+1. Clone repository to any location and fetch required submodules (containing Puppet manifests).
+
+ git clone https://github.com/joindin/responsive --recursive
+ cd responsive
+
+ -- or --
+
+ git clone https://github.com/joindin/responsive && cd responsive
+ git submodule init
+ git submodule update
+
+1. Add hostname to /etc/hosts.
+
+ echo "127.0.0.1 joindin.local" | sudo tee -a /etc/hosts
+
+1. Start the process by running Vagrant.
+
+ vagrant up
+
+1. Browse to the newly provisioned development copy of joind.in.
+
+ open http://joindin.local:8008
- <VirtualHost *:80>
- ServerName joindin.local
+*Notes:*
- DocumentRoot "/home/exampleuser/www/joind.in/web"
+- HTTP and SSH ports on the VM are forwarded to localhost (22 -> 2222, 80 -> 8008)
+
+- The responsive directory you cloned will be mounted inside the VM at `/vagrant`
+- You can develop by editing the files you cloned in the IDE of you choice.in
+
+- To stop the VM do one of the following:
+
+ `vagrant suspend` if you plan on running it later
+
+ `vagrant destroy` if you wish to delete the VM completely
+
+- Also, when any of of the Puppet manifests change, it is a good idea to rerun them:
+
+ vagrant provision
+
+
+## Quick Start for existing platforms
+
+1. Clone repository to any location
+
+ git clone https://github.com/joindin/responsive
+ cd responsive
+
+1. Create a vhost entry for the site. The docroot should be `/web`.
- <Directory "/home/exampleuser/www/joind.in">
- Options FollowSymLinks
- AllowOverride All
- </Directory>
- </VirtualHost>
+ <VirtualHost *:80>
+ ServerName joindin.local
+
+ DocumentRoot "/home/exampleuser/www/responsive/web"
+
+ <Directory "/home/exampleuser/www/responsive">
+ Options FollowSymLinks
+ AllowOverride All
+ </Directory>
+ </VirtualHost>
-2. Add hostname to /etc/hosts.
+1. Add hostname to /etc/hosts.
- echo "127.0.0.1 joindin.local" | sudo tee -a /etc/hosts
+ echo "127.0.0.1 joindin.local" | sudo tee -a /etc/hosts
-3. Enjoy the site!
+1. Enjoy the site!
## Other Resources
View
@@ -0,0 +1,39 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant::Config.run do |config|
+
+ # Define an differently named box for responsive site
+ config.vm.define :joindin_responsive do |ji_config|
+
+ ji_config.vm.box = 'centos-62-64-puppet'
+ ji_config.vm.box_url = 'http://packages.vstone.eu/vagrant-boxes/centos/6.2/centos-6.2-64bit-puppet-vbox.4.1.12.box'
+
+ ji_config.vm.host_name = "joindin.local"
+
+ # Forward a port from the guest to the host, which allows for outside
+ # computers to access the VM, whereas host only networking does not.
+ ji_config.vm.forward_port 80, 8008
+
+ # 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"
+
+ # Use :gui for showing a display for easy debugging of vagrant
+ ji_config.vm.boot_mode = :gui
+
+# Provision the VM with Puppet
+ ji_config.vm.provision :puppet do |puppet|
+ puppet.manifests_path = "puppet/manifests"
+ puppet.module_path = "puppet/modules"
+ puppet.manifest_file = "joindin.pp"
+ puppet.options = [
+ '--verbose',
+ # '--debug',
+ # '--graph',
+ # '--graphdir=/vagrant/puppet/graphs'
+ ]
+ end
+ end
+end
@@ -0,0 +1,11 @@
+
+# Set default path for Exec calls
+Exec {
+ path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ]
+}
+
+# Include the parameters file then execute the joinin module
+node default {
+ include params
+ include joindin
+}
@@ -0,0 +1,7 @@
+# Tweak these variables to adjust your development environment:
+
+class params {
+ $host = 'joindin.local'
+
+ $port = '80' # Check `VagrantFile` for port forwarding settings
+}
Submodule apache added at e41262
@@ -0,0 +1,28 @@
+; This file is maintained by Puppet. Do not modify!
+
+[epel]
+name=Extra Packages for Enterprise Linux 6 - $basearch
+#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
+failovermethod=priority
+enabled=1
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
+
+[epel-debuginfo]
+name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
+#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
+failovermethod=priority
+enabled=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
+gpgcheck=1
+
+[epel-source]
+name=Extra Packages for Enterprise Linux 6 - $basearch - Source
+#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
+failovermethod=priority
+enabled=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
+gpgcheck=1
@@ -0,0 +1,5 @@
+# 'site' module.
+class joindin {
+ include joindin::setup
+ include joindin::web
+}
@@ -0,0 +1,17 @@
+class joindin::setup {
+
+ # Setup another EPEL repo, the default one is disabled.
+ file { "EpelRepo" :
+ path => "/etc/yum.repos.d/epel.repo",
+ source => "puppet:///modules/joindin/epel.repo",
+ owner => "root",
+ group => "root",
+ }
+
+ # Install some default packages
+ $default_packages = [ "strace", "sysstat", "git" ]
+ package { $default_packages :
+ ensure => present,
+ }
+
+}
@@ -0,0 +1,103 @@
+class joindin::test::test {
+
+ # Install ant to build test suite
+ package { 'ant':
+ #require => Notify['running'],
+ }
+
+ # Install required PEAR modules for test suite
+ package { 'php-pear':
+ #require => Package['php'],
+ }
+
+ # Discover the phpunit pear channel first - must do this separately because
+ # there is no guarantee of which tool will install first
+ exec { 'phpunit-channel':
+ command => 'pear channel-discover pear.phpunit.de',
+ require => Package['php-pear'],
+ }
+
+ # PHP DOM extension required by PHPUnit on CentOS
+ package { 'php-xml':
+ require => Package['php-pear'],
+ }
+
+ # Install test-suite tools
+ exec { 'phpunit':
+ creates => '/usr/bin/phpunit',
+ command => 'pear install phpunit/PHPUnit',
+ require => [
+ Exec['phpunit-channel'],
+ Package['php-xml'],
+ ],
+ before => Notify['test'],
+ }
+
+ exec { 'phploc':
+ creates => '/usr/bin/phploc',
+ command => 'pear channel-discover components.ez.no && /
+ pear channel-discover pear.netpirates.net && /
+ pear channel-discover pear.symfony.com && /
+ pear install phpunit/phploc',
+ require => Exec['phpunit-channel'],
+ before => Notify['test'],
+ }
+
+ exec { 'phpcpd':
+ creates => '/usr/bin/phpcpd',
+ command => 'pear install phpunit/phpcpd',
+ require => Exec['phpunit-channel'],
+ before => Notify['test'],
+ }
+
+ exec { 'pdepend':
+ creates => '/usr/bin/pdepend',
+ command => 'pear channel-discover pear.pdepend.org && \
+ pear install pdepend/PHP_Depend-beta',
+ require => [
+ Package['php-xml'],
+ Package['php-pear']
+ ]
+ }
+
+ exec { 'phpmd':
+ creates => '/usr/bin/phpmd',
+ command => 'pear channel-discover pear.phpmd.org && \
+ pear install phpmd/PHP_PMD',
+ require => Exec['pdepend'],
+ before => Notify['test'],
+ }
+
+ exec { 'phing':
+ creates => '/usr/bin/phing',
+ command => 'pear channel-discover pear.phing.info && \
+ pear install phing/phing',
+ require => Package['php-pear'],
+ before => Notify['test'],
+ }
+
+ package { 'graphviz': }
+
+ exec { 'phpdoc':
+ creates => '/usr/bin/phpdoc',
+ command => 'pear channel-discover pear.phpdoc.org && \
+ pear install phpdoc/phpDocumentor-alpha',
+ require => [
+ Package['php-pear'],
+ Package['graphviz'],
+ ],
+ before => Notify['test'],
+ }
+
+ exec { 'phpcs':
+ creates => '/usr/bin/phpcs',
+ command => 'pear install PHP_CodeSniffer',
+ require => Package['php-pear'],
+ before => Notify['test'],
+ }
+
+ # Announce test-suite
+ notify { 'test':
+ message => 'Test-suite ready - run in VM with `cd /vagrant && phing',
+ }
+}
@@ -0,0 +1,32 @@
+class joindin::web {
+ include apache
+ include php
+
+ # Configure apache virtual host
+ apache::vhost { $params::host :
+ docroot => '/vagrant/web',
+ template => 'joindin/vhost.conf.erb',
+ port => $params::port,
+ require => Package["apache"],
+ }
+
+ # Install PHP modules
+ php::module { "pecl-xdebug" :
+ require => File["EpelRepo"], # xdebug is in the epel repo
+ }
+
+ # Set development values to our php.ini
+ augeas { 'set-php-ini-values':
+ context => '/files/etc/php.ini',
+ changes => [
+ 'set PHP/error_reporting "E_ALL | E_STRICT"',
+ 'set PHP/display_errors On',
+ 'set PHP/display_startup_errors On',
+ 'set PHP/html_errors On',
+ 'set Date/date.timezone Europe/London',
+ ],
+ require => Package['php'],
+ notify => Service['apache'],
+ }
+
+}
@@ -0,0 +1,18 @@
+class joindin::web::phpmyadmin {
+
+ # Install PHPMyAdmin on /phpmyadmin
+ package { "phpMyAdmin" :
+ ensure => present,
+ require => File["EpelRepo"],
+ }
+
+ # Setup our own phpmyadmin configuration file
+ file { "/etc/httpd/conf.d/phpMyAdmin.conf" :
+ source => "puppet:///modules/joindin/phpmyadmin.conf",
+ owner => "root",
+ group => "root",
+ require => Package["phpMyAdmin"],
+ notify => Service["apache"],
+ }
+
+}
Oops, something went wrong. Retry.

0 comments on commit 56dac49

Please sign in to comment.