no more “cowboy coding”: a best practices guide to local development & migration

30
No more “Cowboy Coding” A Best Practices Guide to Local Development & Migration all disney images used without permission so don’t sue me

Upload: podsframework

Post on 14-Apr-2017

94 views

Category:

Internet


3 download

TRANSCRIPT

Page 1: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

No more “Cowboy Coding”A Best Practices Guide to

Local Development & Migration

all disney images used without permission so don’t sue me

Page 2: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

How many of you have done THIS?

Page 3: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Or This? (without a backup)

Page 4: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Or This?

Page 5: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Well, That’s Cowboy Coding!And we don’ttake KINDLY to those kindaSHENANIGANS!

(and neither doyour clients)

all disney images used without permission so don’t sue me

Page 6: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Overview:• Regular Backups

(Even Better in the CLOUD!)• Local Development FIRST• Understanding the WordPress Database

& File Structure• Version Control Process

(& why it’s so important)• Migrating a LIVE Website from Local

(without losing your head)

all disney images used without permission so don’t sue me

Page 7: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

BACKUPS

MINIMUM: Copy your file before editing or replacing into

a backup directory

BETTER: Use Cloud Connected Storage• OFFSITE• Sync’d on all your devices (even your phone)• RESTORE History!

(Easy to get back to prior version)

GREAT for Graphic Files, Project Documents

Page 8: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Local Development

Web Server running WordPress w/ MySQL Databaseon your LOCAL machineWhy? Gives you a Safety Net

• Test things (and break things) w/o hurting anyone• Test Plugins and Themes• Learn the WordPress Database• Great for Client Demos

Page 9: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Common Development Environment

Page 10: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Agency/Team Development Environment

Page 11: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Local Development: ServerPress

DesktopServer by ServerPresshttp://serverpress.com

• (Works on Mac or Windows)

• Automates the AMP Stack(Apache/MariaDB/PHP)

• FREE (up to 3 local websites)

Page 12: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Local Development: Vagrant

• VagrantsVVV (or Varying Vagrant Vagrants)

• Works on ALL OS’s (with some work)

• (Requires VirtualBox & Vagrant)• Creates Virtual Machines all within

your desktop (more console based)

• FREE but ComplicatedGetting Started Walkthrough:

http://torquemag.io/2014/08/getting-started-vagrant-local-development/

https://webdevstudios.com/2015/01/14/getting-started-vagrant-vvv-local-development/

includes VV List, a VVV Site Wizard

Page 13: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Local Development: Docker / Pressmatic

• Docker Containers• Each site gets a custom environment• Works on ALL OS’s (with some work)• FREE but Complicated

Pressmatic - pressmatic.io - $129• Docker-based• Easy to use site administration• Fast site creation• Import / Export / Default Config Customizations

Page 14: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Learn WordPress Database

Two really good resources to learn the structure of where your files are stored; necessary when you’re doing migrations:

• Tour of the WordPress Database:https://deliciousbrains.com/tour-wordpress-database/

• Tour of the MultiSite WordPress Database:https://deliciousbrains.com/wordpress-multisite-database-tour/

• Learning phpMyAdmin & WordPress:http://www.wpbeginner.com/beginners-guide/beginners-guide-to-wordpress-database-management-with-phpmyadmin/

Page 15: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Learn WordPress File Structure

Specifically WP_CONTENTAll your primary files for your WordPress installationare in that directory:

/themes/ - all your theme files, active or not/plugins/ - all your plugins, active or not/uploads/ - All the Media filesSite Configuration in wp_config.php

https://codex.wordpress.org/WordPress_Files#wp-content

Page 16: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

MIGRATIONS

The File & Database are important, because

MINIMUM to copy a WordPress site:• wp_content/• wp_config.php (configured to connect to DB on new

Server)• MySQL SQL file imported into that Databasehttp://www.billerickson.net/migrating-wordpress-websites/

Page 17: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

MIGRATIONS

Automated Tools for Migrations:

BackupBuddy by iThemes

Handles initial Migration, not sure about ‘changes’

https://ithemes.com/purchase/backupbuddy/

Page 18: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

MIGRATIONS

WP Migrate DB &WP Migrate DB Pro

by Delicious Brains

Handles all Data migrations

with a PUSH/PULL technology

VERY Powerful!https://deliciousbrains.com/wp-migrate-db-pro/

Page 19: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

WP Migrate DB ProLocal REMOTE

Can also handle MEDIA filesand new version can handle MultiSite(subsites to single install & back)

Page 20: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Version Control with GIT

Incredibly powerful, but sometimes Incredibly complicated tool that can save your life (and the life of your project), if you know how to use it.LUCKILY….

http://wordpress.tv/2015/12/13/morten-rand-hendriksen-github-for-the-rest-of-us/http://mor10.com/github-wcus/

Page 21: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Git Tools

• GitHub Desktop (Mac & Windows)https://desktop.github.com/

• BitBucket / SourceTree (Mac & Windows)https://www.sourcetreeapp.com/

• Tower for Git (paid, Mac Only)https://www.git-tower.com/

• Additional Tutorials:https://www.codeschool.com/courses/try-githttps://confluence.atlassian.com/bitbucket/bitbucket-tutorials-teams-in-space-training-ground-755338051.html

Page 22: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Perfect Team

With GIT for Version control of my theme stuffand WP Migrate DB Pro to keep my Data in syncthe Cloud for my Graphic Filesand Local Development with Vagrant, I’m safe & effective

all disney images used without permission so don’t sue me

Page 23: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Desktop Server Workshop

Page 24: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Desktop Server Workshop

Desktop Server needs to be run with Supervisory Permissions (On Windows it should only ask the first time)

Page 25: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Desktop Server Workshop

Fires up your web services and database.

Page 26: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Desktop Server Workshop

Web & Database are running!

Page 27: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Desktop Server Workshop

Primary DesktopServer Menu

Page 28: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Desktop Server Workshop

Creating a New Local Web Server

Page 29: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Desktop Server Workshop

Using a Blueprint to Start Your New Server

Page 30: No More “Cowboy Coding”: A Best Practices Guide to Local Development & Migration

Desktop Server Workshop

When you click the “Sites” button