zendcon 2015 - devops for small teams

71
DevOps For Small Teams Joe Ferguson https://joind.in/15587

Upload: joe-ferguson

Post on 15-Feb-2017

666 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: ZendCon 2015 - DevOps for Small Teams

DevOps For Small TeamsJoe Ferguson

https://joind.in/15587

Page 2: ZendCon 2015 - DevOps for Small Teams

Who Am I?

Joe Ferguson

PHP Developer

Twitter: @JoePFerguson

Organizer of @MemphisPHP

@NomadPHP Lightning Talks

Passionate about Community

Page 3: ZendCon 2015 - DevOps for Small Teams

My first “dev” job

Hired to convert PSDs to HTML

Page 4: ZendCon 2015 - DevOps for Small Teams

My first “dev” job

Hired to convert PSDs to HTML

Ended up building / hacking at web apps

Page 5: ZendCon 2015 - DevOps for Small Teams

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: ZendCon 2015 - DevOps for Small Teams

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: ZendCon 2015 - DevOps for Small Teams

My first “dev” jobHired 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: ZendCon 2015 - DevOps for Small Teams

My second dev job

Yay I'm not alone!

Page 9: ZendCon 2015 - DevOps for Small Teams

My second dev job

Yay I'm not alone!

I was still "the server person"

Page 10: ZendCon 2015 - DevOps for Small Teams

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: ZendCon 2015 - DevOps for Small Teams

Scaling a team

Version control is NOT renaming files

Version control EVERYTHING

Page 12: ZendCon 2015 - DevOps for Small Teams

Teaching our team VCS

https://try.github.io

Page 13: ZendCon 2015 - DevOps for Small Teams

Teaching our team VCS

https://guides.github.com

Page 14: ZendCon 2015 - DevOps for Small Teams

Trial & Error is ok!

Page 15: ZendCon 2015 - DevOps for Small Teams

Scaling a team

Stop Editing In Production!

Page 16: ZendCon 2015 - DevOps for Small Teams

No more edit & uploading!

Everything goes into

version control!

Page 17: ZendCon 2015 - DevOps for Small Teams

Disable FTP Access*!

# echo troy >> /etc/ftpuser

# echo andy >> /etc/ftpuser

# echo joe >> /etc/ftpuser

Better yet, disable FTP completely*

Page 18: ZendCon 2015 - DevOps for Small Teams

*If you can

Page 19: ZendCon 2015 - DevOps for Small Teams

Scaling a team

Development environments

Page 20: ZendCon 2015 - DevOps for Small Teams

MAMP, LAMP, WAMP, WAT?

Mac/Linux/Windows Apache MySQL PHP

These are all great tools

Page 21: ZendCon 2015 - DevOps for Small Teams

Do you deploy to MAMP/WAMP?

Page 22: ZendCon 2015 - DevOps for Small Teams

Why develop on a different configuration?

Page 23: ZendCon 2015 - DevOps for Small Teams

Catch those environment bugs earlier

Page 24: ZendCon 2015 - DevOps for Small Teams

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

From your team

Page 25: ZendCon 2015 - DevOps for Small Teams

Stop using WAMP/MAMP and start using Vagrant!

Page 26: ZendCon 2015 - DevOps for Small Teams

Vagrant allows you to:• Create a server• Configure a server• Delete a server

…over and over and over..

Page 27: ZendCon 2015 - DevOps for Small Teams

Not sure how to create a Vagrant box?

Page 28: ZendCon 2015 - DevOps for Small Teams

PuPHPet.com

Page 29: ZendCon 2015 - DevOps for Small Teams

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 30: ZendCon 2015 - DevOps for Small Teams

PuPHPet.com

Great for learning HOW to build boxes

Especially useful if you’d like to learn Puppet

Page 31: ZendCon 2015 - DevOps for Small Teams

Other Provisioners

Shell

Chef - use existing Cookbooks

Docker - used if your app is in Docker

