We have three site instances, Site A, Site B and Site C

From LeonWiki!

Jump to: navigation, search
ORIGINAL APPROACH
We have three site instances, Site A, Site B and Site C. Site A is the development site, Site B is the staging site and Site C is the production site.
Initial Scenario
  1. Site C is constantly undergoing content additions/modifications (database changes), but should never have code changes.
  2. Site A is versioned under SVN.
  3. Site B's code is acquired via SVN UPDATE.
  4. An SQL export (symsolutions.com.sql) is performed on Site A (sym_dev), since A contains initial code/db. This file is put under version control.
  5. An svn update is performed on Site B and the symsolutions.com.sql file is imported to Site B's database (sym_staging).
  6. Site A and Site B are now identical in code and database.
Working Scenario
  1. Site C's content is being added to and/or modified.
  2. Site A is undergoing new/modified development.
  3. Some point in the future we want to update Site C with new development code/db contained in Site A.
NOTE: Joomlapack is not working so we are just doing a manual -- i.e. checkout to backup directory, strip .svn dirs, zip up
  • Perform a joomlapack backup of Site C. (this is easier than ftp'ing all the code and exporting from the db)
  • Commit Site A's new/modified code to repository.
  • Perform a joomlapack backup of Site A. (This is a precaution against anything going awry)
  • Unzip and install Site C's joomlapack backup to a tmp instance (call it Site D with database = sym_tmp) on the development machine.
  • We want to merge Site C's changes to Site A. To do this we export Site C's database to a file (call it symsolutions.prod.sql). Perform the merge (using any merge tool like WinMerge) from symsolutions.prod.sql to Site A's versioned symsolutions.sql file. Now Site A and Site C's databases are synchronized in symsolutions.sql
  • Import Site A's symsolutions.sql to A's database (sym_dev)
  • Overlay Site D's code on Site A. (NOTE: DO NOT OVERLAY the configuration.php file that is located in the Site's root directory since this file contains site specific information such as Home URL, database name, and tmp directories used for uploading.)
  • Test Site A to make sure all is well with both Site A's new code and Site C's content changes.
  • If Site A is ok, commit code and symsolutions.sql to repository.
  • Update Site B with new code and perform an import of Site B's symsolutions.sql to sym_staging (remember: symsolutions.sql is versioned as well so we have the updated database) -- NOTE: before a zip file is created for Site C (most likely from Site B), all .svn folders must be deleted. (just because they double the size of the zip file.)
  • Now Site B should have both Site C's content changes and Site A's new additions/modifications.
  • TEST THOROUGHLY
  • If something doesn't work we go back to Site A and make the changes. WE NEVER merge back to Site A from Site B! Always go from Site C to Site D To Site A to Site B and then back to Site C. Site B is ONLY for testing the final snapshot before uploading merged code/db to Site C.
  • Now that everything has been verified as correct on Site B, do a joomlapack backup of Site B and upload/install on Site C.
  • NOTE: Unfortunately since joomlapack needs to function under a valid site (we need joomlapack because it automagically creates an installation directory that allows browser-based installation), we need to do a joomlapack backup with the .svn directories embedded. This makes the joomlapack backup function more slowly (it also doubles the size), but it's worth the cost. Once we have the joomlapack backup zip file we just explode it to a tmp directory somewhere, strip the directories using the following syntax from a command line: find . -name \.svn -exec rm -rf {} \; from the root of the directory that you want to cleanse. Zip up the remaining directories/files and that is the zip file that gets ftp'd to Site C.
  • Now do a normal install on Site C.
  • We're done!
Test Plan
  1. Testing versioning/merging of source and target test sites.
  • Install a test_dev and a test_staging site. Test_dev will mimick dev and test_staging will mimick staging.
  • Test_dev has test_dev database and test_staging has test_staging database.
  • Import code from test_staging to svn test repo.
  • Add components (don't care which) on test_dev.
  • Make some mods to existing components
  • Perform a merge replace with source=dev target=staging
Personal tools
Alchemy Software, Inc.
Alchemy Software Website