$30 off During Our Annual Pro Sale. View Details »

Symfony and Docker: a refreshing new experience

Symfony and Docker: a refreshing new experience

Recently, new configurators for Docker and Docker Compose have been added to Symfony Flex.
This means that Symfony can now transparently add the services and PHP extensions needed by your preferred packages!

You want to use Doctrine ORM? So you need a database and the related PDO extension! We’ve got you covered.
You use the mailer? So you want MailCatcher in your development environment? Let’s do this.
You want Panther? so you need Chrome and ChromeDriver! No problem!

But there is more: we now offer you Docker skeletons that take advantage of these new capabilities, and that you can use locally, but also in your CI system and in production!

Kévin Dunglas

December 10, 2021
Tweet

More Decks by Kévin Dunglas

Other Decks in Programming

Transcript

  1. Symfony & Docker A new pattern to build fast and

    reliable web APIs A refreshing new development experience
  2. API, cloud, PHP and JS experts ➔ Scop, 100% employee-owned

    ✊ ➔ Democratically managed 💬 ➔ 55 people 🦄 ➔ France, Tunisia, Morocco 🌎 ➔ [email protected] 💌 Les-Tilleuls.coop
  3. ➔ An OS-level virtualization platform • Build: Dockerfile • Share:

    Registry (hub) • Run: Engine ➔ Software is packaged in containers • Embedded binaries, libs, config files... • Run in isolation • Share a single OS kernel: ⬆performance Docker
  4. Why should you use Docker? ➔ Easy onboarding • docker-compose

    up • No more cumbersome and outdated README files ➔ Versioned, same software and configs everywhere: git pull • locally, for the entire team • CI • staging • prod ➔ Standardized, industry standard ➔ Great tooling, large ecosystem (GitHub Actions, Rancher, K8s...) ➔ (Almost) cross platform: Linux, Windows, Mac @dunglas
  5. ➔ Define and run multi-container apps ➔ In dev, staging

    and even prod (single host) ➔ Example for a Symfony app: • PHP container • Web server container • DBMS container • Cache server container • … Docker Compose
  6. 7 years ago @ Sensiolabs I’ve been introduced to a

    brand new tool for hipsters during a workshop led by Jérémy Derussé at Sensiolabs.
  7. 4 years ago I started the “Symfony Docker” installer and

    project skeleton (co-maintained by Maxime Helias).
  8. Today @ SymfonyWorld 2021 ➔ I’m very happy to announce

    the immediate availability of the official Symfony Docker integration @dunglas
  9. Symfony Flex ➔ Composer plugin ➔ Generates the configuration of

    newly installed PHP packages ➔ New: Docker support • Dockerfile: add PHP extensions, libs, binaries • Docker Compose: adds new services @dunglas
  10. Supported Packages Package Image symfony/orm-pack postgres symfony/mercure-bundle dunglas/mercure symfony/panther n/a

    (Dockerfile only) symfony/mailer schickling/mailcatcher blackfireio/blackfire-symfony-meta blackfire/blackfire More to come: PRs welcome! github.com/symfony/recipes
  11. Symfony CLI ➔ Create new Symfony applications ➔ Deploy in

    SymfonyCloud ➔ Local web server, built-in TLS support ➔ Integration with Docker Compose ➔ Dev environments only ➔ Require local installations of PHP and Symfony CLI @dunglas
  12. Symfony Docker ➔ Docker-based skeleton and installer ➔ Prod ready

    ➔ Compatible with the Flex configurators ➔ No local dependencies, you just need Docker ➔ No bloat, readable config: only 2 containers • PHP • Web server ➔ Automatic TLS certificate generation and renewal ➔ Native support for Mercure and Vulcain @dunglas
  13. ➔ Free and Open Source web server ➔ Secure and

    super fast, written in Go ➔ Extensible ➔ Native PHP FPM support 😍 ➔ Automatic HTTPS, even for localhost ➔ HTTP/3! ➔ Mercure, Vulcain, OAuth, OIDC modules ➔ Cloud native (API, hot config reloading…) Caddy Inside
  14. ➔ Free and Open Source container orchestration system ➔ Unlike

    Docker Compose: native cluster support ➔ Allows to scale deployments (with autoscaling support) ➔ Industry standard ➔ Managed clusters offered by AWS, GCP, Azure, DO, OVH, Scaleway… ➔ Battery included, but complex Kubernetes
  15. ➔ The Kubernetes package manager ➔ Like apt but, for

    Kubernetes ➔ Charts: packages for Kubernetes ➔ Graphical tools (Lens IDE, Ahoy) ➔ Templates for Kubernetes YAML manifests Helm
  16. Symfony & Kubernetes ➔ Images provided by Symfony Docker are

    compatible with Kubernetes ➔ Images provided by API Platform are compatible too ➔ API Platform provides a ready-made Helm chart that you can use with Symfony Docker too! ➔ Just copy it and run helm install @dunglas