1
- # Symfony2 Vagrant configuration
1
+ # Vagrant environment for Symfony2
2
2
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 ) .
5
5
6
6
## What's in the box?
7
7
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.
22
26
23
27
## Installation
24
28
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:
30
30
31
31
```
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
33
34
```
34
35
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:
37
37
38
38
```
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
40
41
```
41
42
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:
44
44
45
45
```
46
+ $ cd vagrant
46
47
$ vagrant up
47
48
```
48
49
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.
52
54
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
55
56
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:
57
60
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
63
64
```
64
65
65
66
with:
66
67
68
+ ``` ruby
69
+ config.vm.share_folder " vagrant-root" , " /vagrant" , " ."
70
+ config.vm.share_folder " www" , " /var/www" , " .."
67
71
```
68
- config.vm.share_folder "v-root", "/vagrant", ".."
69
72
70
- ```
73
+ ## Troubleshooting
71
74
72
- ### Note
75
+ ### I'm not allowed to access my site?
73
76
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:
76
78
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
+ ```
78
82
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 ` :
81
84
82
85
``` php
83
86
if (isset($_SERVER['HTTP_CLIENT_IP'])
@@ -89,94 +92,124 @@ if (isset($_SERVER['HTTP_CLIENT_IP'])
89
92
}
90
93
```
91
94
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?
105
96
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:
109
101
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
+ }
114
107
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
+ ```
119
113
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).
126
118
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
129
120
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:
132
122
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
136
127
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!
140
129
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
146
131
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 ) :
151
133
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
+ ```
152
185
153
186
## License
154
187
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
+ ```
0 commit comments