Slide 1

Slide 1 text

The State
 of Symfony
 in the Cloud Fabien Potencier @fabpot

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

"The most common way to deploy a project to production is to transfer all its files by FTP (or SFTP). [...] the symfony lib/ and data/ directories are linked by svn:externals

Slide 4

Slide 4 text

Sending the root project directory by FTP is fine for the first transfer, but when you need to upload an update of your application, where only a few files have changed, FTP is not ideal.

Slide 5

Slide 5 text

The solution that is supported by symfony is rsync synchronization through an SSH layer. More and more commercial hosts support an SSH tunnel to secure file uploads on their servers...

Slide 6

Slide 6 text

Don't forget to clear the cache in the production server after synchronization.

Slide 7

Slide 7 text

Code Deployment
 in 2016

Slide 8

Slide 8 text

Read-Only Filesystems Code Deployment
 in 2016

Slide 9

Slide 9 text

Read-Only Filesystems Build vs Run Code Deployment
 in 2016

Slide 10

Slide 10 text

Read-Only Filesystems Build vs Run Isolated and Agnostic Code Deployment
 in 2016

Slide 11

Slide 11 text

Read-Only Filesystems Build vs Run Isolated and Agnostic Code Deployment
 in 2016

Slide 12

Slide 12 text

Read-Only Filesystems Build vs Run Isolated and Agnostic Configurable at Runtime Code Deployment
 in 2016

Slide 13

Slide 13 text

Read-Only Filesystems and Symfony

Slide 14

Slide 14 text

class AppKernel extends Kernel { // ... public function getCacheDir() { return dirname(__DIR__).'/var/cache/'.$this->getEnvironment(); } public function getLogDir() { return dirname(__DIR__).'/var/logs'; } }

Slide 15

Slide 15 text

Relative paths in cache Code Deployment
 in 2016

Slide 16

Slide 16 text

There is a big problem to build a site in a temporary directory, warm up the cache for production mode on the build server and then rsyncing it to the production server into another directory.

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

The biggest problem is the usage of dirname which is naive per the PHP documentation: "dirname() operates naively on the input string, and is not aware of the actual filesystem, or path components such as "..".")". ... Looking at this issue again, I think there is no easy fix. Using dirname() will indeed work but as noted by @jakzal, the cache dir can be outside of the root dir. In this case, using dirname() won't help.

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

Read-only Cache Code Deployment
 in 2016

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

ok so the whole sf2 cache can be warmup from now in 1 pass? If you tell me how to accomplish that... I'm very interested!

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

3.2

Slide 32

Slide 32 text

3.3?

Slide 33

Slide 33 text

var/cache vs var/tmp 3.3?

Slide 34

Slide 34 text

3.3? cache:clear vs cache:warmup

Slide 35

Slide 35 text

Symfony in 2016 Code, Data, and Services

Slide 36

Slide 36 text

Symfony in 2016 Service Wiring in 2016

Slide 37

Slide 37 text

Symfony in 2016 Env Vars

Slide 38

Slide 38 text

Env Vars Code Deployment
 in 2016

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

host: '%env(DATABASE_HOST)%' parameters: env(DATABASE_HOST): localhost

Slide 41

Slide 41 text

Symfony in 2016 Infrastructure Configuration

Slide 42

Slide 42 text

Infrastructure Configuration {
 "require": {
 "php": ">=5.5.9",
 "silex/silex": "~2.0",
 "silex/web-profiler": "~2.0",
 "symfony/asset": "~2.8|3.0.*",

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Infrastructure Configuration {
 "require": {
 "php": ">=5.5.9",
 "silex/silex": "~2.0",
 "silex/web-profiler": "~2.0",
 "symfony/asset": "~2.8|3.0.*", pgsqldb:
 type: postgresql:9.6
 disk: 2048
 configuration:
 extensions:
 uuid-ossp
 cache:
 type: redis:3.0 runtime:
 extensions:
 - apcu
 - pdo_pgsql
 - redis
 dependencies:
 python:
 sphinx: "1.3"
 ruby:
 sass: "*"

Slide 45

Slide 45 text

Git-powered Infrastructure

Slide 46

Slide 46 text

sensiocloud branch feat-db master

Slide 47

Slide 47 text

sensiocloud push feat-a

Slide 48

Slide 48 text

sensiocloud sync -y data

Slide 49

Slide 49 text

sensiocloud merge feat-db

Slide 50

Slide 50 text

sensiocloud init

Slide 51

Slide 51 text

sensiocloud tunnel:open

Slide 52

Slide 52 text

From development to Production 99.99% SLA on the entire stack

Slide 53

Slide 53 text

fabien@sensio.cloud Available early 2017