Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Symfony live Paris 2017 :

Symfony live Paris 2017 :

SensioCloud, Heroku, OpenShift... Aujourd'hui les solutions PaaS se démocratisent. Permettant de déployer une application et tous ses services dans des conteneurs, elles promettent de simplifier la vie des développeurs en gérant l'infrastructure avec le code. Mais, au moment de l'utiliser pour l'une de nos applications, de nombreuses problématiques dont certaines propres à Symfony se sont posées : déploiement continu, 0-downtime, gestion du cache / des mots de passe / de la performance, adaptation journalière aux pics de trafic, etc. Voici comment nous les avons résolues une à une, ce qui a réussi, ce qui a échoué et ce qu'il reste à faire.

Joind.in: https://joind.in/event/symfonylive-paris-2017/dployer-une-app-symfony-dans-un-paas

Links:
- https://pecl.php.net/package/APCu
- http://blog.insight.sensiolabs.com/2014/12/22/making-symfony-bootable-with-dbal-2-5.html
- https://12factor.net/

http://paris2017.live.symfony.com/

Tristan Darricau

March 31, 2017
Tweet

Other Decks in Programming

Transcript

  1. Who am I? Tristan Darricau Developer at SensioLabs phpBB core

    contributor @nicofuma Twitter / Github / Gitlab / ...
  2. Build step Every application has to be built buildpack, build

    script, assemble script... every provider has its own receipe
  3. Describe infrastructure infrastructure: db-1: kind: 'database' version: 'mysql:10.0' disk: '10Go'

    app: kind: 'php' version: '7.1' extensions: - 'apcu' - 'pdo-mysql' scripts: - 'composer install'
  4. Use "secret" parameters.yml file Still not ideal... Inject / build

    parameters.yml on runtime Not always possible
  5. Cache warmers Symfony\Bundle\FrameworkBundle\CacheWarmer\ TemplatePathsCacheWarmer Symfony\Bundle\FrameworkBundle\CacheWarmer\ ValidatorCacheWarmer Symfony\Bundle\FrameworkBundle\CacheWarmer\ TranslationsCacheWarmer Symfony\Bridge\ Doctrine\CacheWarmer\

    ProxyCacheWarmer Symfony\Bundle\TwigBundle\CacheWarmer\ TemplateCacheWarmer Symfony\Bundle\FrameworkBundle\CacheWarmer\ AnnotationsCacheWarmer Symfony\Bundle\FrameworkBundle\CacheWarmer\ RouterCacheWarmer Symfony\Bundle\FrameworkBundle\CacheWarmer\ ClassCacheCacheWarmer FOS\RestBundle\Response\AllowedMethodsLoader\AllowedMethodsRouterLoad er ...
  6. Build on runtime? It may work but not ideal... Slow

    down first request May be blocked
  7. Generate on build Improved in Symfony 3.2 Statically generated Read

    only filesystem compliant Requires all parameters? (passwords)
  8. Going further on cache PHP compilation takes time? Do it

    at build PHP7 only opcache.enable=1 opcache.enable_cli=1 opcache.file_cache="/my/cache/dir"
  9. How to do? Complex situation, no magic solution External tool

    3 steps deployment Downtime Forward compatibility ...
  10. Multi applications Handled by all providers app/ front/ .my_paas/ conf.yml

    packages.json back/ .my_paas/ conf.yml composer.json
  11. Sessions # app/config/config.yml snc_redis: clients: default: type: predis alias: default

    dsn: redis://localhost session: client: default prefix: session # app/AppKernel.php $bundles = array( // ... new Snc\RedisBundle\SncRedisBundle(), // ... ); composer require snc/redis-bundle \ predis/predis