Developing Easily Deployable PHP Applications
John Mertic
SugarCRM
@2010 SugarCRM Inc. All rights reserved.
Why deployable apps still matter
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 2
What I’ll cover
Code portabilityPerformanceConfiguration and CustomizationTesting/QA
@2010 SugarCRM Inc. All rights reserved.7/22/2010 3
Code Portability
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 4
Source: http://www.flickr.com/photos/25339258@N05/2389910825/
What we do
Limit support to the most common configurationsAs of SugarCRM 6.0 we officially support:
Operating System– Windows XP, 2003, 2008, Vista– Red Hat 4.x, 5.x– Oracle Enterprise Linux 5.1– CentOS 4.x, 5.x
Web Server– Apache 1.3, 2.0, 2.2– IIS 6/7 using FastCGI
Database– MySQL 5.0, 5.1– SQL Server 2005, 2008– Oracle 9i, 10g
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 5
@2010 SugarCRM Inc. All rights reserved. 6
What we do (cont)
PHP Support Matrix5.2.1 - 5.2.6, 5.2.8 - 5.2.13, 5.3.0 - 5.3.2Support most common configurations options
mbstring.func_overload = 7error_reporting = E_ALL
Require only the most mainline extensions, plusMbstrings ( for i18n support )Imap ( if using mail support )Specific database extension ( mysql, mysqli, oci8, mssql, sqlsrv )
7/22/2010
Build and Deploy
We build all 3 editions of SugarCRM from 1 codebase
We add code tags around sections specific to a certain version.
To test under each different edition, developers can run the build locally
Removes code not belonging to the given editionAdd appropriate license headers
Each check-in triggers a lint check and unit test run against each edition across different platforms.We run nightly builds to run functional tests and to send to QA for manual testing.
SODA / SodaMachine – tool to easily write functional tests that run under Watir.
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 7
Performance
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 8
Source: http://www.flickr.com/photos/tech1987/501427718/
What we do to help performance
Caching, and lots of itSmarty template cachingData caching
Combine, minify, and version JS / CSS / imagesKeep SQL queries as simple as possibleProvide configuration options to turn off heavy featuresEnable the application to take advantage of it’s environment
Examples:Use APC, memcache, Zend_Cache, wincache with little to no configurationLeverage a slave database for heavy queriesDetect Full Text Indexing on SQL ServerDetect for certain PHP extensions being enabled.
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 9
How we gauge performance
Formal testingUse Jmeter (http://jakarta.apache.org/jmeter/) on a load test cluster to test raw response speed.
MeterMaid / SugarMMM – open source tool we created to make writing tests easierTidBit – open source tool we created to make huge datasets
Instance analysisMonitor web server logs to look for non-cached itemsTrack slow queries
Ad-hoc testingProfile PHP execution with XDebugUse Firebug to measure CSS / JS / image payload
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 10
Configuration and Customization
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 11
Source: http://www.flickr.com/photos/miskypig/400004362/
Making it simple yet powerful for end users
Expose configuration options thru multiple channels
Remember, not everyone has source access
Allow users to customize their UI interface easilyMake what should be simple, simple
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 12
Making it simple yet powerful for developers
Create a safe place to make customizations
Avoid painful upgradesCreate an easy to use API
Well defined and supported.Don’t break it!
Create easy to use hooks for modifying existing / adding new functionality
Examples from SugarCRM include:Metadata driven viewsLogic Hooks
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 13
Testing/QA
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 14
Source: http://www.flickr.com/photos/cglock/386033158/
Testing different configurations
Impossible for us to test every single permutation.We use VM stacks; for SugarCRM 6, we use
Windows Vista IIS-7 (FastCGI) PHP 5.2.8 MSSQL-2005 (PHP mssql driver) Windows Server 2003 IIS-6 (FastCGI) PHP 5.2.11 MSSQL-2005 (PHP mssql driver) CentOS 5 Apache-2.2.11 PHP 5.2.9 MySQL-5.1.33 Windows Server 2008 IIS-7 (FastCGI) PHP 5.3.1 MSSQL-2008 (Microsoft sqlsrv driver 1.1) Windows XP Apache-1.3.41 PHP 5.2.13 MySQL-5.0.83Oracle Enterprise Linux 5.1 Apache-2.0.63 PHP 5.3.2 ORCL-10g
We test both new installations and upgrade scenariosEven customer instances!
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 15
About me and my company
John Mertichttp://jmertic.wordpress.comTwitter: @[email protected] ( Work )[email protected] ( PHP )Slides available on slideshare http://bit.ly/a7NOR1
SugarCRMhttp://www.sugarcrm.comWe’re hiring!Learn more about SugarCRM’s open source tools at http://developers.sugarcrm.com/opensource
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 16
Buy my book!
Questions?
Thanks for coming!
7/22/2010 @2010 SugarCRM Inc. All rights reserved. 17
Recommended