@@ -8,9 +8,9 @@ How to Deploy a Symfony Application
8
8
9
9
.. note ::
10
10
11
- Deploying can be a complex and varied task depending on your setup and needs.
12
- This entry doesn't try to explain everything, but rather offers the most
13
- common requirements and ideas for deployment.
11
+ Deploying can be a complex and varied task depending on the setup and
12
+ requirements of your application. This article is not a step-by-step guide,
13
+ but a general list of the most common requirements and ideas for deployment.
14
14
15
15
.. _symfony2-deployment-basics :
16
16
@@ -19,26 +19,27 @@ Symfony Deployment Basics
19
19
20
20
The typical steps taken while deploying a Symfony application include:
21
21
22
- #. Upload your modified code to the live server;
23
- #. Update your vendor dependencies (typically done via Composer, and may
22
+ #. Upload your code to the production server;
23
+ #. Install/update your vendor dependencies (typically done via Composer, and may
24
24
be done before uploading);
25
25
#. Running database migrations or similar tasks to update any changed data structures;
26
- #. Clearing (and perhaps more importantly , warming up) your cache.
26
+ #. Clearing (and optionally , warming up) your cache.
27
27
28
- A deployment may also include other things , such as:
28
+ A deployment may also include other tasks , such as:
29
29
30
- * Tagging a particular version of your code as a release in your source control repository;
30
+ * Tagging a particular version of your code as a release in your source control
31
+ repository;
31
32
* Creating a temporary staging area to build your updated setup "offline";
32
33
* Running any tests available to ensure code and/or server stability;
33
- * Removal of any unnecessary files from ``web `` to keep your production environment clean;
34
+ * Removal of any unnecessary files from ``web/ `` directory to keep your production
35
+ environment clean;
34
36
* Clearing of external cache systems (like `Memcached `_ or `Redis `_).
35
37
36
38
How to Deploy a Symfony Application
37
39
-----------------------------------
38
40
39
- There are several ways you can deploy a Symfony application.
40
-
41
- Start with a few basic deployment strategies and build up from there.
41
+ There are several ways you can deploy a Symfony application. Start with a few
42
+ basic deployment strategies and build up from there.
42
43
43
44
Basic File Transfer
44
45
~~~~~~~~~~~~~~~~~~~
@@ -62,12 +63,35 @@ manually taking other steps (see `Common Post-Deployment Tasks`_).
62
63
Using Build Scripts and other Tools
63
64
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64
65
65
- There are also high-quality tools to help ease the pain of deployment. There
66
- are even a few tools which have been specifically tailored to the requirements of
67
- Symfony, and which take special care to ensure that everything before, during,
68
- and after a deployment has gone correctly.
66
+ There are also tools to help ease the pain of deployment. Some of them have been
67
+ specifically tailored to the requirements of Symfony.
68
+
69
+ `Capifony `_
70
+ Provides a specialized set of tools on top of `Capistrano `_, tailored
71
+ specifically to Symfony projects.
72
+
73
+ `sf2debpkg `_
74
+ Helps you build a native Debian package for your Symfony project.
75
+
76
+ `Magallanes `_
77
+ This Capistrano-like deployment tool is built in PHP, and may be easier
78
+ for PHP developers to extend for their needs.
69
79
70
- See `The Tools `_ for a list of tools that can help with deployment.
80
+ Bundles
81
+ There are some `bundles that add deployment features `_ directly into your
82
+ Symfony console.
83
+
84
+ Basic scripting
85
+ You can of course use shell, `Ant `_, or any other build tool to script
86
+ the deploying of your project.
87
+
88
+ Platform as a Service Providers
89
+ The Symfony Cookbook includes detailed articles for some of the most well-known
90
+ Platform as a Service (PaaS) providers:
91
+
92
+ * :doc: `</cookbook/deployment/azure-website >`
93
+ * :doc: `</cookbook/deployment/heroku >`
94
+ * :doc: `</cookbook/deployment/platformsh >`
71
95
72
96
Common Post-Deployment Tasks
73
97
----------------------------
@@ -87,12 +111,11 @@ Check if your server meets the requirements by running:
87
111
B) Configure your ``app/config/parameters.yml `` File
88
112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89
113
90
- This file should be customized on each system. The method you use to
91
- deploy your source code should *not * deploy this file. Instead, you should
92
- set it up manually (or via some build process) on your server(s).
114
+ This file should *not * be deployed, but managed through the automatic utilities
115
+ provided by Symfony.
93
116
94
- C) Update your Vendors
95
- ~~~~~~~~~~~~~~~~~~~~~~
117
+ C) Install/ Update your Vendors
118
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
96
119
97
120
Your vendors can be updated before transferring your source code (i.e.
98
121
update the ``vendor/ `` directory, then transfer that with your source
@@ -105,10 +128,9 @@ as you normally do:
105
128
106
129
.. tip ::
107
130
108
- The ``--optimize-autoloader `` flag makes Composer's autoloader more
109
- performant by building a "class map". The ``--no-dev `` flag
110
- ensures that development packages are not installed in the production
111
- environment.
131
+ The ``--optimize-autoloader `` flag improves Composer's autoloader performance
132
+ significantly by building a "class map". The ``--no-dev `` flag ensures that
133
+ development packages are not installed in the production environment.
112
134
113
135
.. caution ::
114
136
@@ -152,7 +174,7 @@ Application Lifecycle: Continuous Integration, QA, etc
152
174
153
175
While this entry covers the technical details of deploying, the full lifecycle
154
176
of taking code from development up to production may have a lot more steps
155
- (think deploying to staging, QA, running tests, etc).
177
+ (think deploying to staging, QA (Quality Assurance) , running tests, etc).
156
178
157
179
The use of staging, testing, QA, continuous integration, database migrations
158
180
and the capability to roll back in case of failure are all strongly advised. There
@@ -163,51 +185,17 @@ Don't forget that deploying your application also involves updating any dependen
163
185
(typically via Composer), migrating your database, clearing your cache and
164
186
other potential things like pushing assets to a CDN (see `Common Post-Deployment Tasks `_).
165
187
166
- The Tools
167
- ---------
168
-
169
- `Capifony `_:
170
-
171
- This tool provides a specialized set of tools on top of Capistrano, tailored
172
- specifically to symfony and Symfony projects.
173
-
174
- `sf2debpkg `_:
175
-
176
- This tool helps you build a native Debian package for your Symfony project.
177
-
178
- `Magallanes `_:
179
-
180
- This Capistrano-like deployment tool is built in PHP, and may be easier
181
- for PHP developers to extend for their needs.
182
-
183
- Bundles:
184
-
185
- There are many `bundles that add deployment features `_ directly into your
186
- Symfony console.
187
-
188
- Basic scripting:
189
-
190
- You can of course use shell, `Ant `_, or any other build tool to script
191
- the deploying of your project.
192
-
193
- Platform as a Service Providers:
194
-
195
- PaaS is a relatively new way to deploy your application. Typically a PaaS
196
- will use a single configuration file in your project's root directory to
197
- determine how to build an environment on the fly that supports your software.
198
- One provider with confirmed Symfony support is `PagodaBox `_.
199
-
200
188
.. tip ::
201
189
202
- Looking for more? Talk to the community on the `Symfony IRC channel `_ #symfony
203
- (on freenode) for more information.
190
+ Looking for more? Talk to the community on the `Symfony IRC channel `_ for
191
+ more information.
204
192
205
193
.. _`Capifony` : http://capifony.org/
194
+ .. _`Capistrano` : http://capistranorb.com/
206
195
.. _`sf2debpkg` : https://github.com/liip/sf2debpkg
207
196
.. _`Ant` : http://blog.sznapka.pl/deploying-symfony2-applications-with-ant
208
- .. _`PagodaBox` : https://github.com/jmather/pagoda-symfony-sonata-distribution/blob/master/Boxfile
209
197
.. _`Magallanes` : https://github.com/andres-montanez/Magallanes
210
198
.. _`bundles that add deployment features` : http://knpbundles.com/search?q=deploy
211
- .. _`Symfony IRC channel` : http://webchat.freenode.net/?channels=symfony
199
+ .. _`Symfony IRC channel` : http://symfony.com/irc
212
200
.. _`Memcached` : http://memcached.org/
213
201
.. _`Redis` : http://redis.io/
0 commit comments