midwest php 2017 devops for small team

83
DevOps For Small Teams Joe Ferguson https://joind.in/talk/edcc1

Upload: joe-ferguson

Post on 05-Apr-2017

60 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Midwest PHP 2017 DevOps For Small team

DevOps For Small TeamsJoe Ferguson

https://joind.in/talk/edcc1

Page 2: Midwest PHP 2017 DevOps For Small team

Who Am I?Joe Ferguson

PHP Developer

Engineer @ Aol.

Twitter: @JoePFerguson

Organizer of @MemphisPHP

OSMI Board Member

@NomadPHP Lightning Talks

Passionate about Community

Page 3: Midwest PHP 2017 DevOps For Small team

My first “dev” job

Hired to convert PSDs to HTML

Page 4: Midwest PHP 2017 DevOps For Small team

My first “dev” job

Hired to convert PSDs to HTML

Ended up building / hacking at web apps

Page 5: Midwest PHP 2017 DevOps For Small team

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?)

Page 6: Midwest PHP 2017 DevOps For Small team

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

Page 7: Midwest PHP 2017 DevOps For Small team

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”

Page 8: Midwest PHP 2017 DevOps For Small team

My second dev job

Yay I'm not alone!

Page 9: Midwest PHP 2017 DevOps For Small team

My second dev job

Yay I'm not alone!

I was still "the server person"

Page 10: Midwest PHP 2017 DevOps For Small team

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

Page 11: Midwest PHP 2017 DevOps For Small team

Scaling a team

Version control is NOT renaming files

Version control EVERYTHING

Page 12: Midwest PHP 2017 DevOps For Small team

Teaching our team VCS

https://try.github.io

Page 13: Midwest PHP 2017 DevOps For Small team

Teaching our team VCS

https://guides.github.com

Page 14: Midwest PHP 2017 DevOps For Small team

Teaching our team VCS

https://gettinggit.com/

Page 15: Midwest PHP 2017 DevOps For Small team

Teaching our team VCS

https://leanpub.com/gitworkbook

Page 16: Midwest PHP 2017 DevOps For Small team

Trial & Error is ok!

Page 17: Midwest PHP 2017 DevOps For Small team

Scaling a team

Stop Editing In Production!

Page 18: Midwest PHP 2017 DevOps For Small team

No more edit &

uploading!

Everything goes into

version control!

Page 19: Midwest PHP 2017 DevOps For Small team

Disable FTP Access*!

# echo troy >> /etc/ftpuser

# echo andy >> /etc/ftpuser

# echo joe >> /etc/ftpuser

Better yet, disable FTP completely*

Page 20: Midwest PHP 2017 DevOps For Small team

*If you can

Page 21: Midwest PHP 2017 DevOps For Small team

Scaling a team

Development environments

Page 22: Midwest PHP 2017 DevOps For Small team

MAMP, LAMP, WAMP, WAT?

Mac/Linux/Windows Apache MySQL PHP

These are all great tools

Page 23: Midwest PHP 2017 DevOps For Small team

Do you deploy to MAMP/WAMP?

Page 24: Midwest PHP 2017 DevOps For Small team

Why develop on a different configuration?

Page 25: Midwest PHP 2017 DevOps For Small team

Catch those environment bugs earlier

Page 26: Midwest PHP 2017 DevOps For Small team

Remove the phrase “…It works on my machine…”

From your team

Page 27: Midwest PHP 2017 DevOps For Small team

Or learn the phrase “We’re putting your

machine into production”

Page 28: Midwest PHP 2017 DevOps For Small team

Stop using WAMP/MAMP and start using Vagrant!

Page 29: Midwest PHP 2017 DevOps For Small team

Virtualbox

VMware Fusion & Desktop

Parallels Desktop

Virtual Machine Providers

Page 30: Midwest PHP 2017 DevOps For Small team

API Magic

Page 31: Midwest PHP 2017 DevOps For Small team

Runs Anywhere (almost)

Page 32: Midwest PHP 2017 DevOps For Small team

Vagrant allows you to:

• Create a server• Configure a server• Delete a server

…over and over and over..

Page 33: Midwest PHP 2017 DevOps For Small team

What’s a box?

Page 34: Midwest PHP 2017 DevOps For Small team

Not sure how to create a Vagrant box?

Page 35: Midwest PHP 2017 DevOps For Small team
Page 36: Midwest PHP 2017 DevOps For Small team
Page 37: Midwest PHP 2017 DevOps For Small team

What’s in Homestead

•Ubuntu 16.04•PHP 7.1•Nginx•MySQL•MariaDB•Sqlite3•Postgres•Composer

•Yarn•NodeJS•Bower•Grunt•Gulp•Beanstalkd•Memcached•Redis

Page 38: Midwest PHP 2017 DevOps For Small team

What if Homestead doesn’t fit your application?

Page 39: Midwest PHP 2017 DevOps For Small team

