Configuring WordPress for Multiple Environments

  • 1,935 views
Uploaded on

Slides from the talk given at WordCamp Chicago 2011.

Slides from the talk given at WordCamp Chicago 2011.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,935
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • Environments\nSingle WordPress Install\nSeparate Files, managed with SVN\napache vhosts\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Transcript

  • 1. Configuring WordPress for Multiple Environments#WCChicago 7/30 - 7/31/11
  • 2. Who am I? Jason McCreary jmccreary@viastudio.com @gonedark • Louisville, KY • Production Lead at VIA Studio • Web Developer since 1999 • PHP since version 3 • Active StackOverflow member • http://jason.pureconcepts.net (shhh! It’s not WordPress, yet...)#WCChicago 7/30 - 7/31/11
  • 3. Who are you?#WCChicago 7/30 - 7/31/11
  • 4. Who are you? • How many people...#WCChicago 7/30 - 7/31/11
  • 5. Who are you? • How many people... • Use WordPress?#WCChicago 7/30 - 7/31/11
  • 6. Who are you? • How many people... • Use WordPress? • Responsible for managing your install?#WCChicago 7/30 - 7/31/11
  • 7. Who are you? • How many people... • Use WordPress? • Responsible for managing your install? • Use a development or test environment?#WCChicago 7/30 - 7/31/11
  • 8. Who are you? • How many people... • Use WordPress? • Responsible for managing your install? • Use a development or test environment? • WordPress in a distributed enviroment?#WCChicago 7/30 - 7/31/11
  • 9. The Talk#WCChicago 7/30 - 7/31/11
  • 10. The Talk • Configuring WordPress for Multiple Environments#WCChicago 7/30 - 7/31/11
  • 11. The Talk • Configuring WordPress for Multiple Environments • It’s not that advanced, really!#WCChicago 7/30 - 7/31/11
  • 12. The Talk • Configuring WordPress for Multiple Environments • It’s not that advanced, really! • Examine WordPress component parts#WCChicago 7/30 - 7/31/11
  • 13. The Talk • Configuring WordPress for Multiple Environments • It’s not that advanced, really! • Examine WordPress component parts • Some slides#WCChicago 7/30 - 7/31/11
  • 14. The Talk • Configuring WordPress for Multiple Environments • It’s not that advanced, really! • Examine WordPress component parts • Some slides • Some demos#WCChicago 7/30 - 7/31/11
  • 15. The Talk • Configuring WordPress for Multiple Environments • It’s not that advanced, really! • Examine WordPress component parts • Some slides • Some demos • Please ask questions#WCChicago 7/30 - 7/31/11
  • 16. “We have to be careful [...] people might think WordPress is a real CMS, useful for more than just a blog.”#WCChicago 7/30 - 7/31/11
  • 17. “We have to be careful [...] people might think WordPress is a real CMS, useful for more than just a blog.” Matt Mullenburg WordPress Wins CMS Award#WCChicago 7/30 - 7/31/11
  • 18. “We have to be careful [...] people might think WordPress is a real CMS, useful for more than just a blog.” Matt Mullenburg WordPress Wins CMS Award “[...] instances of the phrase ‘WordPress blog’ are gone from the core source files, replaced with the all-encompassing phrase ‘WordPress site.’” Andrew Nacin Changeset 14315#WCChicago 7/30 - 7/31/11
  • 19. “Any serious development project should follow a software development lifecycle.This implies source code management and at least a development and production environment. Unfortunately WordPress doesn’t really scale well in this area out of the box.”#WCChicago 7/30 - 7/31/11
  • 20. “Any serious development project should follow a software development lifecycle.This implies source code management and at least a development and production environment. Unfortunately WordPress doesn’t really scale well in this area out of the box.” Jason McCreary http://bit.ly/r8jFm3#WCChicago 7/30 - 7/31/11
  • 21. Demo: 5 minute install...#WCChicago 7/30 - 7/31/11
  • 22. #WCChicago 7/30 - 7/31/11
  • 23. #WCChicago 7/30 - 7/31/11
  • 24. • We setup WordPress for one environment...#WCChicago 7/30 - 7/31/11
  • 25. • We setup WordPress for one environment... • But I have other environments...#WCChicago 7/30 - 7/31/11
  • 26. • We setup WordPress for one environment... • But I have other environments... • Do I have to do the install again?#WCChicago 7/30 - 7/31/11
  • 27. • We setup WordPress for one environment... • But I have other environments... • Do I have to do the install again? • What happens after install?#WCChicago 7/30 - 7/31/11
  • 28. • We setup WordPress for one environment... • But I have other environments... • Do I have to do the install again? • What happens after install? • I’m confused...#WCChicago 7/30 - 7/31/11
  • 29. Multiple Environments#WCChicago 7/30 - 7/31/11
  • 30. Multiple Environments#WCChicago 7/30 - 7/31/11
  • 31. Multiple Environments } Production StagingDevelopment #WCChicago 7/30 - 7/31/11
  • 32. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11
  • 33. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11 Version Control
  • 34. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11 wp-config Version Control
  • 35. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11 wp-config Version Control
  • 36. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11 wp-config Version Control
  • 37. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11 wp-config Version Control
  • 38. Database Configuration#WCChicago 7/30 - 7/31/11
  • 39. Database Configuration // MySQL settings /** The name of the database for WordPress */ define(DB_NAME, database_name_dev); /** MySQL database username */ define(DB_USER, dbuser); /** MySQL database password */ define(DB_PASSWORD, dbpass); /** MySQL hostname */ define(DB_HOST, localhost);#WCChicago 7/30 - 7/31/11
  • 40. Database Configuration // MySQL settings /** The name of the database for WordPress */ define(DB_NAME, database_name_dev); /** MySQL database username */ define(DB_USER, dbuser); /** MySQL database password */ define(DB_PASSWORD, dbpass); /** MySQL hostname */ define(DB_HOST, localhost);#WCChicago 7/30 - 7/31/11
  • 41. Demo: wp-config-env.php#WCChicago 7/30 - 7/31/11
  • 42. What have we done...#WCChicago 7/30 - 7/31/11
  • 43. What have we done... By sniffing out the runtime environment we’ve extended wp-config.php with a configuration specific for that environment. This allows us to run a production-ready WordPress install smoothly on multiple, different environments.#WCChicago 7/30 - 7/31/11
  • 44. “As part of the WordPress installation, you must modify the wp-config.php file to define the WordPress configuration settings...”#WCChicago 7/30 - 7/31/11
  • 45. “As part of the WordPress installation, you must modify the wp-config.php file to define the WordPress configuration settings...” Codex#WCChicago 7/30 - 7/31/11
  • 46. Development#WCChicago 7/30 - 7/31/11
  • 47. Development • CONSTANTS for environment awareness#WCChicago 7/30 - 7/31/11
  • 48. Development • CONSTANTS for environment awareness /** wp-config-dev.php **/ // used to determine environment from easily accessible constant define(VIA_ENVIRONMENT, dev);#WCChicago 7/30 - 7/31/11
  • 49. Development • CONSTANTS for environment awareness /** wp-config-dev.php **/ // used to determine environment from easily accessible constant define(VIA_ENVIRONMENT, dev); • Configuring Plugins#WCChicago 7/30 - 7/31/11
  • 50. Development • CONSTANTS for environment awareness /** wp-config-dev.php **/ // used to determine environment from easily accessible constant define(VIA_ENVIRONMENT, dev); • Configuring Plugins /** wp-config-prod.php **/ // turn on caching define(WP_CACHE, true);#WCChicago 7/30 - 7/31/11
  • 51. Demo: Development#WCChicago 7/30 - 7/31/11
  • 52. Deployment#WCChicago 7/30 - 7/31/11
  • 53. Deployment • Database#WCChicago 7/30 - 7/31/11
  • 54. Deployment • Database • mysqldump entire database#WCChicago 7/30 - 7/31/11
  • 55. Deployment • Database • mysqldump entire database • WordPress Import/Export#WCChicago 7/30 - 7/31/11
  • 56. Deployment • Database • mysqldump entire database • WordPress Import/Export • WordPress Files#WCChicago 7/30 - 7/31/11
  • 57. Deployment • Database • mysqldump entire database • WordPress Import/Export • WordPress Files • Version Control (SVN, Git, etc)#WCChicago 7/30 - 7/31/11
  • 58. Deployment • Database • mysqldump entire database • WordPress Import/Export • WordPress Files • Version Control (SVN, Git, etc) • FTP sFTP/SSH#WCChicago 7/30 - 7/31/11
  • 59. Deployment • Database • mysqldump entire database • WordPress Import/Export • WordPress Files • Version Control (SVN, Git, etc) • FTP sFTP/SSH • Resource Files#WCChicago 7/30 - 7/31/11
  • 60. Deployment • Database • mysqldump entire database • WordPress Import/Export • WordPress Files • Version Control (SVN, Git, etc) • FTP sFTP/SSH • Resource Files • FTP sFTP/SSH#WCChicago 7/30 - 7/31/11
  • 61. Other Tips#WCChicago 7/30 - 7/31/11
  • 62. Other Tips • Avoid absolute paths#WCChicago 7/30 - 7/31/11
  • 63. Other Tips • Avoid absolute paths • Use symlinks for shared directories (e.g. uploads/)#WCChicago 7/30 - 7/31/11
  • 64. Other Tips • Avoid absolute paths • Use symlinks for shared directories (e.g. uploads/) • Just move what you need (e.g. wp_posts)#WCChicago 7/30 - 7/31/11
  • 65. Other Tips • Avoid absolute paths • Use symlinks for shared directories (e.g. uploads/) • Just move what you need (e.g. wp_posts) • Don’t forget your environment constant (e.g. VIA_ENVIRONMENT)#WCChicago 7/30 - 7/31/11
  • 66. Other Tips • Avoid absolute paths • Use symlinks for shared directories (e.g. uploads/) • Just move what you need (e.g. wp_posts) • Don’t forget your environment constant (e.g. VIA_ENVIRONMENT) • Migration scripts are your friend#WCChicago 7/30 - 7/31/11
  • 67. The Process#WCChicago 7/30 - 7/31/11
  • 68. The Process 1. Do the 5 minute production install#WCChicago 7/30 - 7/31/11
  • 69. The Process 1. Do the 5 minute production install 2. Include environment specific wp-config.php#WCChicago 7/30 - 7/31/11
  • 70. The Process 1. Do the 5 minute production install 2. Include environment specific wp-config.php 3. Setup your environments#WCChicago 7/30 - 7/31/11
  • 71. The Process 1. Do the 5 minute production install 2. Include environment specific wp-config.php 3. Setup your environments 4. Develop#WCChicago 7/30 - 7/31/11
  • 72. The Process 1. Do the 5 minute production install 2. Include environment specific wp-config.php 3. Setup your environments 4. Develop 5. Deploy#WCChicago 7/30 - 7/31/11
  • 73. The Process 1. Do the 5 minute production install 2. Include environment specific wp-config.php 3. Setup your environments 4. Develop 5. Deploy 6. Repeat 4 and 5#WCChicago 7/30 - 7/31/11
  • 74. Questions#WCChicago 7/30 - 7/31/11