Slide 1

Slide 1 text

DevOps For Small Teams Joe Ferguson

Slide 2

Slide 2 text

Who Am I? Joe Ferguson PHP Developer PHP Architect @ Ministry Brands Twitter: @JoePFerguson OSMI Board Member Drone Racing Pilot

Slide 3

Slide 3 text

My first “dev” job Hired to convert PSDs to HTML

Slide 4

Slide 4 text

My first “dev” job Hired to convert PSDs to HTML Ended up building / hacking at web apps

Slide 5

Slide 5 text

My first “dev” job Hired to convert PSDs to HTML Ended up building / hacking at web apps We had no DevOps (was it even a thing then?)

Slide 6

Slide 6 text

My first “dev” job Hired to convert PSDs to HTML Ended up building / hacking at web apps We had no DevOps (was it even a thing then?) We invested in metal

Slide 7

Slide 7 text

My first “dev” job Hired to convert PSDs to HTML Ended up building / hacking at web apps We had no DevOps (was it even a thing then?) We invested in metal Just started using “the cloud”

Slide 8

Slide 8 text

My second dev job Yay I'm not alone!

Slide 9

Slide 9 text

My second dev job Yay I'm not alone! I was still "the server person"

Slide 10

Slide 10 text

Yay I'm not alone! I was still "the server person” Scaling a team We needed to scale up (and skill up) our team My second dev job

Slide 11

Slide 11 text

Scaling a team Version control is NOT renaming files Version control EVERYTHING

Slide 12

Slide 12 text

Teaching our team VCS https://try.github.io

Slide 13

Slide 13 text

Teaching our team VCS https://guides.github.com

Slide 14

Slide 14 text

Teaching our team VCS https://gettinggit.com/

Slide 15

Slide 15 text

Teaching our team VCS https://leanpub.com/gitworkbook

Slide 16

Slide 16 text

Trial & Error is ok!

Slide 17

Slide 17 text

Scaling a team Stop Editing In Production!

Slide 18

Slide 18 text

No more edit & uploading! Everything goes into version control!

Slide 19

Slide 19 text

Disable FTP Access*! # echo troy >> /etc/ftpuser # echo andy >> /etc/ftpuser # echo joe >> /etc/ftpuser Better yet, disable FTP completely*

Slide 20

Slide 20 text

*If you can

Slide 21

Slide 21 text

Scaling a team Development environments

Slide 22

Slide 22 text

MAMP, LAMP, WAMP, WAT? Mac/Linux/Windows Apache MySQL PHP These are all great tools

Slide 23

Slide 23 text

Do you deploy to MAMP/WAMP?

Slide 24

Slide 24 text

Why develop on a different configuration?

Slide 25

Slide 25 text

Catch those environment bugs earlier

Slide 26

Slide 26 text

Remove the phrase “…It works on my machine…” From your team

Slide 27

Slide 27 text

Or learn the phrase “We’re putting your machine into production”

Slide 28

Slide 28 text

Stop using WAMP/MAMP and start using Vagrant!

Slide 29

Slide 29 text

Virtualbox VMware Fusion & Desktop Parallels Desktop Virtual Machine Providers Hyper-V

Slide 30

Slide 30 text

API Magic

Slide 31

Slide 31 text

Runs Anywhere (almost)

Slide 32

Slide 32 text

Vagrant allows you to: •Create a server •Configure a server •Delete a server …over and over and over..

Slide 33

Slide 33 text

What’s a box?

Slide 34

Slide 34 text

Not sure how to create a Vagrant box?

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

What’s in Homestead •Ubuntu 18.04 •PHP 5.6->7.2 •Nginx •MySQL •MariaDB •Sqlite3 •Postgres •Composer •Yarn •NodeJS •Bower •Grunt •Gulp •Beanstalkd •Memcached •Redis

Slide 38

Slide 38 text

What if Homestead doesn’t fit your application?

Slide 39

Slide 39 text

PuPHPet.com

Slide 40

Slide 40 text

Guided path to create your own Vagrant Supports common Distributions Customize users, firewall rules, cron jobs Add databases, virtual hosts Supports Ruby, PHP, Python, NodeJS, HHVM Beanstalkd & RabbitMQ Elastic Search & Apache Solr PuPHPet.com

Slide 41

Slide 41 text

PuPHPet.com Great for learning HOW to build boxes Especially useful if you’d like to learn Puppet

Slide 42

Slide 42 text

Other Provisioners Shell Chef - use existing Cookbooks Docker - used if your app is in Docker SaltStack

Slide 43

Slide 43 text