PuPHPet.com

Page 40: Midwest PHP 2017 DevOps For Small team

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

Page 41: Midwest PHP 2017 DevOps For Small team

PuPHPet.com

Great for learning HOW to build boxes

Especially useful if you’d like to learn Puppet

Page 42: Midwest PHP 2017 DevOps For Small team

Other Provisioners

Shell

Chef - use existing Cookbooks

Docker - used if your app is in Docker

SaltStack

Page 43: Midwest PHP 2017 DevOps For Small team

Vagrant Cookbook

https://leanpub.com/vagrantcookbook

Page 44: Midwest PHP 2017 DevOps For Small team

Ansible for DevOps

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

Page 45: Midwest PHP 2017 DevOps For Small team

Vagrant is so 2013! CONTAINERS!

Page 46: Midwest PHP 2017 DevOps For Small team

Source: docker.com/what-docker

Virtual Machines Containers

Page 47: Midwest PHP 2017 DevOps For Small team

Docker For Developers

https://leanpub.com/dockerfordevs

Page 48: Midwest PHP 2017 DevOps For Small team

Learning Budget

Page 49: Midwest PHP 2017 DevOps For Small team

Learning Budget

Page 50: Midwest PHP 2017 DevOps For Small team

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

Page 51: Midwest PHP 2017 DevOps For Small team

Is your code testable?

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

Page 52: Midwest PHP 2017 DevOps For Small team

Testing Resources

http://grumpy-learning.com

Page 53: Midwest PHP 2017 DevOps For Small team

Testing Resources

https://laracasts.com/skills/testing

Page 54: Midwest PHP 2017 DevOps For Small team

Continuous Integration Continuous Delivery

Page 55: Midwest PHP 2017 DevOps For Small team

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

Page 56: Midwest PHP 2017 DevOps For Small team

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

Page 57: Midwest PHP 2017 DevOps For Small team

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

Page 58: Midwest PHP 2017 DevOps For Small team

ServersForHackers.com

Page 59: Midwest PHP 2017 DevOps For Small team

There are a lot of CI solutions out there

Page 60: Midwest PHP 2017 DevOps For Small team

Getting CI Working

https://twitter.com/sebdedeyne/status/842011393364791296

Page 61: Midwest PHP 2017 DevOps For Small team

What is your process?

Page 62: Midwest PHP 2017 DevOps For Small team

Create your workflow

Page 63: Midwest PHP 2017 DevOps For Small team

Optimize your time in the console

Page 64: Midwest PHP 2017 DevOps For Small team

Work smarter not harder

Page 65: Midwest PHP 2017 DevOps For Small team

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

Page 66: Midwest PHP 2017 DevOps For Small team

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"

Page 67: Midwest PHP 2017 DevOps For Small team

Use Screen for long running processes

https://www.mattcutts.com/blog/a-quick-tutorial-on-screen/

Page 68: Midwest PHP 2017 DevOps For Small team

Think of screen as a detachable window that contains your console

Page 69: Midwest PHP 2017 DevOps For Small team

Screen Demo

Page 70: Midwest PHP 2017 DevOps For Small team

Want more Power?

https://tmux.github.io

Page 71: Midwest PHP 2017 DevOps For Small team

Bash isn’t the only shell!

Page 72: Midwest PHP 2017 DevOps For Small team

http://ohmyz.sh

Uses zsh

180+ Plugins

700+ Contributors

140+ Themes

Page 73: Midwest PHP 2017 DevOps For Small team

Customize your shell

• Local IPs• Date

Green Text because this is

the local machine

• User• Hostname• Current Path• Current time

Page 74: Midwest PHP 2017 DevOps For Small team

Customize your shell

• User• Hostname• Current Path• Current time

• Local IPs• Date

Red Text because this is

a remote machine

Page 75: Midwest PHP 2017 DevOps For Small team

Customize your shell

Tab completion on steroids

+ Git branch info because we are in a repo

Page 76: Midwest PHP 2017 DevOps For Small team

Tab Completion Demo

Page 77: Midwest PHP 2017 DevOps For Small team

.zshrc

Page 78: Midwest PHP 2017 DevOps For Small team

Automate Common Tasks

Alias long commands

Shell script sequential commands

Use cron to run your scripts at specific times

Create installers for your settings

Page 79: Midwest PHP 2017 DevOps For Small team

Version Control Configs

Page 80: Midwest PHP 2017 DevOps For Small team

Do NOT version control your SSH keys!

Page 81: Midwest PHP 2017 DevOps For Small team

Do NOT version control your API keys!

Page 82: Midwest PHP 2017 DevOps For Small team

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

Page 83: Midwest PHP 2017 DevOps For Small team

Feedback!

https://joind.in/talk/edcc1

Joe FergusonTwitter: @JoePFergusonEmail: [email protected]: joepferguson

Contact Info: