Skip to content

Commit

Permalink
Updated vagrant setup to run more flawlessly
Browse files Browse the repository at this point in the history
  • Loading branch information
phiamo committed Apr 29, 2013
1 parent 1df71c4 commit 121cfe4
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 30 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Expand Up @@ -10,3 +10,9 @@
[submodule "vagrant/puppet/modules/augeas"]
path = vagrant/puppet/modules/augeas
url = git://github.com/camptocamp/puppet-augeas.git
[submodule "vagrant/puppet/modules/composer"]
path = vagrant/puppet/modules/composer
url = git://github.com/tPl0ch/puppet-composer.git
[submodule "vagrant/puppet/modules/git"]
path = vagrant/puppet/modules/git
url = https://github.com/puppetlabs/puppetlabs-git.git
37 changes: 25 additions & 12 deletions vagrant/puppet/app.pp
Expand Up @@ -5,6 +5,7 @@

Package { require => Exec['apt_update'], }


$webserverService = $webserver ? {
apache2 => 'httpd',
nginx => 'nginx',
Expand All @@ -25,26 +26,38 @@
"etc_root_password" => true,
}
}
Mysql::Db {
Mysql::Db {
require => Class['mysql::server', 'mysql::config'],
}

include app::database
include app::php
include app::webserver
include app::tools

class { "java": }

class { "nodejs": }


include app::webserver
include app::php
include composer

composer::exec { 'bootstrap_update':
cmd => 'update', # REQUIRED
cwd => "/srv/www/vhosts/$vhost.dev", # REQUIRED
packages => [], # leave empty or omit to update whole project
prefer_source => true, # Only one of prefer_source or prefer_dist can be true
prefer_dist => false, # Only one of prefer_source or prefer_dist can be true
dry_run => false, # Just simulate actions
no_custom_installers => false, # No custom installers
no_scripts => false, # No script execution
no_interaction => true, # No interactive questions
optimize => false, # Optimize autoloader
dev => false, # Install dev dependencies
}
include app::tools
include app::database
include app::symfony

package { 'less':
ensure => '1.3.3',
provider => 'npm',
}
class {"composer":
target_dir => '/usr/local/bin',
composer_file => 'composer',
download_method => 'curl', # download methods are curl or wget
logoutput => false
provider => 'npm'
}
10 changes: 5 additions & 5 deletions vagrant/puppet/app/database.pp
Expand Up @@ -6,18 +6,18 @@
}

exec {"db-drop":
require => Package["php5-cli"],
command => "/bin/bash -c 'cd /srv/www/vhosts/$vhost.dev && /usr/bin/php app/console doctrine:schema:drop --force'",
require => [Package["php5-cli"], Class["composer"], Database["$vhost"]],
command => "/bin/bash -c 'cd /srv/www/vhosts/$vhost.dev && /usr/bin/php app/console doctrine:schema:drop --force || exit 0'",
}

exec {"db-setup":
require => [Exec["db-drop"], Package["php5-cli"]],
require => Exec["db-drop"],
command => "/bin/bash -c 'cd /srv/www/vhosts/$vhost.dev && /usr/bin/php app/console doctrine:schema:create'",
}

exec {"db-default-data":
require => [Exec["db-setup"], Package["php5-cli"]],
require => Exec["db-setup"],
command => "/bin/bash -c 'cd /srv/www/vhosts/$vhost.dev && /usr/bin/php app/console doctrine:fixtures:load'",
onlyif => "/usr/bin/test -d /srv/www/vhosts/$vhost.dev/src/*/*/DataFixtures",
}
}
}
7 changes: 1 addition & 6 deletions vagrant/puppet/app/php.pp
@@ -1,14 +1,9 @@
class app::php {
package {["php5", "php5-cli", "php5-dev", "php-apc", "php5-mysql"]:
package {["php5", "php5-dev", "php-apc", "php5-mysql", "php5-suhosin", "php5-cli"]:
ensure => present,
notify => Service[$webserverService],
}

exec {"clear-symfony-cache":
require => Package["php5-cli"],
command => "/bin/bash -c 'cd /srv/www/vhosts/$vhost.dev && /usr/bin/php app/console cache:clear --env=dev && /usr/bin/php app/console cache:clear --env=prod'",
}

if 'nginx' == $webserver {
include app::php::fpm
}
Expand Down
6 changes: 6 additions & 0 deletions vagrant/puppet/app/symfony.pp
@@ -0,0 +1,6 @@
class app::symfony {
exec {"clear-symfony-cache":
require => Exec["db-default-data"],
command => "sudo /bin/bash -c 'cd /srv/www/vhosts/$vhost.dev && /usr/bin/php app/console cache:clear --env=dev && /usr/bin/php app/console cache:clear --env=prod'",
}
}
13 changes: 7 additions & 6 deletions vagrant/puppet/app/tools.pp
Expand Up @@ -6,12 +6,13 @@
"patch",
"git",
"vim",
"build-essential"]:
"build-essential",
"augeas-tools"]:
ensure => present,
}

exec {"find-utils-updatedb":
command => "/usr/bin/updatedb &",
require => Package["mlocate"],
}
}
#exec {"find-utils-updatedb":
# command => "/usr/bin/updatedb &",
# require => Package["mlocate"],
#}
}
2 changes: 1 addition & 1 deletion vagrant/puppet/modules/augeas
Submodule augeas updated from 3cdeb9 to 0c75e1
1 change: 1 addition & 0 deletions vagrant/puppet/modules/composer
Submodule composer added at 78643e
1 change: 1 addition & 0 deletions vagrant/puppet/modules/git
Submodule git added at 3ab03f

0 comments on commit 121cfe4

Please sign in to comment.