Slide 1

Slide 1 text

Symfony & Docker A new pattern to build fast and reliable web APIs A refreshing new development experience

Slide 2

Slide 2 text

Kévin Dunglas ➔ Co-founder of Les-Tilleuls.coop ➔ Symfony Core Team ➔ Symfony Docker ➔ API Platform @dunglas

Slide 3

Slide 3 text

API, cloud, PHP and JS experts ➔ Scop, 100% employee-owned ✊ ➔ Democratically managed 💬 ➔ 55 people 🦄 ➔ France, Tunisia, Morocco 🌎 ➔ [email protected] 💌 Les-Tilleuls.coop

Slide 4

Slide 4 text

Docker?!

Slide 5

Slide 5 text

➔ 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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

Dockerfile

Slide 8

Slide 8 text

➔ 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

Slide 9

Slide 9 text

Docker Compose

Slide 10

Slide 10 text

Docker and Symfony: an Old Story

Slide 11

Slide 11 text

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.

Slide 12

Slide 12 text

6 years ago @ Les-Tilleuls.coop Vincent Chalamon proposed a patch adding Docker support to API Platform.

Slide 13

Slide 13 text

4 years ago I started the “Symfony Docker” installer and project skeleton (co-maintained by Maxime Helias).

Slide 14

Slide 14 text

2 years ago I contributed experimental Flex configurators for Docker and Docker Compose.

Slide 15

Slide 15 text

Today @ SymfonyWorld 2021 ➔ I’m very happy to announce the immediate availability of the official Symfony Docker integration @dunglas

Slide 16

Slide 16 text

Symfony Flex

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

Docker Compose Flex Configurator

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

Symfony CLI

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

Symfony CLI: Docker Compose Support

Slide 23

Slide 23 text

Symfony CLI: Docker Compose Support

Slide 24

Slide 24 text

Symfony Docker Skeleton

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

GitHub Template (optional)

Slide 27

Slide 27 text

Get Started

Slide 28

Slide 28 text

Deploy in prod (single host)

Slide 29

Slide 29 text

Dockerfile Flex Configurator Support

Slide 30

Slide 30 text

docker-compose exec php \ composer req orm

Slide 31

Slide 31 text

➔ 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

Slide 32

Slide 32 text

Kubernetes

Slide 33

Slide 33 text

➔ 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

Slide 34

Slide 34 text

➔ The Kubernetes package manager ➔ Like apt but, for Kubernetes ➔ Charts: packages for Kubernetes ➔ Graphical tools (Lens IDE, Ahoy) ➔ Templates for Kubernetes YAML manifests Helm

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

➔ Any questions? Thank you!