Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Jonathan Reinink Canadian web developer.

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Plates A native PHP template system.

Slide 6

Slide 6 text

Glide On-demand image manipulation library

Slide 7

Slide 7 text

Deployments Moving your apps from dev to production.

Slide 8

Slide 8 text

Average Projects What do they look like?

Slide 9

Slide 9 text

Deployment Mistakes

Slide 10

Slide 10 text

Developed directly on the production server Manually uploaded files over FTP I’ve included my vendor directory in my repo Migrated my DB directly from PhpMyAdmin SSH’d into production server to do a `git pull` or `composer install` I didn’t deploy as often as I should Other team members couldn’t deploy

Slide 11

Slide 11 text

Edit files in nano on the server. Continuous deployment achieved. —Jeff Carouth “ ”

Slide 12

Slide 12 text

Life is too short to deploy manually over FTP —Joel Clermont “ ”

Slide 13

Slide 13 text

Automation

Slide 14

Slide 14 text

(continuous) Deployments

Slide 15

Slide 15 text

Increased Productivity Allowed me to focus on my work.

Slide 16

Slide 16 text

Less Errors Computers are better at repetitive tasks.

Slide 17

Slide 17 text

Why not? I'm a programmer. That stuff for DevOps. Tools like Jenkins and Capistrano look way too confusing. My projects are too small to bother. The tooling is too expensive. I’m only one dev, is it really worth the effort?

Slide 18

Slide 18 text

Key Tasks We need to move some code. We need to install our dependencies. We need to migrate our database. We need to compile/minify assets. We need to flush our cache/run optimizations.

Slide 19

Slide 19 text

Bonus Tasks Run tests to verify that they pass. Check coding standards. Automated code analysis.

Slide 20

Slide 20 text

Wish List More than one developer can deploy. Configuration must be minimal. All configuration online in one place. It has to be affordable. Deployment should happen automatically.

Slide 21

Slide 21 text

Approaches PaaS Products Deployment Services CI Services Task Runners

Slide 22

Slide 22 text

PaaS Products Hosting with built-in deployment tools.

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

# You need a composer.json file echo "{}" > composer.json ! # Create a new Heroku app heroku create mynewapp ! # Any you domains heroku domains:add mynewapp.com heroku domains:add www.mynewapp.com ! # Push your code to master git push heroku master

Slide 25

Slide 25 text

{ "require": { "php": "~5.6.0", "ext-gd": "*", }, "scripts": { "post-install-cmd": [ "php artisan clear-compiled", "php artisan optimize" ], "compile": [ "php artisan migrate --force" ] } }

Slide 26

Slide 26 text

Pushing to [email protected]:myrepo.git Warning: Permanently added 'heroku.com,50.19.85.156' (RSA) to t Fetching repository, done. -----> Fetching custom git buildpack... done -----> PHP app detected -----> No runtime required in composer.json, defaulting to PHP -----> Installing system packages... - PHP 5.6.6 - Apache 2.4.10 - Nginx 1.6.0 -----> Installing PHP extensions... - exif (composer.lock; bundled) - gd (composer.lock; bundled) - mbstring (composer.lock; bundled) - zend-opcache (automatic; bundled) -----> Installing dependencies... Composer version 1.0-dev (833ce984264204e7d6576ab082660105c7d8f Loading composer repositories with package information Installing dependencies from lock file

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

# Add your Fortrabbit remote address to Git git remote add fortrabbit [email protected]... ! # Make a commit git commit -am 'Made a change! [trigger:composer]' ! # Push your code to master git push fortrabbit master

Slide 31

Slide 31 text

composer: method: install mode: always ! post-deploy: script: artisan args: - migrate fortrabbit.yml

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

Deployment Services Less management for a small cost.

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

Continuous Integration Services

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

Task Runners Remote server automation.

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

Robo

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

No connections have been set, please create one: (production)production No host is set for [production/0], please provide one:mynewapp.com No username is set for [production/0], please provide one:jonathan No password or SSH key is set for [production/0],[key/password]password No password is set for [production/0], please provide one: production/0 | Ignite (Creates Rocketeer's configuration) What is your application's name ? (rocketeer)mynewapp The Rocketeer configuration was created at rocketeer/.rocketeer # Install with Composer composer require --dev anahkiasen/rocketeer ! # Run configuration setup php vendor/bin/rocketeer ignite

Slide 67

Slide 67 text

/.rocketeer config.php hooks.php paths.php remote.php scm.php stages.php strategies.php

Slide 68

Slide 68 text

// The SCM used (supported: "git", "svn") 'scm' => 'git', ! // The address to your repository 'repository' => ‘https://jonathan@bitbucket...', ! // The repository credentials 'username' => '', 'password' => '', ! // The branch to deploy 'branch' => 'master', scm.php

Slide 69

Slide 69 text

// The root directory where // your applications will be deployed 'root_directory' => ‘/var/www/mynewapp/', remote.php

Slide 70

Slide 70 text

// Tasks to execute after the // core Rocketeer Tasks 'after' => [ 'deploy' => [ 'sudo service php-fpm reload', 'php artisan migrate --force', ], ], hooks.php

Slide 71

Slide 71 text

# Run the deployment php vendor/bin/rocketeer deploy No password or SSH key is set for [production/0], [key/password]password No password is set for [production/0], please provide one: No username is set for [repository], please provide one:jonathan No password is set for [repository], please provide one: | Deploy (Deploys the website) |-- Primer (Run local checks to ensure deploy can proceed) |-- CreateRelease (Creates a new release on the server) |---- Deploy/Clone (Clones a fresh instance of the repository by SCM) |===> Cloning repository in "/srv/users/rocketeer/apps/rocketeer/releases/20150312135546" $ git clone "https://reinink:[email protected]/reinink/rocketeer.git" "/srv/users/rocketeer/ap [[email protected]] (production) Cloning into '/srv/users/rocketeer/apps/rocketeer/rel |===> Initializing submodules if any $ cd /srv/users/rocketeer/apps/rocketeer/releases/20150312135546 $ git submodule update --init --recursive |-- Dependencies (Installs or update the dependencies on server) |---- Dependencies/Polyglot (Runs all of the above package managers if necessary) |------ Dependencies/Composer (Installs dependencies with Composer) $ cd /srv/users/rocketeer/apps/rocketeer/releases/20150312135546 $ /usr/bin/composer5.6-sp install --no-interaction --no-dev --prefer-dist [[email protected]] (production) Loading composer repositories with package informatio [[email protected]] (production) Installing dependencies from lock file

Slide 72

Slide 72 text

That’s all folks! Give continuous deployment a try!

Slide 73

Slide 73 text

Thanks! Follow me on Twitter at @reinink. Rate this talk https://joind.in/13068.