A Whale and an Elephant

A presentation at Blue Conf 2019 in June 2019 in Cardiff, UK by Steve McDougall

Slide 1

Slide 1

PHP MEETS DOCKER A WHALE AND AN ELEPHANT

Slide 2

Slide 2

A WHALE AND AN ELEPHANT WHO AM I? I’m Steve McDougall ‣ ‣ ‣ ‣ PHP User Group Organiser Conference Organiser Experienced Developer PHP Advocate

Slide 3

Slide 3

A MODERN WORKFLOW FOR PHP DEVELOPERS

Slide 4

Slide 4

A WHALE AND AN ELEPHANT LETS START SIMPLE At this point frameworks aren’t important For this talk I will use Laravel as it has an easy installer

Slide 5

Slide 5

A WHALE AND AN ELEPHANT INTRODUCING DOCKER There are many ways to add Docker to your PHP projects, for this talk I will be using DDEV

Slide 6

Slide 6

A WHALE AND AN ELEPHANT SET UP ENVIRONMENTS IN MINUTES; SWITCH CONTEXTS AND PROJECTS QUICKLY; SPEED YOUR TIME TO DEPLOYMENT DDEV

Slide 7

Slide 7

A WHALE AND AN ELEPHANT WHAT IS DDEV DDEV is an amazing little tool to add Docker into any PHP application, with a great command line and easy to use configuration it is my go to for containers.

Slide 8

Slide 8

A WHALE AND AN ELEPHANT LETS ADD IT TO OUR APP

Slide 9

Slide 9

WE DID IT! With one line we added Docker to out application

Slide 10

Slide 10

HOW DO WE CONFIGURE DDEV

Slide 11

Slide 11

A WHALE AND AN ELEPHANT LETS START OUR APPLICATION

Slide 12

Slide 12

ONTO CI/CD

Slide 13

Slide 13

A WHALE AND AN ELEPHANT TESTING We all know Laravel has a nice testing suite, so let’s add some very basic tests, to prove a point.

Slide 14

Slide 14

A WHALE AND AN ELEPHANT NEXT STOP: GITLAB Next stop is to get all this magic up on GitLab. We all know how git works, so fast forward a couple of minutes.

Slide 15

Slide 15

A WHALE AND AN ELEPHANT TIME TO CONFIGURE OUR SERVER

Slide 16

Slide 16

A WHALE AND AN ELEPHANT GITLAB NEEDS TO KNOW ABOUT OUR PRIVATE KEY

Slide 17

Slide 17

A WHALE AND AN ELEPHANT MAKE SURE TO ADD IT TO YOUR REPO!

Slide 18

Slide 18

A WHALE AND AN ELEPHANT CONFIGURE NGINX

Slide 19

Slide 19

ENTER ENVOY

Slide 20

Slide 20

A WHALE AND AN ELEPHANT LARAVEL ENVOY PROVIDES A CLEAN, MINIMAL SYNTAX FOR DEFINING COMMON TASKS YOU RUN ON YOUR REMOTE SERVERS. Laravel Envoy

Slide 21

Slide 21

A WHALE AND AN ELEPHANT ▸ Tasks: Tasks are commands to be ran on your remote server ▸ Stories: Stories are groups of tasks ▸ Notifications: Send notifications to Slack or Discord

Slide 22

Slide 22

A WHALE AND AN ELEPHANT MANAGING RELEASES Envoy has a useful setup directive, which allows you to set initial variables to use.

Slide 23

Slide 23

GITLAB: CONTAINER REPOSITORY

Slide 24

Slide 24

A WHALE AND AN ELEPHANT CREATE A .GITLAB-CI.YML TO MANAGE THE PROCESS

Slide 25

Slide 25

TEXT CI/CD IS EASIER THAN YOU THINK, AND WITH LOADS OF TOOLS OUT THERE YOU HAVE NO EXCUSE NOT TO USE THEM Steve McDougall

Slide 26

Slide 26

GitHub: JustSteveKing Twitter: @JustSteveKing THANK YOU FOR LISTENING