Vagrant Cookbook https://leanpub.com/vagrantcookbook

Slide 44

Slide 44 text

Ansible for DevOps https://leanpub.com/ansible-for-devops

Slide 45

Slide 45 text

Vagrant is so 2013! CONTAINERS!

Slide 46

Slide 46 text

Source: docker.com/what-docker Virtual Machines Containers

Slide 47

Slide 47 text

Docker For Developers https://leanpub.com/dockerfordevs

Slide 48

Slide 48 text

Learning Budget

Slide 49

Slide 49 text

Learning Budget

Slide 50

Slide 50 text

Scaling a team Test your code! Testing was the hardest part for us. The payoffs in catching regression bugs and confidence in our deployments was well worth it

Slide 51

Slide 51 text

Is your code testable? If unit testing is hard, your code may not have been written to be testable.

Slide 52

Slide 52 text

Testing Resources http://grumpy-learning.com

Slide 53

Slide 53 text

Testing Resources https://laracasts.com/skills/testing

Slide 54

Slide 54 text

Continuous Integration Continuous Delivery

Slide 55

Slide 55 text

Continuous Integration Frequently integrate code changes into the existing code repository Merging branches to master/production Automated build tests to ensure issues found quickly Does not have to be deployed

Slide 56

Slide 56 text

Continuous Delivery Produce valuable changes in code in short cycles to be released at any time. AKA: Continuous Deployment Automated build tests to ensure issues found quickly Deployment happens on successful build

Slide 57

Slide 57 text

Which is right for you? Your goal should be Continuous Integration (at least!) Strive for Continuous Delivery if it makes sense Applications with a live event component may not be suited for Continuous Delivery

Slide 58

Slide 58 text

ServersForHackers.com

Slide 59

Slide 59 text

There are a lot of CI solutions out there

Slide 60

Slide 60 text

Getting CI Working https://twitter.com/sebdedeyne/status/842011393364791296

Slide 61

Slide 61 text

What is your process?

Slide 62

Slide 62 text

Create your workflow

Slide 63

Slide 63 text

Optimize your time in the console

Slide 64

Slide 64 text

Work smarter not harder

Slide 65

Slide 65 text

Stop typing the same commands git status git pull origin master git branch —set-upstream-to=origin/master vagrant global-status | grep running redis-server /usr/local/etc/redis.conf php -S localhost:8000 ssh [email protected] -t screen -dR irc gs gpm gsu vgr startredis startphp irc

Slide 66

Slide 66 text

Make use of aliases alias gs=“git status” alias gpm=“git pull origin master” alias gsu=“git branch —set-upstream-to=origin/master” alias vgr=“vagrant global-status | grep running” alias startredis=“redis-server /usr/local/etc/redis.conf” alias startphp=“php -S localhost:8000” alias irc=“ssh [email protected] -t screen -dR irc"

Slide 67

Slide 67 text

Use Screen for long running processes https://www.mattcutts.com/blog/a-quick-tutorial-on-screen/

Slide 68

Slide 68 text

Think of screen as a detachable window that contains your console

Slide 69

Slide 69 text

Screen Demo

Slide 70

Slide 70 text

Want more Power? https://tmux.github.io

Slide 71

Slide 71 text

Bash isn’t the only shell!

Slide 72

Slide 72 text

http://ohmyz.sh Uses zsh 180+ Plugins 700+ Contributors 140+ Themes

Slide 73

Slide 73 text

Customize your shell • Local IPs • Date Green Text because this is the local machine • User • Hostname • Current Path • Current time

Slide 74

Slide 74 text

Customize your shell • User • Hostname • Current Path • Current time • Local IPs • Date Red Text because this is a remote machine

Slide 75

Slide 75 text

Customize your shell Tab completion on steroids + Git branch info because we are in a repo

Slide 76

Slide 76 text

Tab Completion Demo

Slide 77

Slide 77 text

.zshrc

Slide 78

Slide 78 text

Automate Common Tasks Alias long commands Shell script sequential commands Use cron to run your scripts at specific times Create installers for your settings

Slide 79

Slide 79 text

Version Control Configs

Slide 80

Slide 80 text

Do NOT version control your SSH keys!

Slide 81

Slide 81 text

Do NOT version control your API keys!

Slide 82

Slide 82 text

Recap Version Control everything you can Create a process that works for your team Practice how you play Test everything you can Automate everything you can

Slide 83

Slide 83 text

Feedback! https://joind.in/talk/68798 Joe Ferguson Twitter: @JoePFerguson Email: [email protected] Freenode: joepferguson Contact Info: