Skip to content

Commit 8342f2b

Browse files
author
Ramon Kleiss
committed
Merge branch 'version-2'
2 parents 369c20c + 6376dd9 commit 8342f2b

File tree

13 files changed

+235
-214
lines changed

13 files changed

+235
-214
lines changed

Diff for: .gitmodules

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[submodule "puppet/modules/php"]
2+
path = puppet/modules/php
3+
url = git@github.com:saz/puppet-php.git
4+
[submodule "puppet/modules/stdlib"]
5+
path = puppet/modules/stdlib
6+
url = git@github.com:puppetlabs/puppetlabs-stdlib.git
7+
[submodule "puppet/modules/mysql"]
8+
path = puppet/modules/mysql
9+
url = git@github.com:puppetlabs/puppetlabs-mysql
10+
[submodule "puppet/modules/sqlite"]
11+
path = puppet/modules/sqlite
12+
url = git@github.com:puppetlabs/puppetlabs-sqlite
13+
[submodule "puppet/modules/git"]
14+
path = puppet/modules/git
15+
url = git@github.com:puppetlabs/puppetlabs-git.git
16+
[submodule "puppet/modules/curl"]
17+
path = puppet/modules/curl
18+
url = git@github.com:alphagov/puppet-curl.git

Diff for: README.md

+157-124
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,86 @@
1-
# Symfony2 Vagrant configuration
1+
# Vagrant environment for Symfony2
22

