Configuring WordPress for         Multiple Environments#WCChicago 7/30 - 7/31/11
Who am I?      Jason McCreary      jmccreary@viastudio.com      @gonedark      •   Louisville, KY      •   Production Lead...
Who are you?#WCChicago 7/30 - 7/31/11
Who are you?        • How many people...#WCChicago 7/30 - 7/31/11
Who are you?        • How many people...         • Use WordPress?#WCChicago 7/30 - 7/31/11
Who are you?        • How many people...         • Use WordPress?         • Responsible for managing your install?#WCChica...
Who are you?        • How many people...         • Use WordPress?         • Responsible for managing your install?        ...
Who are you?        • How many people...         • Use WordPress?         • Responsible for managing your install?        ...
The Talk#WCChicago 7/30 - 7/31/11
The Talk        • Configuring WordPress for Multiple Environments#WCChicago 7/30 - 7/31/11
The Talk        • Configuring WordPress for Multiple Environments        • It’s not that advanced, really!#WCChicago 7/30 -...
The Talk        • Configuring WordPress for Multiple Environments        • It’s not that advanced, really!        • Examine...
The Talk        • Configuring WordPress for Multiple Environments        • It’s not that advanced, really!        • Examine...
The Talk        • Configuring WordPress for Multiple Environments        • It’s not that advanced, really!        • Examine...
The Talk        • Configuring WordPress for Multiple Environments        • It’s not that advanced, really!        • Examine...
“We have to be careful [...] people might think       WordPress is a real CMS, useful for more than just                  ...
“We have to be careful [...] people might think       WordPress is a real CMS, useful for more than just                  ...
“We have to be careful [...] people might think       WordPress is a real CMS, useful for more than just                  ...
“Any serious development project should follow a        software development lifecycle.This implies source       code mana...
“Any serious development project should follow a        software development lifecycle.This implies source       code mana...
Demo: 5 minute install...#WCChicago 7/30 - 7/31/11
#WCChicago 7/30 - 7/31/11
#WCChicago 7/30 - 7/31/11
• We setup WordPress for one environment...#WCChicago 7/30 - 7/31/11
• We setup WordPress for one environment...        • But I have other environments...#WCChicago 7/30 - 7/31/11
• We setup WordPress for one environment...        • But I have other environments...        • Do I have to do the install...
• We setup WordPress for one environment...        • But I have other environments...        • Do I have to do the install...
• We setup WordPress for one environment...        • But I have other environments...        • Do I have to do the install...
Multiple Environments#WCChicago 7/30 - 7/31/11
Multiple Environments#WCChicago 7/30 - 7/31/11
Multiple Environments               }   Production         StagingDevelopment #WCChicago 7/30 - 7/31/11
Multiple Environments               }{   Production         StagingDevelopment #WCChicago 7/30 - 7/31/11
Multiple Environments               }{   Production         StagingDevelopment #WCChicago 7/30 - 7/31/11   Version Control
Multiple Environments               }{   Production         StagingDevelopment #WCChicago 7/30 - 7/31/11   wp-config   Vers...
Multiple Environments               }{   Production         StagingDevelopment #WCChicago 7/30 - 7/31/11   wp-config   Vers...
Multiple Environments               }{   Production         StagingDevelopment #WCChicago 7/30 - 7/31/11   wp-config   Vers...
Multiple Environments               }{   Production         StagingDevelopment #WCChicago 7/30 - 7/31/11   wp-config   Vers...
Database Configuration#WCChicago 7/30 - 7/31/11
Database Configuration         // MySQL settings         /** The name of the database for WordPress */         define(DB_NA...
Database Configuration         // MySQL settings         /** The name of the database for WordPress */         define(DB_NA...
Demo: wp-config-env.php#WCChicago 7/30 - 7/31/11
What have we done...#WCChicago 7/30 - 7/31/11
What have we done...            By sniffing out the runtime environment we’ve             extended wp-config.php with a confi...
“As part of the WordPress installation, you must           modify the wp-config.php file to define the               WordPres...
“As part of the WordPress installation, you must           modify the wp-config.php file to define the               WordPres...
Development#WCChicago 7/30 - 7/31/11
Development        • CONSTANTS for environment awareness#WCChicago 7/30 - 7/31/11
Development        • CONSTANTS for environment awareness /** wp-config-dev.php **/ // used to determine environment from e...
Development        • CONSTANTS for environment awareness /** wp-config-dev.php **/ // used to determine environment from e...
Development        • CONSTANTS for environment awareness /** wp-config-dev.php **/ // used to determine environment from e...
Demo: Development#WCChicago 7/30 - 7/31/11
Deployment#WCChicago 7/30 - 7/31/11
Deployment        •   Database#WCChicago 7/30 - 7/31/11
Deployment        •   Database            •   mysqldump entire database#WCChicago 7/30 - 7/31/11
Deployment        •   Database            •   mysqldump entire database            •   WordPress Import/Export#WCChicago 7...
Deployment        •   Database            •   mysqldump entire database            •   WordPress Import/Export        •   ...
Deployment        •   Database            •   mysqldump entire database            •   WordPress Import/Export        •   ...
Deployment        •   Database            •   mysqldump entire database            •   WordPress Import/Export        •   ...
Deployment        •   Database            •   mysqldump entire database            •   WordPress Import/Export        •   ...
Deployment        •   Database            •   mysqldump entire database            •   WordPress Import/Export        •   ...
Other Tips#WCChicago 7/30 - 7/31/11
Other Tips        • Avoid absolute paths#WCChicago 7/30 - 7/31/11
Other Tips        • Avoid absolute paths        • Use symlinks for shared directories (e.g.            uploads/)#WCChicago...
Other Tips        • Avoid absolute paths        • Use symlinks for shared directories (e.g.            uploads/)        • ...
Other Tips        • Avoid absolute paths        • Use symlinks for shared directories (e.g.            uploads/)        • ...
Other Tips        • Avoid absolute paths        • Use symlinks for shared directories (e.g.            uploads/)        • ...
The Process#WCChicago 7/30 - 7/31/11
The Process        1. Do the 5 minute production install#WCChicago 7/30 - 7/31/11
The Process        1. Do the 5 minute production install        2. Include environment specific wp-config.php#WCChicago 7/30...
The Process        1. Do the 5 minute production install        2. Include environment specific wp-config.php        3. Setu...
The Process        1. Do the 5 minute production install        2. Include environment specific wp-config.php        3. Setu...
The Process        1. Do the 5 minute production install        2. Include environment specific wp-config.php        3. Setu...
The Process        1. Do the 5 minute production install        2. Include environment specific wp-config.php        3. Setu...
Questions#WCChicago 7/30 - 7/31/11
Upcoming SlideShare
Loading in...5
×

Configuring WordPress for Multiple Environments

2,070

Published on

Slides from the talk given at WordCamp Chicago 2011.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,070
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

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
  • Configuring WordPress for Multiple Environments

    1. 1. Configuring WordPress for Multiple Environments#WCChicago 7/30 - 7/31/11
    2. 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. 3. Who are you?#WCChicago 7/30 - 7/31/11
    4. 4. Who are you? • How many people...#WCChicago 7/30 - 7/31/11
    5. 5. Who are you? • How many people... • Use WordPress?#WCChicago 7/30 - 7/31/11
    6. 6. Who are you? • How many people... • Use WordPress? • Responsible for managing your install?#WCChicago 7/30 - 7/31/11
    7. 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. 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. 9. The Talk#WCChicago 7/30 - 7/31/11
    10. 10. The Talk • Configuring WordPress for Multiple Environments#WCChicago 7/30 - 7/31/11
    11. 11. The Talk • Configuring WordPress for Multiple Environments • It’s not that advanced, really!#WCChicago 7/30 - 7/31/11
    12. 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. 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. 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. 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. 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. 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. 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. 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. 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. 21. Demo: 5 minute install...#WCChicago 7/30 - 7/31/11
    22. 22. #WCChicago 7/30 - 7/31/11
    23. 23. #WCChicago 7/30 - 7/31/11
    24. 24. • We setup WordPress for one environment...#WCChicago 7/30 - 7/31/11
    25. 25. • We setup WordPress for one environment... • But I have other environments...#WCChicago 7/30 - 7/31/11
    26. 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. 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. 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. 29. Multiple Environments#WCChicago 7/30 - 7/31/11
    30. 30. Multiple Environments#WCChicago 7/30 - 7/31/11
    31. 31. Multiple Environments } Production StagingDevelopment #WCChicago 7/30 - 7/31/11
    32. 32. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11
    33. 33. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11 Version Control
    34. 34. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11 wp-config Version Control
    35. 35. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11 wp-config Version Control
    36. 36. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11 wp-config Version Control
    37. 37. Multiple Environments }{ Production StagingDevelopment #WCChicago 7/30 - 7/31/11 wp-config Version Control
    38. 38. Database Configuration#WCChicago 7/30 - 7/31/11
    39. 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. 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. 41. Demo: wp-config-env.php#WCChicago 7/30 - 7/31/11
    42. 42. What have we done...#WCChicago 7/30 - 7/31/11
    43. 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. 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. 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. 46. Development#WCChicago 7/30 - 7/31/11
    47. 47. Development • CONSTANTS for environment awareness#WCChicago 7/30 - 7/31/11
    48. 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. 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. 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. 51. Demo: Development#WCChicago 7/30 - 7/31/11
    52. 52. Deployment#WCChicago 7/30 - 7/31/11
    53. 53. Deployment • Database#WCChicago 7/30 - 7/31/11
    54. 54. Deployment • Database • mysqldump entire database#WCChicago 7/30 - 7/31/11
    55. 55. Deployment • Database • mysqldump entire database • WordPress Import/Export#WCChicago 7/30 - 7/31/11
    56. 56. Deployment • Database • mysqldump entire database • WordPress Import/Export • WordPress Files#WCChicago 7/30 - 7/31/11
    57. 57. Deployment • Database • mysqldump entire database • WordPress Import/Export • WordPress Files • Version Control (SVN, Git, etc)#WCChicago 7/30 - 7/31/11
    58. 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. 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. 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. 61. Other Tips#WCChicago 7/30 - 7/31/11
    62. 62. Other Tips • Avoid absolute paths#WCChicago 7/30 - 7/31/11
    63. 63. Other Tips • Avoid absolute paths • Use symlinks for shared directories (e.g. uploads/)#WCChicago 7/30 - 7/31/11
    64. 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. 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. 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. 67. The Process#WCChicago 7/30 - 7/31/11
    68. 68. The Process 1. Do the 5 minute production install#WCChicago 7/30 - 7/31/11
    69. 69. The Process 1. Do the 5 minute production install 2. Include environment specific wp-config.php#WCChicago 7/30 - 7/31/11
    70. 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. 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. 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. 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. 74. Questions#WCChicago 7/30 - 7/31/11

    ×