Skip to content

Updated the generic Deployment article #5003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 2, 2015
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 53 additions & 65 deletions cookbook/deployment/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ How to Deploy a Symfony Application

.. note::

Deploying can be a complex and varied task depending on your setup and needs.
This entry doesn't try to explain everything, but rather offers the most
common requirements and ideas for deployment.
Deploying can be a complex and varied task depending on the setup and the
requirements of your application. This article is not a step-by-step guide,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] and the requirements [...]

but is a general list of the most common requirements and ideas for deployment.

.. _symfony2-deployment-basics:

Expand All @@ -19,26 +19,27 @@ Symfony Deployment Basics

The typical steps taken while deploying a Symfony application include:

#. Upload your modified code to the live server;
#. Update your vendor dependencies (typically done via Composer, and may
#. Upload your code to the production server;
#. Install/update your vendor dependencies (typically done via Composer, and may
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should remove the serial comma before "and"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

during a deploy, I would only advertise to install deps.

be done before uploading);
#. Running database migrations or similar tasks to update any changed data structures;
#. Clearing (and perhaps more importantly, warming up) your cache.
#. Clearing (and optionally, warming up) your cache.

A deployment may also include other things, such as:
A deployment may also include other tasks, such as:

* Tagging a particular version of your code as a release in your source control repository;
* Tagging a particular version of your code as a release in your source control
repository;
* Creating a temporary staging area to build your updated setup "offline";
* Running any tests available to ensure code and/or server stability;
* Removal of any unnecessary files from ``web`` to keep your production environment clean;
* Removal of any unnecessary files from the ``web/`` directory to keep your
production environment clean;
* Clearing of external cache systems (like `Memcached`_ or `Redis`_).

How to Deploy a Symfony Application
-----------------------------------

There are several ways you can deploy a Symfony application.

Start with a few basic deployment strategies and build up from there.
There are several ways you can deploy a Symfony application. Start with a few
basic deployment strategies and build up from there.

Basic File Transfer
~~~~~~~~~~~~~~~~~~~
Expand All @@ -62,12 +63,35 @@ manually taking other steps (see `Common Post-Deployment Tasks`_).
Using Build Scripts and other Tools
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There are also high-quality tools to help ease the pain of deployment. There
are even a few tools which have been specifically tailored to the requirements of
Symfony, and which take special care to ensure that everything before, during,
and after a deployment has gone correctly.
There are also tools to help ease the pain of deployment. Some of them have been
specifically tailored to the requirements of Symfony.

`Capifony`_
Provides a specialized set of tools on top of `Capistrano`_, tailored
specifically to Symfony projects.

`sf2debpkg`_
Helps you build a native Debian package for your Symfony project.

`Magallanes`_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we please add fabric? :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my favorite thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your suggestion: Fabric is indeed very popular, so I've added a reference to it in 9e01941

This Capistrano-like deployment tool is built in PHP, and may be easier
for PHP developers to extend for their needs.

See `The Tools`_ for a list of tools that can help with deployment.
Bundles
There are some `bundles that add deployment features`_ directly into your
Symfony console.

Basic scripting
You can of course use shell, `Ant`_, or any other build tool to script
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, you should remove the serial comma here

the deploying of your project.

Platform as a Service Providers
The Symfony Cookbook includes detailed articles for some of the most well-known
Platform as a Service (PaaS) providers:

* :doc:`Microsoft Azure </cookbook/deployment/azure-website>`
* :doc:`Heroku </cookbook/deployment/heroku>`
* :doc:`Platform.sh </cookbook/deployment/platformsh>`

Common Post-Deployment Tasks
----------------------------
Expand All @@ -87,12 +111,11 @@ Check if your server meets the requirements by running:
B) Configure your ``app/config/parameters.yml`` File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This file should be customized on each system. The method you use to
deploy your source code should *not* deploy this file. Instead, you should
set it up manually (or via some build process) on your server(s).
This file should *not* be deployed, but managed through the automatic utilities
provided by Symfony.

C) Update your Vendors
~~~~~~~~~~~~~~~~~~~~~~
C) Install/Update your Vendors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Your vendors can be updated before transferring your source code (i.e.
update the ``vendor/`` directory, then transfer that with your source
Expand All @@ -105,10 +128,9 @@ as you normally do:

.. tip::

The ``--optimize-autoloader`` flag makes Composer's autoloader more
performant by building a "class map". The ``--no-dev`` flag
ensures that development packages are not installed in the production
environment.
The ``--optimize-autoloader`` flag improves Composer's autoloader performance
significantly by building a "class map". The ``--no-dev`` flag ensures that
development packages are not installed in the production environment.

.. caution::

Expand Down Expand Up @@ -152,7 +174,7 @@ Application Lifecycle: Continuous Integration, QA, etc

While this entry covers the technical details of deploying, the full lifecycle
of taking code from development up to production may have a lot more steps
(think deploying to staging, QA, running tests, etc).
(think deploying to staging, QA (Quality Assurance), running tests, etc).

The use of staging, testing, QA, continuous integration, database migrations
and the capability to roll back in case of failure are all strongly advised. There
Expand All @@ -163,51 +185,17 @@ Don't forget that deploying your application also involves updating any dependen
(typically via Composer), migrating your database, clearing your cache and
other potential things like pushing assets to a CDN (see `Common Post-Deployment Tasks`_).

The Tools
---------

`Capifony`_:

This tool provides a specialized set of tools on top of Capistrano, tailored
specifically to symfony and Symfony projects.

`sf2debpkg`_:

This tool helps you build a native Debian package for your Symfony project.

`Magallanes`_:

This Capistrano-like deployment tool is built in PHP, and may be easier
for PHP developers to extend for their needs.

Bundles:

There are many `bundles that add deployment features`_ directly into your
Symfony console.

Basic scripting:

You can of course use shell, `Ant`_, or any other build tool to script
the deploying of your project.

Platform as a Service Providers:

PaaS is a relatively new way to deploy your application. Typically a PaaS
will use a single configuration file in your project's root directory to
determine how to build an environment on the fly that supports your software.
One provider with confirmed Symfony support is `PagodaBox`_.

.. tip::

Looking for more? Talk to the community on the `Symfony IRC channel`_ #symfony
(on freenode) for more information.
Looking for more? Talk to the community on the `Symfony IRC channel`_ for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oeh, being part of the IRC group, I'm -1 on this one. These kind of messages send people with a wrong expectation to the IRC channel. I'm almost sure none of the "IRC guys" knows a lot more about deployment than what's written here.

more information.

.. _`Capifony`: http://capifony.org/
.. _`Capistrano`: http://capistranorb.com/
.. _`sf2debpkg`: https://github.com/liip/sf2debpkg
.. _`Ant`: http://blog.sznapka.pl/deploying-symfony2-applications-with-ant
.. _`PagodaBox`: https://github.com/jmather/pagoda-symfony-sonata-distribution/blob/master/Boxfile
.. _`Magallanes`: https://github.com/andres-montanez/Magallanes
.. _`bundles that add deployment features`: http://knpbundles.com/search?q=deploy
.. _`Symfony IRC channel`: http://webchat.freenode.net/?channels=symfony
.. _`Symfony IRC channel`: http://symfony.com/irc
.. _`Memcached`: http://memcached.org/
.. _`Redis`: http://redis.io/