Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc00741

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Adding details about the Symfony framework as comments Adjust Application use statement replacing with index, otherwise these documents are not included in *any* index Removed the "Learn more" section Created a "Platform as a Service" section Minor improvements Fixed the "make" command Fixed again the tricky list syntax Fixed the syntax of the list Minor fixes Reword the third step Added the missing link references Updated the instructions to build docs locally Refactore how to get the container in a test Fixed a reference Created the main article about "deployment"
2 parents 794563f + 8a13a07 commit bc00741

File tree

8 files changed

+253
-244
lines changed

8 files changed

+253
-244
lines changed

_build/redirection_map

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,4 +328,5 @@
328328
/components/var_dumper/index /components/var_dumper
329329
/components/yaml/introduction /components/yaml
330330
/components/yaml/index /components/yaml
331+
/deployment/tools /deployment
331332
/install/bundles /setup/bundles

console.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,22 @@ console::
216216
namespace Tests\AppBundle\Command;
217217

218218
use AppBundle\Command\CreateUserCommand;
219-
use Symfony\Bundle\FrameworkBundle\Console\Application;
219+
use Symfony\Component\Console\Application;
220+
// use this if you're in the Symfony Framework
221+
//use Symfony\Bundle\FrameworkBundle\Console\Application;
220222
use Symfony\Component\Console\Tester\CommandTester;
221223

222224
class CreateUserCommandTest extends \PHPUnit_Framework_TestCase
223225
{
224226
public function testExecute()
225227
{
226228
$application = new Application();
229+
230+
// if you're in the Symfony framework, do this instead
231+
// extend the KernelTestCase class
232+
// self::bootKernel();
233+
// $application = new Application(self::$kernel);
234+
227235
$application->add(new CreateUserCommand());
228236

229237
$command = $application->find('app:create-user');
@@ -251,13 +259,6 @@ console::
251259
You can also test a whole console application by using
252260
:class:`Symfony\\Component\\Console\\Tester\\ApplicationTester`.
253261

254-
.. note::
255-
256-
When using the Console component in a standalone project, use
257-
:class:`Symfony\\Component\\Console\\Application <Symfony\\Component\\Console\\Application>`
258-
instead of
259-
:class:`Symfony\\Bundle\\FrameworkBundle\\Console\\Application <Symfony\\Bundle\\FrameworkBundle\\Console\\Application>`
260-
261262
To be able to use the fully set up service container for your console tests
262263
you can extend your test from
263264
:class:`Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase`::

contributing/documentation/format.rst

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ tutorial and the `reStructuredText Reference`_.
2727
Sphinx
2828
------
2929

30-
Sphinx is a build system that provides tools to create documentation from
30+
Sphinx_ is a build system that provides tools to create documentation from
3131
reStructuredText documents. As such, it adds new directives and interpreted text
3232
roles to the standard reST markup. Read more about the `Sphinx Markup Constructs`_.
3333

@@ -198,20 +198,6 @@ reached end-of-maintenance will be removed. For example, if Symfony 2.5 were
198198
released today, and 2.2 had recently reached its end-of-life, the 2.2 ``versionadded``
199199
tags would be removed from the new ``2.5`` branch.
200200

201-
Testing Documentation
202-
~~~~~~~~~~~~~~~~~~~~~
203-
204-
When submitting a new content to the documentation repository or when changing
205-
any existing resource, an automatic process will check if your documentation is
206-
free of syntax errors and is ready to be reviewed.
207-
208-
Nevertheless, if you prefer to do this check locally on your own machine before
209-
submitting your documentation, follow these steps:
210-
211-
* Install Sphinx_;
212-
* Install the Sphinx extensions using git submodules: ``$ git submodule update --init``;
213-
* Run ``make html`` and view the generated HTML in the ``_build/html`` directory.
214-
215201
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
216202
.. _Sphinx: http://sphinx-doc.org/
217203
.. _`Symfony documentation`: https://github.com/symfony/symfony-docs

contributing/documentation/overview.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,33 @@ link displayed for Platform.sh service.
258258
Only Pull Requests to maintained branches are automatically built by
259259
Platform.sh. Check the `roadmap`_ for maintained branches.
260260

261+
Build the Documentation Locally
262+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
263+
264+
Alternatively you can build the documentation in your own computer for testing
265+
purposes following these steps:
266+
267+
#. Install `pip`_ as explained in the `pip installation`_ article.
268+
269+
#. Install `Sphinx`_ and `Sphinx Extensions for PHP and Symfony`_
270+
(depending on your system, you may need to execute this command as root user):
271+
272+
.. code-block:: bash
273+
274+
$ pip install sphinx~=1.3.0 git+https://github.com/fabpot/sphinx-php.git
275+
276+
#. Run the following command to build the documentation in HTML format:
277+
278+
.. code-block:: bash
279+
280+
# Linux and macOS
281+
$ ./_build/make html
282+
283+
# Windows
284+
$ _build\make html
285+
286+
The generated documentation is available in the ``_build/html`` directory.
287+
261288
Frequently Asked Questions
262289
--------------------------
263290

@@ -316,3 +343,7 @@ definitely don't want you to waste your time!
316343
.. _`sync your fork`: https://help.github.com/articles/syncing-a-fork
317344
.. _`Platform.sh`: https://platform.sh
318345
.. _`roadmap`: https://symfony.com/roadmap
346+
.. _`pip`: https://pip.pypa.io/en/stable/
347+
.. _`pip installation`: https://pip.pypa.io/en/stable/installing/
348+
.. _`Sphinx`: http://sphinx-doc.org/
349+
.. _`Sphinx Extensions for PHP and Symfony`: https://github.com/fabpot/sphinx-php

deployment.rst

Lines changed: 204 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,210 @@
1-
Deployment
2-
==========
1+
.. index::
2+
single: Deployment; Deployment tools
3+
4+
.. _how-to-deploy-a-symfony2-application:
5+
6+
How to Deploy a Symfony Application
7+
===================================
8+
9+
Deploying a Symfony application can be a complex and varied task depending on
10+
the setup and the requirements of your application. This article is not a step-
11+
by-step guide, but is a general list of the most common requirements and ideas
12+
for deployment.
13+
14+
.. _symfony2-deployment-basics:
15+
16+
Symfony Deployment Basics
17+
-------------------------
18+
19+
The typical steps taken while deploying a Symfony application include:
20+
21+
#. Upload your code to the production server;
22+
#. Install your vendor dependencies (typically done via Composer and may be done
23+
before uploading);
24+
#. Running database migrations or similar tasks to update any changed data structures;
25+
#. Clearing (and optionally, warming up) your cache.
26+
27+
A deployment may also include other tasks, such as:
28+
29+
* Tagging a particular version of your code as a release in your source control
30+
repository;
31+
* Creating a temporary staging area to build your updated setup "offline";
32+
* Running any tests available to ensure code and/or server stability;
33+
* Removal of any unnecessary files from the ``web/`` directory to keep your
34+
production environment clean;
35+
* Clearing of external cache systems (like `Memcached`_ or `Redis`_).
36+
37+
How to Deploy a Symfony Application
38+
-----------------------------------
39+
40+
There are several ways you can deploy a Symfony application. Start with a few
41+
basic deployment strategies and build up from there.
42+
43+
Basic File Transfer
44+
~~~~~~~~~~~~~~~~~~~
45+
46+
The most basic way of deploying an application is copying the files manually
47+
via FTP/SCP (or similar method). This has its disadvantages as you lack control
48+
over the system as the upgrade progresses. This method also requires you
49+
to take some manual steps after transferring the files (see `Common Post-Deployment Tasks`_)
50+
51+
Using Source Control
52+
~~~~~~~~~~~~~~~~~~~~
53+
54+
If you're using source control (e.g. Git or SVN), you can simplify by having
55+
your live installation also be a copy of your repository. When you're ready
56+
to upgrade it is as simple as fetching the latest updates from your source
57+
control system.
58+
59+
This makes updating your files *easier*, but you still need to worry about
60+
manually taking other steps (see `Common Post-Deployment Tasks`_).
61+
62+
Using Platforms as a Service
63+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64+
65+
The specific deployment steps vary greatly from one service provider to another,
66+
so check out the dedicated article for the service of your choose:
367

468
.. toctree::
569
:maxdepth: 1
670
:glob:
771

872
deployment/*
73+
74+
Using Build Scripts and other Tools
75+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76+
77+
There are also tools to help ease the pain of deployment. Some of them have been
78+
specifically tailored to the requirements of Symfony.
79+
80+
`Capistrano`_ with `Symfony plugin`_
81+
`Capistrano`_ is a remote server automation and deployment tool written in Ruby.
82+
`Symfony plugin`_ is a plugin to ease Symfony related tasks, inspired by `Capifony`_
83+
(which works only with Capistrano 2 )
84+
85+
`sf2debpkg`_
86+
Helps you build a native Debian package for your Symfony project.
87+
88+
`Magallanes`_
89+
This Capistrano-like deployment tool is built in PHP, and may be easier
90+
for PHP developers to extend for their needs.
91+
92+
`Fabric`_
93+
This Python-based library provides a basic suite of operations for executing
94+
local or remote shell commands and uploading/downloading files.
95+
96+
`Deployer`_
97+
This is another native PHP rewrite of Capistrano, with some ready recipes for
98+
Symfony.
99+
100+
Bundles
101+
There are some `bundles that add deployment features`_ directly into your
102+
Symfony console.
103+
104+
Basic scripting
105+
You can of course use shell, `Ant`_ or any other build tool to script
106+
the deploying of your project.
107+
108+
Common Post-Deployment Tasks
109+
----------------------------
110+
111+
After deploying your actual source code, there are a number of common things
112+
you'll need to do:
113+
114+
A) Check Requirements
115+
~~~~~~~~~~~~~~~~~~~~~
116+
117+
Check if your server meets the requirements by running:
118+
119+
.. code-block:: bash
120+
121+
$ php app/check.php
122+
123+
B) Configure your ``app/config/parameters.yml`` File
124+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125+
126+
This file should *not* be deployed, but managed through the automatic utilities
127+
provided by Symfony.
128+
129+
C) Install/Update your Vendors
130+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131+
132+
Your vendors can be updated before transferring your source code (i.e.
133+
update the ``vendor/`` directory, then transfer that with your source
134+
code) or afterwards on the server. Either way, just update your vendors
135+
as you normally do:
136+
137+
.. code-block:: bash
138+
139+
$ composer install --no-dev --optimize-autoloader
140+
141+
.. tip::
142+
143+
The ``--optimize-autoloader`` flag improves Composer's autoloader performance
144+
significantly by building a "class map". The ``--no-dev`` flag ensures that
145+
development packages are not installed in the production environment.
146+
147+
.. caution::
148+
149+
If you get a "class not found" error during this step, you may need to
150+
run ``export SYMFONY_ENV=prod`` before running this command so that
151+
the ``post-install-cmd`` scripts run in the ``prod`` environment.
152+
153+
D) Clear your Symfony Cache
154+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
155+
156+
Make sure you clear (and warm-up) your Symfony cache:
157+
158+
.. code-block:: bash
159+
160+
$ php app/console cache:clear --env=prod --no-debug
161+
162+
E) Dump your Assetic Assets
163+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
164+
165+
If you're using Assetic, you'll also want to dump your assets:
166+
167+
.. code-block:: bash
168+
169+
$ php app/console assetic:dump --env=prod --no-debug
170+
171+
F) Other Things!
172+
~~~~~~~~~~~~~~~~
173+
174+
There may be lots of other things that you need to do, depending on your
175+
setup:
176+
177+
* Running any database migrations
178+
* Clearing your APC cache
179+
* Running ``assets:install`` (already taken care of in ``composer install``)
180+
* Add/edit CRON jobs
181+
* Pushing assets to a CDN
182+
* ...
183+
184+
Application Lifecycle: Continuous Integration, QA, etc
185+
------------------------------------------------------
186+
187+
While this entry covers the technical details of deploying, the full lifecycle
188+
of taking code from development up to production may have a lot more steps
189+
(think deploying to staging, QA (Quality Assurance), running tests, etc).
190+
191+
The use of staging, testing, QA, continuous integration, database migrations
192+
and the capability to roll back in case of failure are all strongly advised. There
193+
are simple and more complex tools and one can make the deployment as easy
194+
(or sophisticated) as your environment requires.
195+
196+
Don't forget that deploying your application also involves updating any dependency
197+
(typically via Composer), migrating your database, clearing your cache and
198+
other potential things like pushing assets to a CDN (see `Common Post-Deployment Tasks`_).
199+
200+
.. _`Capifony`: http://capifony.org/
201+
.. _`Capistrano`: http://capistranorb.com/
202+
.. _`sf2debpkg`: https://github.com/liip/sf2debpkg
203+
.. _`Fabric`: http://www.fabfile.org/
204+
.. _`Magallanes`: https://github.com/andres-montanez/Magallanes
205+
.. _`Ant`: http://blog.sznapka.pl/deploying-symfony2-applications-with-ant
206+
.. _`bundles that add deployment features`: http://knpbundles.com/search?q=deploy
207+
.. _`Memcached`: http://memcached.org/
208+
.. _`Redis`: http://redis.io/
209+
.. _`Symfony plugin`: https://github.com/capistrano/symfony/
210+
.. _`Deployer`: http://deployer.org/

deployment/azure-website.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ MySQL database.
392392
393393
This command builds the tables and indexes for your MySQL database. If your
394394
Symfony application is more complex than a basic Symfony Standard Edition, you
395-
may have additional commands to execute for setup (see :doc:`/deployment/tools`).
395+
may have additional commands to execute for setup (see :doc:`/deployment`).
396396

397397
Make sure that your application is running by browsing the ``app.php`` front
398398
controller with your web browser and the following URL:

0 commit comments

Comments
 (0)