3-
Provides a basic installation to get up and running with a Symfony2
4-
application quickly.
3+
This project provides a virtual environment for Symfony2 development using
4+
[Vagrant](https://vagrantup.com).
55

66
## What's in the box?
77

8-
Firing up this VM will install the following packages:
9-
10-
* cURL
11-
* MySQL (username: `root` and no password)
12-
* nginx
13-
* PHP-CLI
14-
* PHP-FPM
15-
* APC
16-
* PEAR
17-
* XDebug
18-
19-
Additionaly, it will create a MySQL database called `symfony` if it doesn't
20-
exist so a clean Symfony2 installation should run right away (after you
21-
installed the dependencies, of course).
8+
When you start Vagrant, this environment will provide the following tools
9+
that can be useful when developing for Symfony2:
10+
11+
- Git
12+
- cURL
13+
- MySQL
14+
* Username: `root`
15+
* Password: empty
16+
- SQLite
17+
- nginx
18+
- PHP
19+
- PHP-FPM
20+
- APC
21+
- PEAR
22+
- XDebug
23+
24+
Additionally, it will create a MySQL database called `symfony` that a Symfony2
25+
application can connect to without any configuration.
2226

2327
## Installation
2428

25-
To use this configuration, you have to have [Vagrant](http://vagrantup.com)
26-
installed!
27-
28-
Using this configuration is rather easy, just clone it inside the root of your
29-
Symfony2 project:
29+
Installation is as easy as cloning a GitHub project:
3030

3131
```
32-
$ git clone git@github.com:kleiram/vagrant-symfony.git vagrant
32+
$ cd your-symfony-project
33+
$ git clone --recursive git@github.com:kleiram/vagrant-symfony.git vagrant
3334
```
3435

35-
Or if you're using Git for your project (which you should!) you can add it as a
36-
submodule (everyone cloning the project will get it in that case):
36+
Or, if you're using Git already in your project, you can use it as a submodule:
3737

3838
```
39-
$ git submodule add git@github.com:kleiram/vagrant-symfony.git vagrant
39+
$ cd your-symfony-project
40+
$ git submodule add --recursive git@github.com:kleiram/vagrant-symfony.git vagrant
4041
```
4142

42-
After the repository is cloned, go into the folder in which you cloned the
43-
repository and run:
43+
After the project is added, you can start the environment like this:
4444

4545
```
46+
$ cd vagrant
4647
$ vagrant up
4748
```
4849

49-
It might take a while depending on your internet connection (it will download
50-
a lot of stuff!) and it will ask for your password (because Vagrant is using NFS
51-
to speed things up with caching).
50+
Starting the VM might take some time, since it will download the entire box
51+
and additional applications/library. When the VM is done setting up, point
52+
your browser towards [http://33.33.33.10](http://33.33.33.10) and there you
53+
have it: Symfony2.
5254

53-
After it is done setting up point your browser to[http://33.33.33.10](http://33.33.33.10)
54-
and bask in the glory of Symfony!
55+
#### Note
5556

56-
### Note
57+
If you're using Windows, you have to modify the `Vagrantfile` a little bit to
58+
make it all work (since Windows doesn't support NFS). Replace the following
59+
lines in the Vagrantfile:
5760

58-
If you're using Windows, you'll have to replace the following line in
59-
the `Vagrantfile` because Windows doesn't support NFS:
60-
61-
```
62-
config.vm.share_folder "v-root", "/vagrant", "..", :nfs => true
61+
```ruby
62+
config.vm.share_folder "vagrant-root", "/vagrant", ".", :nfs => true
63+
config.vm.share_folder "www", "/var/www", "..", :nfs => true
6364
```
6465

6566
with:
6667

68+
```ruby
69+
config.vm.share_folder "vagrant-root", "/vagrant", "."
70+
config.vm.share_folder "www", "/var/www", ".."
6771
```
68-
config.vm.share_folder "v-root", "/vagrant", ".."
6972

70-
```
73+
## Troubleshooting
7174

72-
### Note
75+
### I'm not allowed to access my site?
7376

74-
If you visit your site for the first time on `33.33.33.10` and you get the
75-
following message it is an easy fix:
77+
If you visit your site and you get the following error message:
7678

77-
You are not allowed to access this file. Check app_dev.php for more information.
79+
```
80+
You are not allowed to access this file. Check app_dev.php for more information.
81+
```
7882

79-
You'll have to edit the `web/app_dev.php` file and remove the following piece
80-
of code:
83+
You have to remove the following files from `web/app_dev.php`:
8184

8285
```php
8386
if (isset($_SERVER['HTTP_CLIENT_IP'])
@@ -89,94 +92,124 @@ if (isset($_SERVER['HTTP_CLIENT_IP'])
8992
}
9093
```
9194

92-
## Updating
93-
94-
You can always run a `git pull` in the `vagrant` folder in your project root to
95-
update the configuration.
96-
97-
## Versioning
98-
99-
This project is versioned using [Semantic Versioning](http://semver.org/spec/v1.0.0.html)
100-
which means:
101-
102-
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
103-
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to
104-
be interpreted as described in RFC 2119.
95+
### Why is my site so slow?
10596

106-
Software using Semantic Versioning MUST declare a public API. This API could
107-
be declared in the code itself or exist strictly in documentation. However
108-
it is done, it should be precise and comprehensive.
97+
If your site is noticeably slow (and I'm talking hundreds of milliseconds), it's
98+
because the caching and logging is taking it's time (NFS synchronization). One
99+
way to fix this is by changing the cache folder in the `app/AppKernel.php` file.
100+
At the end of the AppKernel class, add the following methods:
109101

110-
A normal version number MUST take the form X.Y.Z where X, Y, and Z are
111-
integers. X is the major version, Y is the minor version, and Z is the patch
112-
version. Each element MUST increase numerically by increments of one. For
113-
instance: 1.9.0 -> 1.10.0 -> 1.11.0.
102+
```php
103+
public function getCacheDir()
104+
{
105+
return '/tmp/symfony/cache/'. $this->environment;
106+
}
114107

115-
When a major version number is incremented, the minor version and patch
116-
version MUST be reset to zero. When a minor version number is incremented,
117-
the patch version MUST be reset to zero. For instance: 1.1.3 -> 2.0.0 and
118-
2.1.7 -> 2.2.0.
108+
public function getLogDir()
109+
{
110+
return '/tmp/symfony/log/'. $this->environment;
111+
}
112+
```
119113

120-
A pre-release version number MAY be denoted by appending an arbitrary string
121-
immediately following the patch version and a dash. The string MUST be
122-
comprised of only alphanumerics plus dash [0-9A-Za-z-]. Pre-release versions
123-
satisfy but have a lower precedence than the associated normal version.
124-
Precedence SHOULD be determined by lexicographic ASCII sort order. For
125-
instance: 1.0.0-alpha1 < 1.0.0-beta1 < 1.0.0-beta2 < 1.0.0-rc1 < 1.0.0.
114+
This will change the location of the `cache` and `log` directories you normally
115+
find in the `app` directory of Symfony to the `/tmp/symfony` directory. This
116+
will speed up your site _a lot_. The downside is that you won't be able to check
117+
the log from your host computer (the computer that's running Vagrant).
126118

127-
Once a versioned package has been released, the contents of that version
128-
MUST NOT be modified. Any modifications must be released as a new version.
119+
## To-do
129120

130-
Major version zero (0.y.z) is for initial development. Anything may change
131-
at any time. The public API should not be considered stable.
121+
The following things are additions I want to add to the project:
132122

133-
Version 1.0.0 defines the public API. The way in which the version number
134-
is incremented after this release is dependent on this public API and how
135-
it changes.
123+
- Gearman
124+
- Memcached
125+
- Node.js (with the Bower package)
126+
- ZeroMQ
136127

137-
Patch version Z (x.y.Z | x > 0) MUST be incremented if only backwards
138-
compatible bug fixes are introduced. A bug fix is defined as an internal
139-
change that fixes incorrect behavior.
128+
Feel free to add these components and create a pull request!
140129

141-
Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backwards
142-
compatible functionality is introduced to the public API. It MAY be
143-
incremented if substantial new functionality or improvements are introduced
144-
within the private code. It MAY include patch level changes. Patch version
145-
MUST be reset to 0 when minor version is incremented.
130+
## Versioning
146131

147-
Major version X (X.y.z | X > 0) MUST be incremented if any backwards
148-
incompatible changes are introduced to the public API. It MAY include minor
149-
and patch level changes. Patch and minor version MUST be reset to 0 when
150-
major version is incremented.
132+
This project is versioned using [Semantic Versioning](http://semver.org/spec/v1.0.0.html):
151133

134+
```
135+
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
136+
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to
137+
be interpreted as described in RFC 2119.
138+
139+
Software using Semantic Versioning MUST declare a public API. This API could
140+
be declared in the code itself or exist strictly in documentation. However
141+
it is done, it should be precise and comprehensive.
142+
143+
A normal version number MUST take the form X.Y.Z where X, Y, and Z are
144+
integers. X is the major version, Y is the minor version, and Z is the patch
145+
version. Each element MUST increase numerically by increments of one. For
146+
instance: 1.9.0 -> 1.10.0 -> 1.11.0.
147+
148+
When a major version number is incremented, the minor version and patch
149+
version MUST be reset to zero. When a minor version number is incremented,
150+
the patch version MUST be reset to zero. For instance: 1.1.3 -> 2.0.0 and
151+
2.1.7 -> 2.2.0.
152+
153+
A pre-release version number MAY be denoted by appending an arbitrary string
154+
immediately following the patch version and a dash. The string MUST be
155+
comprised of only alphanumerics plus dash [0-9A-Za-z-]. Pre-release versions
156+
satisfy but have a lower precedence than the associated normal version.
157+
Precedence SHOULD be determined by lexicographic ASCII sort order. For
158+
instance: 1.0.0-alpha1 < 1.0.0-beta1 < 1.0.0-beta2 < 1.0.0-rc1 < 1.0.0.
159+
160+
Once a versioned package has been released, the contents of that version
161+
MUST NOT be modified. Any modifications must be released as a new version.
162+
163+
Major version zero (0.y.z) is for initial development. Anything may change
164+
at any time. The public API should not be considered stable.
165+
166+
Version 1.0.0 defines the public API. The way in which the version number
167+
is incremented after this release is dependent on this public API and how
168+
it changes.
169+
170+
Patch version Z (x.y.Z | x > 0) MUST be incremented if only backwards
171+
compatible bug fixes are introduced. A bug fix is defined as an internal
172+
change that fixes incorrect behavior.
173+
174+
Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backwards
175+
compatible functionality is introduced to the public API. It MAY be
176+
incremented if substantial new functionality or improvements are introduced
177+
within the private code. It MAY include patch level changes. Patch version
178+
MUST be reset to 0 when minor version is incremented.
179+
180+
Major version X (X.y.z | X > 0) MUST be incremented if any backwards
181+
incompatible changes are introduced to the public API. It MAY include minor
182+
and patch level changes. Patch and minor version MUST be reset to 0 when
183+
major version is incremented.
184+
```
152185

153186
## License
154187

155-
This configuration is released under the BSD 2-clause license:
156-
157-
Copyright (c) 2013, Ramon Kleiss <ramon@cubilon.nl>
158-
All rights reserved.
159-
160-
Redistribution and use in source and binary forms, with or without
161-
modification, are permitted provided that the following conditions are met:
162-
163-
1. Redistributions of source code must retain the above copyright notice, this
164-
list of conditions and the following disclaimer.
165-
2. Redistributions in binary form must reproduce the above copyright notice,
166-
this list of conditions and the following disclaimer in the documentation
167-
and/or other materials provided with the distribution.
168-
169-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
170-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
171-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
172-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
173-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
174-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
175-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
176-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
177-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
178-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
179-
180-
The views and conclusions contained in the software and documentation are those
181-
of the authors and should not be interpreted as representing official policies,
182-
either expressed or implied, of the FreeBSD Project.
188+
```
189+
Copyright (c) 2013, Ramon Kleiss <ramon@cubilon.nl>
190+
All rights reserved.
191+
192+
Redistribution and use in source and binary forms, with or without
193+
modification, are permitted provided that the following conditions are met:
194+
195+
1. Redistributions of source code must retain the above copyright notice, this
196+
list of conditions and the following disclaimer.
197+
2. Redistributions in binary form must reproduce the above copyright notice,
198+
this list of conditions and the following disclaimer in the documentation
199+
and/or other materials provided with the distribution.
200+
201+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
202+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
203+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
204+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
205+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
206+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
207+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
208+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
209+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
210+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
211+
212+
The views and conclusions contained in the software and documentation are those
213+
of the authors and should not be interpreted as representing official policies,
214+
either expressed or implied, of the FreeBSD Project.
215+
```

Diff for: TODO

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Required additions/modifications for this project to be "complete":
2+
3+
* Install and configure Gearman with PHP configuration
4+
* Install and configure Memcached with PHP configuration
5+
* Install and configure Node.js
6+
- Install Bower
7+
* Install and configure ZeroMQ

Diff for: Vagrantfile

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
Vagrant::Config.run do |config|
2-
config.vm.box = 'precise32'
3-
config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
2+
# Configure the VM box to use
3+
config.vm.box = 'ubuntu-server'
4+
config.vm.box_url = 'http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210.box'
45

6+
# Configure network and port forwarding
57
config.vm.network :hostonly, "33.33.33.10"
6-
config.vm.forward_port 80, 8080
7-
config.vm.forward_port 3306, 3306
8-
config.vm.forward_port 27017, 27017
9-
config.vm.share_folder "vagrant-root", "/vagrant", "..", :nfs => true
8+
config.vm.forward_port 80, 8080 # HTTP
9+
config.vm.forward_port 3306, 3306 # MySQL
10+
config.vm.forward_port 27017, 27017 # MongoDB
1011

12+
# Configure shared folders
13+
config.vm.share_folder "vagrant-root", "/vagrant", ".", :nfs => true
14+
config.vm.share_folder "www", "/var/www", "..", :nfs => true
15+
16+
# Configure provisioning
1117
config.vm.provision :puppet do |puppet|
1218
puppet.manifests_path = "puppet/manifests"
19+
puppet.module_path = "puppet/modules"
1320
end
1421
end

0 commit comments

Comments
 (0)