Skip to content

Commit 95e06b4

Browse files
AlexAlex
Alex
authored and
Alex
committed
init
0 parents  commit 95e06b4

File tree

9 files changed

+166
-0
lines changed

9 files changed

+166
-0
lines changed

README.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Create chef-solo PHP 5.4 environment
2+
3+
## Description
4+
5+
Chef solo config files to install a php environment that can be used with vagrant and deployed to amazon EC2 with Chef solo.
6+
7+
## Includes
8+
9+
* Ubuntu Precise 64
10+
* php 5.4
11+
* apache
12+
* mysql
13+
* sqlite
14+
* git
15+
* ntp
16+
* vim
17+
* zsh
18+
19+
## Installation
20+
21+
### install vagrant and ubuntu base box
22+
23+
``` $ gem install vagrant```
24+
25+
### install [cookbooks](https://github.com/opscode-cookbooks/)
26+
27+
```knife cookbook site install -o recipes/cookbooks apache2```
28+
```knife cookbook site install -o recipes/cookbooks mysql```
29+
```knife cookbook site install -o recipes/cookbooks sqlite```
30+
```knife cookbook site install -o recipes/cookbooks php```
31+
```knife cookbook site install -o recipes/cookbooks vim```
32+
```knife cookbook site install -o recipes/cookbooks zsh```
33+
```knife cookbook site install -o recipes/cookbooks cron```
34+
```knife cookbook site install -o recipes/cookbooks ntp```
35+
```knife cookbook site install -o recipes/cookbooks apt```
36+
37+
[Dotdeb repositories](https://github.com/homemade/chef-dotdeb) (for php 5.4)
38+
39+
```git clone [email protected]:homemade/chef-dotdeb.git recipes/cookbooks/git clone [email protected]:homemade/chef-dotdeb.git```
40+
41+
## Run vagrant
42+
43+
``` $ vagrant up```
44+
45+
When vagrant is done, you should see the apache default ```index.html``` file in the ```www``` folder. Open ```http://localhost:8080/``` in the browser to test it.
46+
47+
## Run on an EC2 instance
48+
49+
### Requirements
50+
51+
you will need the key .pem file and the public DNS of your instance.
52+
53+
install [kinfe-solo](https://github.com/matschaffer/knife-solo)
54+
55+
```$ gem install knife-solo```
56+
57+
Create a config file (ignore the warnings)
58+
59+
```$ knife configure -r . --defaults```
60+
61+
Install ruby and vagrant on your instance
62+
63+
``` $ knife prepare -i ~/path/to/file.pem [email protected]```
64+
65+
It will also generate a json file in the ```/nodes``` folder. replace its contents with
66+
67+
```...```
68+
69+
Run chef solo on your instance
70+
71+
``` $ knife cook -i ~/path/to/file.pem [email protected]```
72+

Vagrantfile

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant::Config.run do |config|
5+
# All Vagrant configuration is done here. The most common configuration
6+
# options are documented and commented below. For a complete reference,
7+
# please see the online documentation at vagrantup.com.
8+
9+
# Every Vagrant virtual environment requires a box to build off of.
10+
config.vm.box = "precise64"
11+
12+
# The url from where the 'config.vm.box' box will be fetched if it
13+
# doesn't already exist on the user's system.
14+
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
15+
16+
# Boot with a GUI so you can see the screen. (Default is headless)
17+
# config.vm.boot_mode = :gui
18+
19+
# Assign this VM to a host-only network IP, allowing you to access it
20+
# via the IP. Host-only networks can talk to the host machine as well as
21+
# any other machines on the same network, but cannot be accessed (through this
22+
# network interface) by any external networks.
23+
# config.vm.network :hostonly, "192.168.33.10"
24+
25+
# Assign this VM to a bridged network, allowing you to connect directly to a
26+
# network using the host's network device. This makes the VM appear as another
27+
# physical device on your network.
28+
# config.vm.network :bridged
29+
30+
# Forward a port from the guest to the host, which allows for outside
31+
# computers to access the VM, whereas host only networking does not.
32+
config.vm.forward_port 80, 8080
33+
34+
# Share an additional folder to the guest VM. The first argument is
35+
# an identifier, the second is the path on the guest to mount the
36+
# folder, and the third is the path on the host to the actual folder.
37+
config.vm.share_folder "www", "/var/www", "www"
38+
39+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
40+
# path, and data_bags path (all relative to this Vagrantfile), and adding
41+
# some recipes and/or roles.
42+
#
43+
config.vm.provision :chef_solo do |chef|
44+
chef.cookbooks_path = "recipes/cookbooks"
45+
# chef.roles_path = "../my-recipes/roles"
46+
# chef.add_role "web"
47+
# chef.data_bags_path = "../my-recipes/data_bags"
48+
chef.add_recipe("apt")
49+
chef.add_recipe("chef-dotdeb")
50+
chef.add_recipe("chef-dotdeb::php54")
51+
chef.add_recipe("apache2")
52+
chef.add_recipe("apache2::mod_php5")
53+
chef.add_recipe("apache2::mod_rewrite")
54+
chef.add_recipe("mysql")
55+
chef.add_recipe("sqlite")
56+
chef.add_recipe("php")
57+
chef.add_recipe("vim")
58+
chef.add_recipe("zsh")
59+
chef.add_recipe("cron")
60+
chef.add_recipe("ntp")
61+
chef.add_recipe("apt")
62+
# # You may also specify custom JSON attributes:
63+
# chef.json = { :mysql_password => "foo" }
64+
end
65+
66+
# Enable provisioning with chef server, specifying the chef server URL,
67+
# and the path to the validation key (relative to this Vagrantfile).
68+
#
69+
# The Opscode Platform uses HTTPS. Substitute your organization for
70+
# ORGNAME in the URL and validation key.
71+
#
72+
# If you have your own Chef Server, use the appropriate URL, which may be
73+
# HTTP instead of HTTPS depending on your configuration. Also change the
74+
# validation key to validation.pem.
75+
#
76+
# config.vm.provision :chef_client do |chef|
77+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
78+
# chef.validation_key_path = "ORGNAME-validator.pem"
79+
# end
80+
#
81+
# If you're using the Opscode platform, your validator client is
82+
# ORGNAME-validator, replacing ORGNAME with your organization name.
83+
#
84+
# IF you have your own Chef Server, the default validation client name is
85+
# chef-validator, unless you changed the configuration.
86+
#
87+
# chef.validation_client_name = "ORGNAME-validator"
88+
end

recipes/cookbooks/.gitkeep

Whitespace-only changes.

recipes/data_bags/.gitkeep

Whitespace-only changes.

recipes/nodes/.gitkeep

Whitespace-only changes.

recipes/roles/.gitkeep

Whitespace-only changes.

recipes/site-cookbooks/.gitkeep

Whitespace-only changes.

recipes/solo.rb

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
file_cache_path "/tmp/chef-solo"
2+
data_bag_path "/tmp/chef-solo/data_bags"
3+
encrypted_data_bag_secret "/tmp/chef-solo/data_bag_key"
4+
cookbook_path [ "/tmp/chef-solo/site-cookbooks",
5+
"/tmp/chef-solo/cookbooks" ]
6+
role_path "/tmp/chef-solo/roles"

www/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)