forked from MiniCodeMonkey/Vagrant-LAMP-Stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
84 lines (68 loc) · 2.71 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# -*- mode: ruby -*-
# vi: set ft=ruby :
# General project settings
#################################
# IP Address for the host only network, change it to anything you like
# but please keep it within the IPv4 private network range
ip_address = "172.22.22.22"
# The project name is base for directories, hostname and alike
project_name = "projectname"
# MySQL and PostgreSQL password - feel free to change it to something
# more secure (Note: Changing this will require you to update the index.php example file)
database_password = "root"
# Vagrant configuration
#################################
Vagrant.configure("2") do |config|
# Enable Berkshelf support
config.berkshelf.enabled = true
# Use the omnibus installer for the latest Chef installation
config.omnibus.chef_version = :latest
# Define VM box to use
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
# Set share folder
config.vm.synced_folder "./" , "/var/www/" + project_name + "/", :mount_options => ["dmode=777", "fmode=666"]
# Use hostonly network with a static IP Address and enable
# hostmanager so we can have a custom domain for the server
# by modifying the host machines hosts file
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.vm.define project_name do |node|
node.vm.hostname = project_name + ".local"
node.vm.network :private_network, ip: ip_address
node.hostmanager.aliases = [ "www." + project_name + ".local" ]
end
config.vm.provision :hostmanager
# Enable and configure chef solo
config.vm.provision :chef_solo do |chef|
chef.add_recipe "app::packages"
chef.add_recipe "app::web_server"
chef.add_recipe "app::vhost"
chef.add_recipe "memcached"
chef.add_recipe "app::db"
chef.json = {
:app => {
# Project name
:name => project_name,
# Name of MySQL database that should be created
:db_name => "dbname",
# Server name and alias(es) for Apache vhost
:server_name => project_name + ".local",
:server_aliases => [ "www." + project_name + ".local" ],
# Document root for Apache vhost
:docroot => "/var/www/" + project_name + "/public",
# General packages
:packages => %w{ vim git screen curl },
# PHP packages
:php_packages => %w{ php5-mysqlnd php5-curl php5-mcrypt php5-memcached php5-gd }
},
:mysql => {
:server_root_password => database_password,
:server_repl_password => database_password,
:server_debian_password => database_password,
:bind_address => ip_address,
:allow_remote_root => true
}
}
end
end