8000 Added a Troubleshooting section to the main deployment article by javiereguiluz · Pull Request #8357 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Added a Troubleshooting section to the main deployment article #8357

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 3 commits into from
Oct 29, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
31 changes: 30 additions & 1 deletion deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,35 @@ 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`_).

.. _`Git Tagging`: https://git-scm.com/book/en/v2/Git-Basics-Tagging
Troubleshooting
---------------

Deployments not Using the ``composer.json`` File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Symfony applications provide a ``kernel.project_dir`` parameter and a related
:method:`Symfony\\Component\\HttpKernel\\Kernel\\Kernel::getProjectDir>` method.
You can use this method to perform operations with file paths relative to your
project's root directory. The logic to find that project root directory is based
on the location of the main ``composer.json`` file.

If your deployment method doesn't use Composer, you may have removed the
``composer.json`` file and the application won't work on the production server.
The solution is to override the ``getProjectDir()`` method in the application
kernel and return your project's root directory::

// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
// ...

public function getProjectDir()
{
return __DIR__.'/..';
}
}

.. _`Capifony`: https://github.com/everzet/capifony
.. _`Capistrano`: http://capistranorb.com/
.. _`sf2debpkg`: https://github.com/liip/sf2debpkg
Expand All @@ -220,3 +248,4 @@ other potential things like pushing assets to a CDN (see `Common Post-Deployment
.. _`Redis`: http://redis.io/
.. _`Symfony plugin`: https://github.com/capistrano/symfony/
.. _`Deployer`: http://deployer.org/
.. _`Git Tagging`: https://git-scm.com/book/en/v2/Git-Basics-Tagging
6 changes: 6 additions & 0 deletions service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ each time you ask for it.
// $this is a reference to the current loader
$this->registerClasses($definition, 'AppBundle\\', '../../src/AppBundle/*', '../../src/AppBundle/{Entity,Repository}');

.. tip::

The value of the ``resource`` and ``exclude`` options can be any valid
`glob pattern`_.

Thanks to this configuration, you can automatically use any classes from the
``src/AppBundle`` directory as a service, without needing to manually configure
it. Later, you'll learn more about this in :ref:`service-psr4-loader`.
Expand Down Expand Up @@ -1043,3 +1048,4 @@ Learn more

.. _`service-oriented architecture`: https://en.wikipedia.org/wiki/Service-oriented_architecture
.. _`Symfony Standard Edition (version 3.3) services.yml`: https://github.com/symfony/symfony-standard/blob/3.3/app/config/services.yml
.. _`glob pattern`: https://en.wikipedia.org/wiki/Glob_(programming)
0