@@ -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 the
12
+ requirements of your application. This article is not a step-by-step guide,
13
+ but is 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
24
- be done before uploading);
22
+ #. Upload your code to the production server;
23
+ #. Install your vendor dependencies (typically done via Composer and may be done
24
+ 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 the ``web/ `` directory to keep your
35
+ production 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,39 @@ 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
+ This Ruby-based tool provides a specialized set of tools on top of
71
+ `Capistrano `_, tailored specifically to Symfony projects.
72
+
73
+ `sf2debpkg `_
74
+ Helps you build a native Debian package for your Symfony project.
69
75
70
- See `The Tools `_ for a list of tools that can help with deployment.
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.
79
+
80
+ `Fabric `_
81
+ This Python-based library provides a basic suite of operations for executing
82
+ local or remote shell commands and uploading/downloading files.
83
+
84
+ Bundles
85
+ There are some `bundles that add deployment features `_ directly into your
86
+ Symfony console.
87
+
88
+ Basic scripting
89
+ You can of course use shell, `Ant `_ or any other build tool to script
90
+ the deploying of your project.
91
+
92
+ Platform as a Service Providers
93
+ The Symfony Cookbook includes detailed articles for some of the most well-known
94
+ Platform as a Service (PaaS) providers:
95
+
96
+ * :doc: `Microsoft Azure </cookbook/deployment/azure-website >`
97
+ * :doc: `Heroku </cookbook/deployment/heroku >`
98
+ * :doc: `Platform.sh </cookbook/deployment/platformsh >`
71
99
72
100
Common Post-Deployment Tasks
73
101
----------------------------
@@ -87,12 +115,11 @@ Check if your server meets the requirements by running:
87
115
B) Configure your ``app/config/parameters.yml `` File
88
116
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89
117
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).
118
+ This file should *not * be deployed, but managed through the automatic utilities
119
+ provided by Symfony.
93
120
94
- C) Update your Vendors
95
- ~~~~~~~~~~~~~~~~~~~~~~
121
+ C) Install/ Update your Vendors
122
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
96
123
97
124
Your vendors can be updated before transferring your source code (i.e.
98
125
update the ``vendor/ `` directory, then transfer that with your source
@@ -105,10 +132,9 @@ as you normally do:
105
132
106
133
.. tip ::
107
134
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.
135
+ The ``--optimize-autoloader `` flag improves Composer's autoloader performance
136
+ significantly by building a "class map". The ``--no-dev `` flag ensures that
137
+ development packages are not installed in the production environment.
112
138
113
139
.. caution ::
114
140
@@ -152,7 +178,7 @@ Application Lifecycle: Continuous Integration, QA, etc
152
178
153
179
While this entry covers the technical details of deploying, the full lifecycle
154
180
of taking code from development up to production may have a lot more steps
155
- (think deploying to staging, QA, running tests, etc).
181
+ (think deploying to staging, QA (Quality Assurance) , running tests, etc).
156
182
157
183
The use of staging, testing, QA, continuous integration, database migrations
158
184
and the capability to roll back in case of failure are all strongly advised. There
@@ -163,51 +189,12 @@ Don't forget that deploying your application also involves updating any dependen
163
189
(typically via Composer), migrating your database, clearing your cache and
164
190
other potential things like pushing assets to a CDN (see `Common Post-Deployment Tasks `_).
165
191
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
- .. tip ::
201
-
202
- Looking for more? Talk to the community on the `Symfony IRC channel `_ #symfony
203
- (on freenode) for more information.
204
-
205
192
.. _`Capifony` : http://capifony.org/
193
+ .. _`Capistrano` : http://capistranorb.com/
206
194
.. _`sf2debpkg` : https://github.com/liip/sf2debpkg
207
- .. _`Ant` : http://blog.sznapka.pl/deploying-symfony2-applications-with-ant
208
- .. _`PagodaBox` : https://github.com/jmather/pagoda-symfony-sonata-distribution/blob/master/Boxfile
195
+ .. _`Fabric` : http://www.fabfile.org/
209
196
.. _`Magallanes` : https://github.com/andres-montanez/Magallanes
197
+ .. _`Ant` : http://blog.sznapka.pl/deploying-symfony2-applications-with-ant
210
198
.. _`bundles that add deployment features` : http://knpbundles.com/search?q=deploy
211
- .. _`Symfony IRC channel` : http://webchat.freenode.net/?channels=symfony
212
199
.. _`Memcached` : http://memcached.org/
213
200
.. _`Redis` : http://redis.io/
0 commit comments