Skip to content

Cookbook release cycle

damiencorpataux edited this page Aug 22, 2013 · 10 revisions

How to apply release cycle

Version management

Scheme: x.y.z (eg. 1.0.0)

  • x: Major version: Updated on: Major architecture/conceptual change leading to incompatibilities
  • y: Minor version: Updated on: Feature addition, modification, removal
  • z: Subminor version: Updated on: Hotfixes

Release steps

  1. Create git branches for features, eg feature-#128-reporting
  2. Develop
  3. Create a git branch named release-x.y.z
  4. Merge the feature branches into the release branch
  5. Test your release branch (with migration) on http://wwwfbm/iafbm_release
  6. Notify users to test the release and wait for validation
  7. Test one last time the features and migration on http://wwwfbm/iafbm_release with production data
  8. Merge release branch into master
  9. Tag the master branch with actual version as label: x.y.z
  10. Update and migrate production instance http://wwwfbm/iafbm
  11. Delete features and release branches

Command-line details

Feature development (new feature, modification or bugfix)

  • Create a branch for the feature
git checkout -b new_feature
  • Develop, add/move/remove files, commit files, ...
git add/mv/rm [files]
git commit -m"Message" [files]
  • Pull master branch modifications into development branch
git checkout master
git pull
  • Rebase to master branch to merge master commits with development branch,
    resolving potentially arising conflicts
git checkout new_feature
git rebase master
  • Merge development branch into master branch (locally)
git checkout master
git merge new_feature
  • Push the (locally) merged master branch into remote repository
git push origin master

Source: http://ariejan.net/2009/06/08/best-practice-the-git-development-cycle

Creating a production Release

  • Update the project in iafbm_test environment
cd iafbm_test/iafbm/scripts
php update.php -u -x
  • Run the UnitTests
cd iafbm_test/iafbm/tests
php phpunit.php .
  • Validate the application quality
  • Create a tag in the master branch with the release version
git tag -a 1.0.0
git push --tags
  • Update the project in iafbm_prod environment

Migrating the database

  • Once your SQL files are updated and your migration(s) script(s) are created
  • Change directory to a the instance of the application
    (eg. your local instance or release instance for testing, or the production instance when testing is complete)
cd /var/www/iafbm
  • Make sure you are on the up-to-date master branch (eg. the production branch)
git checkout master
git pull
  • Test the migration using the basic database:
# Rebuild the database according the master branch structure
cd scripts
php update -x
# Checkout your release branch
git checkout release-{x}.{y}.{z}
# Run the migration script
cd migration
php {your-migration-script-here}.php
  • Test the application and run the unittests
cd /path/to/iafbm
cd unittests
php phpunit.php units
  • Now test the migration using the production data
# Retrieve a production database dump
# Dump production database into file
ssh iafbm@wwwfbm mysqldump -uiafbm_prod -p iafbm_prod > iafbm_prod.sql
# Import production database into testing database
mysql -u{user} -p iafbm_prod < iafbm_prod.sql
# Delete dump for privacy concerns
rm iafbm_prod.sql
  • Test the application again and run the unittests
cd /path/to/iafbm
cd unittests
php phpunit.php units
  • Update the production instance
    */!* Make sure you have thoroughfully tested the deployment on the release instance first
# Merge your release branch into the master branch first
git checkout master
git pull
git merge release-{x}.{y}.{z}
git tag -a {x}.{y}.{z} -m '{your release message}'
git push
git push origin --tags

# Update the production instance
ssh iafbm@wwwfbm
# Backup the data first
mysqldump -uiafbm_prod -p iafbm_prod > iafbm_prod-`date +"%Y-%m-%d"`.sql
# Update and migrate
cd prod/iafbm
git pull
cd scripts/migrations
php {your-migration-script}.php # you might have multiple migration scripts to run
  • Test the production application again and run the unittests
cd ~
cd prod/iafbm/unittests
php phpunit.php units

Bibliography