Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #24 from Rud5G/add-environment-to-virtualhosts
Browse files Browse the repository at this point in the history
Virtualhost databag update, with environments
  • Loading branch information
Rud5G committed Dec 14, 2014
2 parents 9fd6e32 + e49e076 commit 5651e60
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 61 deletions.
8 changes: 4 additions & 4 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down
63 changes: 52 additions & 11 deletions data_bags/virtualhosts/zf2tutorial.json
Original file line number Diff line number Diff line change
@@ -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"
}
37 changes: 0 additions & 37 deletions libraries/virtualhost.rb

This file was deleted.

4 changes: 2 additions & 2 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 3 additions & 7 deletions recipes/apache2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']
Expand Down
2 changes: 2 additions & 0 deletions recipes/projects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5651e60

Please sign in to comment.