You are on page 1of 25

Introduction

• Hobbyist since 1997


• Professional since 2005
• Worked w/ LAMP & .NET Solutions
• Blog:
http://www.justincarmony.com/blog/
• Currently Full-Time Contractor &
Consultant
• Current Projects:
www.cevo.com www.datingdna.co
m
Questions for the Audience
• Have an “automated” system in
place?
• Using Source Control (git, svn)?
• Using Wiki, Bug Tracker, etc (Trac,
MediaWiki)?
• Who Thinks There is Room for
Improvement in their Current Setup?
Streamlining Web
Development
• Born out of Pure Necessity
• Time == Money, Do More, Make More
• Can Help All Types of Developers
– Single Developers
– Large Teams
• This is an Overview of Techniques
• Check out my blog for links, in-depth
The Development Cycle
• One Constant in Any Software
Development:
– Change!
• Our Goal: Manage Change Efficiently
• What is the Development Cycle?
The Development Cycle

“Chang
e”
Challenges with Web
Development
• Environment (Apache, IIS, Linux,
Windows)
• Dependencies (PHP, Perl, Ruby)
• Network (Domain Names, IP
Addresses, Etc)
• Configuration (Cache, Database, etc)
• Streamlined Solutions Need to
Address These Challenges
The “Old” Way
The “Old” Way
• Files on Server & Your Computer
• Upload via Changes Files (FTP)
• No Source Management
• Problems?
– Overwriting Files
– Manual Management
– Which Files Changed? Upload All?
– Who changed what? When?
– Prone to Errors, Bugs == Wasted Time
The “Automated” Way
• Goals:
– Least Amount of Human Intervention
– Fast & Quick
– Scripts & Automation Every Step of the
Way
– Allow to Quickly Revert
• Rewards:
– Save Time
– Quick “Micro” Changes
– Reduce Errors
Our Tools
• L.A.M.P. – Linux, Apache, MySQL, PHP
• SVN - Source control
• Trac – Wiki, Bug Tracker, Road Map,
Timeline
• Shell Scripts
Why Use SVN?
• Open Source
• Source History – Who, What, When,
Why
• Ensure “Collaboration”
• Built for the Development Cycle
• Tip: Everything in SVN
Why Use Trac?
• Opt-In Method
• Straight Forward, Easy
• Powerful Integrated Solution
• Plugins, Customizabled
• RSS Feeds & Queries
• Who is using? Propel, jQuery,
wxWidgets, trac-hacks, and many
more…
Basic Structure
• SVN Repository
• Trac
• “Dev” & “Staging” Servers
• Production Server
Basic Structure – Diagram
Setting Up the SVN
• Use Standard Structure
– /trunk , /branches , /tags , /resources
– Other Possible folders:
• /production
• /documentation
• Apache “mod_svn” to host repository
• Security using basic .htpasswd
Using the SVN
• Developers Checkout a Copy
• Code & Run Environment Locally
– XAMPP
– Virtual Machine (Sun’s VirtualBox, Open
Source)
• Test Locally
• Commit to SVN Repository
• Meaningful “Commits”
Development Server
• Setup Apache for a website
• Checkout a copy of “/trunk” for the
httpdocs
• Create post-commit svn hook
• Hook executes an “svn update” to
httpdocs
• Other Types of Hooks:
– start-commit – check permissions
– pre-commit – validate code (i.e. syntax
errors)
Development Server
Troubles
• Apache needs access to:
– R+W Httpdocs folder
– R+W SVN Repo
– Execute SVN Hooks
• Development Server NOT PUBLIC!
Deploying to Staging &
Production
• Use exact same methods for both
• Staging is for testing the “whole
picture.”
• Production Folder Method
– Pros
• Scripts More Simple
• Diff on production folder
• Less “tags” with micro changes
– Cons
• Merging can be a hassle
• Require “Freeze” on Trunk
Deploying to Staging &
Production
• Tagging Method
– Pros
• No “Freeze” on Trunk Needed
• Version Numbering
• Clear folders for each version
• More Control Over Tags
• Symbolic Link
– Cons
• Many Tags with Micro Changes
• More Complicated Scripts
Deployment Scripts
• Export vs Update
– Export copies files w/o SVN Info
– Export takes longer, doesn’t “delete” files
– Export is more robust, less likely to break
– Update can fail if conflicts occur on files
– Update for New, Export for Existing
• Set Permissions
• Test Scripts – Check Web Services,
Website, etc.
Show Stoppers &
Complications
• Website is hard coded for a domain:
– www.example.com, dev.example.com,
stage.example.com, local.example.com
• No “Configuration” files for DB, email,
cache, environment, paths, etc.
• User & Uploaded Content not
Separated
• Shared Hosting , No Shell Access
• Use the System, no half-and-half
• Careful of Revert & Permissions
Other Than Trac
• Redmine
– Ruby / Rails Based
– Multiple Projects Supported
– Gantt Graphs
• SharpForge
– C#, .NET Based
• MediaWiki, BugZilla, svnLogBrowser
Combo
– More Robust & Powerful
– Not Integrated
Final Thoughts
• Scales well – (example
www.cevo.com)
• Powerful with Apache
– Examples:
new_message_system.features.branches.dev.ce
vo.com
3_2_24.releases.tags.dev.cevo.com
• Multiple Backups
– SVN & Trac easy to Backup
• Any Questions?
• Live Demonstration…