diff --git a/Vagrantfile b/Vagrantfile index 60e4cc1..5eca053 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -50,15 +50,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.hostmanager.manage_host = true config.hostmanager.ignore_private_ip = false config.hostmanager.include_offline = true - config.hostmanager.aliases = %w(zf2.dev zf2tutorial.zf2.dev) + config.hostmanager.aliases = %w(zf2tutorial.zf2.dev) else puts "WARN: Vagrant-hostmanager plugin not detected. Please install the plugin with\n 'vagrant plugin install vagrant-hostmanager' from any other directory\n before continuing." end # Add additional virtualhost aliases Dir[Pathname(__FILE__).dirname.join('data_bags','virtualhosts','*.json')].each do |databagfile| - config.hostmanager.aliases << JSON.parse(Pathname(__FILE__).dirname.join('data_bags','virtualhosts',databagfile).read)['server_name'] - JSON.parse(Pathname(__FILE__).dirname.join('data_bags','virtualhosts',databagfile).read)['server_aliases'].each do |serveralias| + config.hostmanager.aliases << JSON.parse(Pathname(__FILE__).dirname.join('data_bags','virtualhosts',databagfile).read)['development']['server_name'] + JSON.parse(Pathname(__FILE__).dirname.join('data_bags','virtualhosts',databagfile).read)['development']['server_aliases'].each do |serveralias| config.hostmanager.aliases << serveralias end end @@ -68,7 +68,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # vm config - config.vm.hostname = 'zf2.dev' + config.vm.hostname = 'zf2tutorial.zf2.dev' config.vm.box = 'opscode-ubuntu-12.04' config.vm.box_url = 'https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box' diff --git a/data_bags/virtualhosts/zf2tutorial.json b/data_bags/virtualhosts/zf2tutorial.json index 0eeb7ad..90ebc60 100644 --- a/data_bags/virtualhosts/zf2tutorial.json +++ b/data_bags/virtualhosts/zf2tutorial.json @@ -1,15 +1,56 @@ { "id": "zf2tutorial", - "enable": true, - "create_docroot": false, - "server_name": "zf2tutorial.zf2.dev", - "server_aliases": [ - "zf2tutorial.dev" - ], - "docroot": "/srv/www/zf2tutorial/public", - "directory_index": [ "index.php", "index.html" ], - "directory_options": [ "Indexes", "FollowSymLinks" ], - "template": "web_app.conf.erb", - "allow_override": "all", + "development": { + "enable": true, + "create_docroot": false, + "server_name": "zf2tutorial.zf2.dev", + "server_aliases": [ + "zf2tutorial.dev" + ], + "docroot": "/srv/www/zf2tutorial/public", + "directory_index": [ "index.php", "index.html" ], + "directory_options": [ "Indexes", "FollowSymLinks" ], + "template": "web_app.conf.erb", + "allow_override": "all" + }, + "testing": { + "enable": true, + "create_docroot": false, + "server_name": "zf2tutorial.zf2.dev", + "server_aliases": [ + "zf2tutorial.dev" + ], + "docroot": "/srv/www/zf2tutorial/public", + "directory_index": [ "index.php", "index.html" ], + "directory_options": [ "Indexes", "FollowSymLinks" ], + "template": "web_app.conf.erb", + "allow_override": "all" + }, + "acceptance": { + "enable": true, + "create_docroot": false, + "server_name": "zf2tutorial.zf2.dev", + "server_aliases": [ + "zf2tutorial.dev" + ], + "docroot": "/srv/www/zf2tutorial/public", + "directory_index": [ "index.php", "index.html" ], + "directory_options": [ "Indexes", "FollowSymLinks" ], + "template": "web_app.conf.erb", + "allow_override": "all" + }, + "production": { + "enable": true, + "create_docroot": false, + "server_name": "zf2tutorial.zf2.dev", + "server_aliases": [ + "zf2tutorial.dev" + ], + "docroot": "/srv/www/zf2tutorial/public", + "directory_index": [ "index.php", "index.html" ], + "directory_options": [ "Indexes", "FollowSymLinks" ], + "template": "web_app.conf.erb", + "allow_override": "all" + }, "comment": "zf2tutorial Virtualhost" } diff --git a/libraries/virtualhost.rb b/libraries/virtualhost.rb deleted file mode 100644 index 13f6f14..0000000 --- a/libraries/virtualhost.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# Cookbook Name:: zf2 -# Library:: virtualhost -# -# Copyright (C) 2013 Triple-networks -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -class Chef::Recipe::Virtualhost - def self.settings(node) - if Chef::Config[:solo] - begin - settings = Chef::DataBagItem.load('virtualhost', 'virtualhost')['local'] - rescue - Chef::Log.info('No virtualhost data bag found') - end - else - begin - settings = Chef::EncryptedDataBagItem.load('virtualhost', 'virtualhost')[node.chef_environment] - rescue - Chef::Log.info('No virtualhost encrypted data bag found') - end - end - settings ||= node['virtualhost'] - end -end diff --git a/metadata.rb b/metadata.rb index a400199..b5191f9 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,9 +4,9 @@ license 'Apache 2.0' description 'Installs/Configures ZF2' long_description 'Installs/Configures ZF2' -version '0.4.7' +version '0.5.0' -depends 'baseserver', '~> 0.7.8' +depends 'baseserver', '~> 0.7.9' depends 'mysql', '~> 5.2.12' depends 'apache2', '~> 1.11.0' diff --git a/recipes/apache2.rb b/recipes/apache2.rb index f591a76..3a42dc6 100644 --- a/recipes/apache2.rb +++ b/recipes/apache2.rb @@ -8,15 +8,11 @@ # include_recipe 'apache2' -# include_recipe 'apache2::mod_deflate' -# include_recipe 'apache2::mod_expires' -# include_recipe 'apache2::mod_headers' -# include_recipe 'apache2::mod_php5' -# include_recipe 'apache2::mod_rewrite' + begin data_bag('virtualhosts').each do |virtualhost| - hostdata = data_bag_item('virtualhosts', virtualhost) + hostdata = data_bag_item('virtualhosts', virtualhost)[node.chef_environment] if hostdata['create_docroot'] directory hostdata['docroot'] do @@ -35,7 +31,7 @@ #webappname = '000-'+hostdata['id'] - web_app hostdata['id'] do + web_app hostdata['server_name'] do enable hostdata['enable'] server_name hostdata['server_name'] server_aliases hostdata['server_aliases'] diff --git a/recipes/projects.rb b/recipes/projects.rb index 959717e..98d8c81 100644 --- a/recipes/projects.rb +++ b/recipes/projects.rb @@ -82,6 +82,7 @@ # install composer.phar bash 'composer_installer' do + environment 'COMPOSER_HOME' => parentprojectdir.to_path user projectdata['owner'] cwd projectdata['projectdir'] code <<-EOH @@ -92,6 +93,7 @@ # composer install (uses: .lock file) bash 'install_composer' do + environment 'COMPOSER_HOME' => parentprojectdir.to_path user projectdata['owner'] cwd projectdata['projectdir'] code <<-EOH