SaltStack

Page 32: ZendCon 2015 - DevOps for Small Teams

Vagrant Cookbook

https://leanpub.com/vagrantcookbook

Page 33: ZendCon 2015 - DevOps for Small Teams

Ansible for DevOps

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

Page 34: ZendCon 2015 - DevOps for Small Teams

Learning Budget

Page 35: ZendCon 2015 - DevOps for Small Teams

Learning Budget

Page 36: ZendCon 2015 - DevOps for Small Teams

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 37: ZendCon 2015 - DevOps for Small Teams

Is your code testable?

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

Page 38: ZendCon 2015 - DevOps for Small Teams

Testing Resources

http://grumpy-learning.com

Page 39: ZendCon 2015 - DevOps for Small Teams

Testing Resources

https://laracasts.com/collections/testing-in-php

Page 40: ZendCon 2015 - DevOps for Small Teams

Continuous Integration Continuous Delivery

Page 41: ZendCon 2015 - DevOps for Small Teams

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 42: ZendCon 2015 - DevOps for Small Teams

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 43: ZendCon 2015 - DevOps for Small Teams

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 44: ZendCon 2015 - DevOps for Small Teams

There are a lot of CI solutions out there

Page 45: ZendCon 2015 - DevOps for Small Teams

ServersForHackers.com

Page 46: ZendCon 2015 - DevOps for Small Teams

What is your process?

Page 47: ZendCon 2015 - DevOps for Small Teams

Create your workflow

Page 48: ZendCon 2015 - DevOps for Small Teams

Optimize your time in the console

Page 49: ZendCon 2015 - DevOps for Small Teams

Work smarter not harder

Page 50: ZendCon 2015 - DevOps for Small Teams

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 51: ZendCon 2015 - DevOps for Small Teams

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 52: ZendCon 2015 - DevOps for Small Teams

Use Screen for long running processes

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

Page 53: ZendCon 2015 - DevOps for Small Teams

Think of screen as a detachable window that contains your console

Page 54: ZendCon 2015 - DevOps for Small Teams

Screen Demo

Page 55: ZendCon 2015 - DevOps for Small Teams

Want more Power?

https://tmux.github.io

Page 56: ZendCon 2015 - DevOps for Small Teams

Bash isn’t the only shell!

Page 57: ZendCon 2015 - DevOps for Small Teams

http://ohmyz.sh

Uses zsh

180+ Plugins

700+ Contributors

140+ Themes

Page 58: ZendCon 2015 - DevOps for Small Teams

myZsh

Page 59: ZendCon 2015 - DevOps for Small Teams

Why do I use myzsh over oh-my-zsh?

Page 60: ZendCon 2015 - DevOps for Small Teams

Why do I use myzsh over oh-my-zsh?

Page 61: ZendCon 2015 - DevOps for Small Teams

Customize your shell

• Local IPs• Date

Green Text because this is

the local machine

• User• Hostname• Current Path• Current time

Page 62: ZendCon 2015 - DevOps for Small Teams

Customize your shell

• User• Hostname• Current Path• Current time

• Local IPs• Date

Red Text because this is

a remote machine

Page 63: ZendCon 2015 - DevOps for Small Teams

Customize your shell

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

Page 64: ZendCon 2015 - DevOps for Small Teams

Tab Completion Demo

Page 65: ZendCon 2015 - DevOps for Small Teams

.zshrc

Page 66: ZendCon 2015 - DevOps for Small Teams

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 67: ZendCon 2015 - DevOps for Small Teams

Version Control Configs

Page 68: ZendCon 2015 - DevOps for Small Teams

Do NOT version control your SSH keys!

Page 69: ZendCon 2015 - DevOps for Small Teams

Do NOT version control your API keys!

Page 70: ZendCon 2015 - DevOps for Small Teams

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 71: ZendCon 2015 - DevOps for Small Teams

Feedback!

https://joind.in/15587

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

Contact Info: