Category Archives: Development

cbdb and TrackStar (and WordPress)

I’ve now spent some time with cbdb, and thought I’d share getting it running, and my takeaway from reviewing TrackStar and cbdb features (after that, it’s time to check in with Larry and see what tricks CMS is up to). First though are some comments on WordPress.

WordPress

I thought I’d include comments on WordPress, since I’m consolidating my personal content using WordPress.

  • WP has a nice plugin management system, with plugin’s automatically adding themselves into the application’s admin menu structure (or Dashboard).
  • If a WP module uses roles role-based authorization, the roles are managed using the plugin’s menu – or at least that’s how the NextGEN gallery plugin does it. Achievo has a single security profiles system that combines the privileges from each module (i.e. the actions that the role controls access to) onto a single role management page. To be honest, I’ve only ever used the system, but the privileges are grouped by module, and are a combination of basic CRUD actions that can be performed on a business object, with some extras.  My preference is the Achievo approach, with all the permission for a role managed in one place (so far, cbdb’s rbac seems close enough).
  • I like how NextGEN handles image uploading (a choice between a drag and drop interface or an Explorer-style interface fr uploading files, multi-file select in the Explorer-style interface, support for uploading zip image archives, and an upload progress bar). Similar functionality would work for uploading files in Maestro.

cbdb

  • The views generally show raw data, rather than user-oriented information (e.g. type, signed, grade …), and only the create/update form shows user-oriented data (a dropdown selector for Type and Grade, and radio buttons for Signed, Bagged and Collectable). TrackStar polishes things off a bit better in this area.
  • I like that the menu system for cbdb is created early in the development process compared to TrackStar, but the menu colors don’t work for me. I don’t agree that hiding menus a user isn’t authorized to use is good practice, and believe it actually leads to more confusion when users don’t understand why they don’t have have different menus presented, and prefer a static menu (greying-out menus that the user doesn’t have the authority to use, or showing the menu with data but greying-out the Edit or Save button).
  • The calendar wizard to enter dates looks nice, but it’s missing buttons to move between years (although I suspect it can be configured).

TrackStar

  • User management hasn’t been fleshed out as well as in cbdb, in particular not being able to view a list of users associated with a project.

ATK / Achievo Update

I’ve committed to the Yii framework now for building Maestro (check Maestro posts for more information). I’m not following the rss feed from the Achievo forum anymore, and I’ve removed (sigh…) the Achievo/ATK menu from my website so as to not mislead anyone as to my involvement. However, Achievo’s features and simple user and administrator interface are still unrivaled in an open source app of its type, and Maestro will be strongly influenced by Achievo.

In case the information is still of benefit to anyone, here’s the content from the static Achievo/ATK menu page.

- dale

Achievo / ATK

Achievo is a web-based Business Support Services (BSS) application for organizations, built using the ATK Framework and licensed under the GPL. Achievo was originally developed by iBuildings, but is transitioning to community leadership. Achievo includes a rich set of core modules, including support for employees, projects (phases and activities), timesheets, organizations, contacts, CRM (customers, campaings and contracts), and document management. There are a wide variety of Add-on modules available for additional functionality, and you can add or develop Custom modules for more more specific requirements. Achievo is stable and suitable for production.

The ATK framework is a special purpose PHP framework targeted at business applications. It allows database-type applications to be build quickly and with very small amounts of code. Its focus on business features makes it an excellent framework for HRM, CRM, data management and CMS type applications. The ATK framework was originaly developed by iBuildings, but is transitioning to community leadership. The ATK Framework is stable and suitable for production.

Adapto is a new project led by Ivo Jansch, who conceived Achievo and the ATK framework, to re-implement the concepts proven in the ATK framework to the next level, concentrating on easy to use CRUD functionality for relational databases and other data sources with only a few lines of code, and using the Zend Framework (v2) for caching, view rendering, database connectivity, etc..

 

Getting TrackStar running on Windows/XAMPP and FreeBSD

I’m learning Yii and worked through getting TrackStar (from Web Application Development with Yii and PHP) running locally on Windows/XAMPP, and then on FreeBSD. The trickiest part was getting the trackstar/.htaccess file to correctly hide index.php.

FWIW, I’ve also started experimenting with cbdb (Comic Book DataBase, from Yii Rapid Application Development Hotshot), and will get to CMS next (from The Yii Book). My selfish goal is to use all the applicable features to bootstrap Maestro development (and yes, I did actually purchase them all!).

I started with a zip download of the full TrackStar app from Jeff Winesett’s trackstar repo on GitHub (using trackstar/ directory in the repo) and a yii-1.1.13 download (instead of using the YiiRoot/ directory in the repo). The code on GitHub includes the book errata (compared to the chapter code in the download bundle). I tested TrackStar locally first using Windows XAMPP 1.8.1 (PHP 5.4.7 and MySQL 5.5.27), then moved it to a FreeBSD server.

1. At first (locally), yiic and phpunit didn’t behave as expected, but it was my fault. I edited trackstar/index.php to use yii-1.1.13, but neglected to also edit trackstar/protected/yiic.php and trackstar/protected/tests/bootstrap.php (and for completeness, trackstar/index-test.php also).

2. I had to change “truncateTABLE” to “delete” in two of the migration scripts in order to “migrate down” (MySQL 5.5+ can’t truncate InnoDB tables with foreign keys).

3. TrackStar now runs, but I can’t login because there are no users in the database. The solution was to manually add “User One” and “User Two” with SQL as per the book.

INSERT INTO tbl_user (email, username, password) VALUES
  ('test1@notanaddress.com','User One', MD5('test1')),
  ('test2@notanaddress.com','User Two', MD5('test2'));

4. Now I can login as either “User One” or “User Two”, but there are errors creating new projects (and there are new projects being added in tbl_project, which could be a bug…). Running “./yiic rbac” fixes the project creation errors. Now I can create projects, issues and comments, assign users to projects, delete projects, etc. TrackStar Rocks!

5. Next, I copied TrackStar from my development workstation to a FreeBSD server (PHP 5.4.10 and MySQL 5.5.30), modified permissions on directories (for reading, and writing to where necessary by Apache), created a trackstar.conf file, restarted apache and created a database. However, in order to connect to the database I had to change the connection string in main.php and console.php from “host=127.0.0.1″ to “host=localhost” to get the migration scripts to run and the main trackstar page to load (I also had to change the database username and password in the connection string, but those are secret ;-)  ).

6. Now connecting to the database and with the main page loading, navigating using the menu results in a 404 error “The requested URL /usr/local/www/trackstar/index.php was not found on this server.”

The cause of the final problem turned out to be the .htaccess file provided with TrackStar, which  assumes that trackstar is served from the root of the web server (i.e. http://www.dalescott.net/ is TrackStar), when I want “http://www.dalescott.net/trackstar/”. I don’t know why it worked locally on XAMPP with the original .htaccess (but figuring it out is on my ToDo list).

Here is my final Apache trackstar.conf

casper# cat /usr/local/etc/apache22/Includes/trackstar.conf
Alias /trackstar "/usr/local/www/trackstar"

<Directory "/usr/local/www/trackstar">
    Options All
    AllowOverride All
    Order Deny,Allow
    Deny from All
    Allow from All
</Directory>
casper#

and .htaccess

casper# cat /usr/local/www/trackstar/.htaccess
# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On
</IfModule>

# Unless an explicit file or directory exists, redirect all request to Yii
# entry script
<IfModule mod_rewrite.c>
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

  # de facto std recommendation, but assumes/requires that app is root of webserver
  # RewriteRule . index.php

  # Yii forum post "Problem with .htaccess"
  # www.yiiframework.com/forum/index.php/topic/15694-problem-with-htaccess/
  # (1) RewriteRule ^.*$ /index.php
  # (2) RewriteRule ^.*$ /trackstar/index.php

  # seems to be more formal version of Yii forum post (1)
  # forums.laravel.io/viewtopic.php?id=5504
  # RewriteRule ^(.*)$ /index.php/$1 [L]

  # seems to be more formal version of Yii forum post (2)
  # ellislab.com/forums/membe%20r/140390/viewthread/234295/
  # RewriteRule ^(.*)$ http://www.dalescott.net/trackstar/index.php/$1 [L,QSA]

  RewriteRule ^.*$ /trackstar/index.php
</IfModule>
casper#

Maestro might move to Yii…

I might have been premature…

I wrote a week ago that I was moving Maestro, the SCC business support system project, to the Yii framework, which really was my intent at the time. However, I’ve been mired in database design for the past week working on the object layer for Parts&Vendors® (or at least what will be supported), but at the same time I’ve also been been working through Web App Development with Yii and PHP to get up to speed with Yii development.

By the way, Web App Development with Yii and PHP is a really great book. I’ve also been reading Yii Rapid Application Development Hotshot and The Yii Book at the same time. They all have their own perspective, development environment, workflow and tool set components (to some degree), which has been instructive. I’ve also just bought Yii 1.1 Application Development Cookbook, which has the best (only?) printed documentation on the Zii component library (the second edition is due out in only a couple months, but I couldn’t wait).

First, Yii is an active project and the books available are getting me up to speed much faster than I was with ATK. However, getting something as as simple as the ATK – A Business Framework tutorial isn’t nearly as simple as it first seemed. ATK has a better out-of-the-box theme experience, and while grid displays, searching, paging, etc. are bundled with ATK, Yii requires add-ons for the same functionality. The included Zii library appears to provide at least some similar functionality, but it doesn’t seem to be documented beyond the API – which certainly doesn’t make it makes it easier to use than ATK. However, to be fair, there is a community-supported Yii Playground project, that includes functional demos of Zii components with code examples (similar to the ATK Demo), but I don’t know many Zii components there are, and if they’re all in the playground or only some. Unfortunately though, although the books cover the functional stuff really well, and so far I haven’t found much on how exactly does one design a site. Hopefully Larry will get into more of that in The Yii Book

So, the jury is still out on the move to Yii. Learning about Yii is helping me understand ATK, but ATK is still an eventual dead-end. The best case (at least for me) would probably be if Adapto worked with Yii (instead of the Zend Framework). Maybe I’ll have to figure out how….

Maestro – the SCC Business Support System

I named the Swift Construction Company business support system concept Maestro after hearing Kohsuke Kawaguchi explain on FLOSS Weekly why he named his project Jenkins. Kawaguichi-san explained service applications should be named like a person, so that users identify with the application by saying things like:

  • Did you get the bill of materials from Maestro yet?
  • Was the drawing filed in Maestro?
  • Ask Maestro for a where-used report before we modify that part.
  • What drawing rev does Maestro say that serial number was made to?

Makes sense to me!

Maestro is moving to Yii

After much consideration (and some initial regret), I’m moving Maestro, the SCC Business Support System project, to the Yii framework. I’ll give more details later, explaining why moving off Achievo and the ATK framework was necessary, and why Yii is the best fit for the project, but my first priority is to write code until I’ve got a basic functional prototype.

So far, I’m pretty stoked about using Yii. More to come…..

 

Bicycling to Calgary Agile Methods Users Group

I biked yesterday to the University of Calgary from the Chinook c-Train station to attend a meeting of the Calgary Agile Methods Users Group. I was glad I made it, because there was a stimulating group discussion with attendees contributing from their own team experiences.

Here’s the route I took, starting at the Chinook c-Train Station parking. Getting on to the pathway system at Chinook Center, I haded for Glenmore Dam, north to the Bow River pathway, and then past Foothills Hospital to the U of C. On the way back, I had intended to ride from the U of C to get home quick, but couldn’t leave the Hillhurst / Sunnywide Station because of an accident on the tracks downtown. After waiting a few moments, I left the train on bike (other passengers were starting to eye my bike with envy, so I got going while the going was good). I first thought I’d catch another train at the east end of downtown, but it was a warm clear night and with summer biking rapidly drawing to a close, I headed for Chinook with Google Maps as my guide.

Calgary SE / NW Bike Loop (with train!)

View in Google Maps

Using Gitflow with the GitHub Fork & Pull Model

The procedure described here is based on A successful Git branching model by Vincent Driessen (also known as Gitflow), adapted for use with GitHub’s Fork & Pull Model and showing both the developer and project maintainer workflows.

I would like to thank Vincent for his permission to plagiarize his article so such shamelessly.

This is a work-in-process – be warned!

Why a Workflow Reference?

I have previously written about the ATK Framework and Achievo resource management projects moving to community governance. Along with a change in governance, the project repositories are moving to GitHub. Git and GitHub are not new to the ATK/Achievo community, but a well-managed project needs a documented workflow reference for consistent and efficient development.

The examples show the Achievo project, using Git-Bash for development on Windows and tcsh for production on FreeBSD, and using the ssh:// transfer protocol with configured ssh keys ~/.ssh/id_rsa on the development workstation and ~/.ssh/authorized_keys on the production server (https:// may be used to access GitHub through an enterprise firewall that blocks ssh, although in my case both ssh:// and https:// to GitHub are blocked).

Why Git and GitHub?

Simply put, a distributed version control system (DVCS) is a practical necessity for distributed development. Git is the de facto DVCS for distributed open-source development, and GitHub is the de facto hosting site for open source projects.

Why Gitflow?

A tool can be so versatile that it becomes difficult to use because of its versatility. Git and GitHub are like that. They impose no workflow, meaning users get to (or rather, have to) develop their own workflows. Gitflow brought order to the Git world by presenting a versatile workflow in easy to understand language, clear diagrams and example commands.

The only problem is that Gitflow follows the Shared Project Repository Model, where developers push changes directly to a shared canonical project repository, while the ATK Framework and Achievo projects (and many others) follow the Fork & Pull Model, where development is done in project forks and Pull Requests are used to have changes pulled into the canonical project repository. However, Gitflow can easily be adapted to the Fork & Pull Model.

Distributed but Centralized

Even though project development may be distributed, project teams usually designate one  specific repository as the canonical project repository (where the “official” code is). The canonical repositories for the ATK Framework and Achievo projects are in the atkphpframework group on GitHub.

To develop in an open source project hosted on GitHub, a developer forks the canonical project repository to their own GitHub account, then clones the fork to their local system for development and testing. According to common Git convention, the fork is called “origin” (because it is the origin of your local development repo), and the canonical project repository is called “upstream” (because it is upstream from “origin”).

After completing a set of changes, a developer pushes their changes to origin (so their origin repo now includes their changes), then sends a Pull Request to the project maintainers to pull their changes upstream. A project maintainer reviews the changes in the Pull Request, pulls accepted changes into their own local clone of the canonical project repository, and finally pushes the result back to the canonical repository (yes, I said the changes are finally pushed to the canonical repository but the process from the developer’s perspective ended with the pull).

Sometimes a group of developers will collaborate on a new feature, pulling changes from each others origin repos, before sending a Pull Request for their collective result. This prevents premature work from being committed to the canonical repository. Pulling from other developers is simplified by defining a “remote” in your local repository for each of the origin repositories of the other developers working with you.

The following diagram shows the typical repository interactions for developers (pulling between developers and responding to a Pull Request by a project maintainer are not shown).

Fork a Project

First, fork a project to develop in. Forking a project means to take a copy of a project’s source code for independent development. On GitHub, it means to click the Fork button on a project page. GitHub then creates a clone of the project in your own GitHub account. You can fork one of your own repositories, a public GitHub repository, or a private GitHub repository that has been explicitly shared with you.

The first step is to login to GitHub and fork a project. I’m going to be developing in the Achievo project, so I access the Achievo canonical project repository and click the Fork button at the top of the page (just below my login name). GitHub then creates a public clone of the canonical project for me in my personal GitHub account.

Clone your Fork

After forking a project, you need to clone it to your local development system. How exactly you do this will depend on the protocol you want to use, specified by the source URL format used in the clone command. The Git protocol uses SSH keys instead of passwords, but uses a non-standard port that is generally blocked by corporate firewalls. The HTTPS protocol generally works behind corporate firewalls, but requires your GitHub login name and password for each commit (although they can be cached temporarily).

I’ll clone my Achievo fork to my local system using the Read-Write SSH URL (shown at the top of the GitHub project page for my fork).

$ dale@DALE-T61 /c/xampp/htdocs
$ git clone --recurse-submodules "git@github.com:dalers/achievo.git" "achievo"

Achievo is built on top of the ATK Framework and uses a Git submodule (atk/) to reference the ATK project repo on GitHub, instead of using a copy of the ATK code.  The “–recurse-submodules” option to the clone command causes submodules to be pulled as part of the clone – without it the atk/ directory would be empty after cloning and you would have to manually update any submodules:

dale@DALE-T61 /c/xampp/htdocs/achievo (master)
$ git submodule update --init --recursive

Next, create an “upstream” remote in your local clone that references the canonical project repository. Use the GitHub read-only URL for the canonical project repository because you won’t be pushing any changes upstream (you’ll be using Pull Requests, remember?).

dale@DALE-T61 /c/xampp/htdocs/achievo (master)
$ git remote add upstream git://github.com/atkphpframework/achievo.git
dale@DALE-T61 /c/xampp/htdocs/achievo (master)
$ git remote -v
origin  git@github.com:dalers/achievo.git (fetch)
origin  git@github.com:dalers/achievo.git (push)
upstream        git://github.com/atkphpframework/achievo.git (fetch)
upstream        git://github.com/atkphpframework/achievo.git (push)

Finally, fetch from upstream to bring in the branches that are in the canonical repo. You will be using at least the upstream/develop branch so you can keep your local develop branch up to date with changes in the project repo.

dale@DALE-T61 /c/xampp/htdocs/achievo (master)
$ git fetch upstream
From git://github.com/atkphpframework/achievo
* [new branch]      develop    -> upstream/develop
* [new branch]      master     -> upstream/master
...

Branches and Merging

Branches are created in your local development repo for doing development. A branch is generally named according to the development being done, but Gitflow naming rules and project conventions might apply if the branch is going to eventually be pushed upstream.

Gitflow defines standard branches with rules for how they can be created and merged. When following Gitflow, a canonical repository always contains at least two branches:

  • master
  • develop

master and develop are long-running branches, starting essentially at the creation of a project and lasting for as long as the project does. The master branch contains the most recent production release, and the develop branch contains the latest changes intended for the next production release.

Gitflow also defines several types of topic branches. Topic branches aid parallel development, ease tracking of features, prepare for production releases and assist in quickly fixing live production problems. Unlike the master and develop branches, topic branches have a limited life time and will eventually be merged into the develop branch (and possibly also the master branch) and then removed. There are three types of topic branches:

  • Feature branches
  • Release branches
  • Hotfix branches

Each type of topic branch has a specific purpose with strict rules for how a branch of that type can be created, named and merged.

These types of branches will be presented in more detail shortly, but note for now that they are standard Git branches and not special in any way from a technical perspective. It is only the rules defined by Gitflow that make them special.

Merging

Merging is when changes on one branch are applied to a different branch. The –no-ff flag results in a merge always creating a new commit object – even if it could be performed with a fast-forward. This avoids losing information about the historical existence of the feature branch. Compare the following two merge examples:

In the case of the –no-ff merge, the commits from the feature branch are clearly visible. In the case of the plain merge (without the –no-ff option), the feature branch commits cannot be distinguished from the other commits (you could read through the log messages, but even that might not make it clear). Reverting a feature can be extremely difficult with a plain merge, but is easy when the –no-ff flag is used.

You can make the –no-ff option Git’s default merge behavior by adding it to your global git config (you could add it to the repo config, but it’s best left to each developer’s discretion).

$ git config --global merge.ff false

master and develop Branches

As previously described, a canonical repository (“upstream”) always has at least two branches, master and develop.

Gitflow defines the upstream/master branch to contain the current production release, and the upstream/develop branch to contain code intended for the next production release (some may call this the “integration branch”, it is also the code that automatic QA regression testing is performed on).

When the code in the develop branch is deemed to be stable and appropriate for production release, it is merged into master and tagged with a release number.

By definition, the act of merging the develop branch into the master branch is a production release.

Feature Branches

  • Branch from: develop
  • Merge into: develop
  • Named: anything except master, develop, release-* or hotfix-*

Feature branches are used to develop new features for the upcoming release or a distant future release. When starting development of a feature, the target release in which this feature will be incorporated may well be unknown at the time. The essence of a feature branch is that it exists as long as the feature is in development, but will eventually be merged back into develop (to definitely add the new feature to the upcoming release) or discarded (in case of a disappointing experiment).

Depending on the feature, the feature branch may exist only in the developer’s local repo (in other words, it is not pushed to either the developer’s GitHub fork or to the canonical project repo). This is especially the case for smaller solo developments. However, a significant feature branch is typically pushed upstream so that everyone can access it (for review, testing, and development).

Create a feature branch

First, check the local branches in your repo and what branch you are currently on.

dale@DALE-T61 /c/xampp/htdocs/achievo (master)
$ git branch
* master

Git shows the only local branch is the master branch, which is also the current branch (which my Git Bash prompt also shows). However, I want to create create my new feature branch from the develop branch (recall the develop branch is the current state of development, while the master branch is only as recent as last production release).

Checkout a new branch (appropriately named ‘myfeature’) from the origin/develop branch.

dale@DALE-T61 /c/xampp/htdocs/achievo (master)
$ git checkout -b myfeature origin/develop
Branch myfeature set up to track remote branch develop from origin.
Switched to a new branch 'myfeature'

Now it’s time to code, commit some changes, do some testing, code some more, commit some more, test some more …

dale@DALE-T61 /c/xampp/htdocs/achievo (master)
$ git commit -a

Finally, update your local master branch, then create a local develop branch from origin/develop and update it from upstream as well (you’ll want upstream up-to-date for branching it to a new feature branch – more on this later).

dale@DALE-T61 /c/xampp/htdocs/achievo (master)
$ git merge upstream/master
Already up-to-date.
dale@DALE-T61 /c/xampp/htdocs/achievo (master)
$ git checkout -b develop origin/develop
Branch develop set up to track remote branch develop from origin.
Switched to a new branch 'develop'
dale@DALE-T61 /c/xampp/htdocs/achievo (develop)
$ git merge upstream/develop
Already up-to-date.

dale@DALE-T61 /c/xampp/htdocs/achievo (develop)
$ git checkout -b achievocore develop
Switched to a new branch 'achievocore'

Merge the feature branch into develop

Finished features are merged into the develop branch, to be included in the next production release.

$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff myfeature
Updating ea1b82a..05e9557
...
$ git branch -d myfeature
Deleted branch myfeature (was 05e9557).
$ git push origin develop

Push the develop branch to origin

TODO

Issue a Pull Request

TODO

Process the Pull Request

TODO

Release Branches

  • Branch from: develop
  • Merge into: develop and master
  • Named: release-x.x.x

A release branch is where the code for a new production release is stabilized, including fixing minor bugs found during release testing and preparing meta-data for the release (updating version numbers, updating CHANGES and AUTHORS files, etc.). By doing the stabilization work on a release branch, the develop branch is cleared to receive changes for the following release.

A release branch should be created when develop (almost) reflects the desired state of the new release. At the very least, all features targeted for the release must have been merged into develop. Merging features targeted for a subsequent release into develop must wait until after the release branch is branched from the develop branch.

It is only when the release branch is branched that the intended release designation is decided – not sooner. Before the release branch is created, it is only known that the develop branch reflects changes intended for the “next release”. Deciding what to officially call the “next release” is made on the start of the release branch according to the project’s rules for version number bumping (e.g. if the current release is 0.2, whether the next release will be 0.2.1, 0.3, or 1.0.0).

Release branches are created from the develop branch. For example, say version 1.1.5 is the current production release and we have a big release coming up. The state of develop is ready for the “next release” and we have decided that this will become version 1.2 (rather than 1.1.6 or 2.0). So we branch off and give the release branch a name reflecting the new version number:


$ git checkout -b release-1.2 develop
Switched to a new branch "release-1.2"
$ ./bump-version.sh 1.2
Files modified successfully, version bumped to 1.2.
$ git commit -a -m "Bumped version number to 1.2"
[release-1.2 74d9424] Bumped version number to 1.2
1 files changed, 1 insertions(+), 1 deletions(-)

After creating a new branch and switching to it, we bump the version number. Here, bump-version.sh is a fictional shell script that changes some files in the working copy to reflect the new version (this of course can be done manually, the point is that at least the version identifier in the code is changed). Then the bumped version number is committed.

This new release branch will exist until the release is actually made. During this time, the code is stabilized and bug fixes are committed to the release branch (although if significant may also be merged back into develop). Adding new features into a release branch is strictly prohibited. If a release will be delayed to incorporate a new feature, the release branch should be abandoned, the new feature completed, and then the release process started over, otherwise continue developing the new feature in a feature branch and include it in the next release.

Push the release branch to origin

Finished features are merged into the develop branch, where they will then be included in the next production release.

Issue a Pull Request

TODO

Process the pull request (make the release)

When the release branch has been stabilized and ready to be released, the release branch is first merged into master (since every commit on master is a new release by definition, remember). Second, the commit on master is tagged for easy future reference. Finally, the release branch is merged into develop, so that develop includes the stabilization and bug fixes done in the release branch (and will be included in the next production release).


$ git checkout master
Switched to branch 'master'
$ git merge --no-ff release-1.2
Merge made by recursive.
...
$ git tag -a 1.2

The release is now done, and tagged for future reference. It is increasingly common for the project maintainer to sign the tag (using the -s, or -u <key>, option to the tag command), but this varies from project to project.

To keep the merge the changes from the release branch into develop:


$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff release-1.2
Merge made by recursive.
...

This step likely results in a merge conflict (because the version number has changed). If so, fix it and commit.

Now we are really done and the release branch may be removed, since we don’t need it anymore:

$ git branch -d release-1.2
Deleted branch release-1.2 (was ff452fe).

Create a release branch

TODO

Push the release branch to origin

TODO

Issue a Pull Request

TODO

Process the Pull Request

TODO

Hotfix Branches

  • Branch from: master
  • Merge into: develop and master
  • Named: hotfix-x.x.x

Hotfix branches are very much like release branches, but follow an expedited workflow since they are created to release a single immediate fix to production. The normal release branch process cannot be followed because the develop branch will typically contain many changes since the last release, and would take too much time to stabilize and release. The purpose of a Hotfix branch is to correct a single, well-understood defect of limited-scope. If this isn’t the case, then the normal release process must be followed (and the previous release was premature, but that’s a different problem).

Create the hotfix branch

Hotfix branches are created from the production release in the master branch. For example, say version 1.2 is the current production release and a severe bug has been discovered. causing troubles due to a severe bug. We branch off a hotfix branch and start fixing the problem:

$ git checkout -b hotfix-1.2.1 master
Switched to a new branch "hotfix-1.2.1"
$ ./bump-version.sh 1.2.1
Files modified successfully, version bumped to 1.2.1.
$ git commit -a -m "Bumped version number to 1.2.1"
[hotfix-1.2.1 41e61bb] Bumped version number to 1.2.1
1 files changed, 1 insertions(+), 1 deletions(-)

It’s best practice to immediately bump the version number after branching of, then fix the bug and commit the changes in one or more commits.

$ git commit -m "Fixed severe production problem"
[hotfix-1.2.1 abbe5d6] Fixed severe production problem
5 files changed, 32 insertions(+), 17 deletions(-)

Push the hotfix branch to origin

Finished features are merged into the develop branch, where they will then be included in the next production release.

Issue a Pull Request

TODO

Process the pull request (make the release)

When finished, the hotfix branch is merged into master for release. It is also merged into develop so that the fix is included in the next release as well. This is the same as releasing from a release branch.

First, update master and tag the release.

$ git checkout master
Switched to branch 'master'
$ git merge --no-ff hotfix-1.2.1
Merge made by recursive.
(Summary of changes)
$ git tag -a 1.2.1

The hotfix is now released and tagged for future reference. Like any release, it is increasingly common for the project maintainer to sign the tag (using the -s, or -u <key>, option to the tag command), but this varies from project to project.

Next, merge the hotfix into the develop branch:

$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff hotfix-1.2.1
Merge made by recursive.
...

There is one situation requiring special attention. If an upcoming release is currently being stabilized in a release branch, you will need to ALSO need to merge the hotfix into that release branch. If the release is imminent, you may chose to ONLY merge the hotfix into the release branch (it will eventually be merged into develop when the release branch is finished). However, if the release is abandoned for any reason, the hotfix may be forgotten and never merged into the develop branch – and you will wonder why the bug has reappeared in the next release.

Finally, remove the temporary branch:

$ git branch -d hotfix-1.2.1
Deleted branch hotfix-1.2.1 (was abbe5d6).

Create a hotfix branch

TODO

Push the hotfix branch to origin

TODO

Issue a Pull Request

TODO

Process the Pull Request

TODO

Other Tips

Ignore File-mode Changes on Windows

Git thinks executable files have changed when going between ‘nix and Windows systems, when it’s only that the file mode is being interpreted differently. On a Windows system, set your global config (~/.gitconfig) to ignore file mode changes. You may also need to check the local (repository) configuration.

Check your global and local configs:

$ git config --global core.filemode
$ cd gitrepo
$ git config core.filemode

Set configuration to ignore file mode changes (as needed):

$ git config --global core.filemode false
$ cd gitrepo
$ git config core.filemode false

Disable Color-coded Git Output

Many developers couldn’t live without color-coded command-line output, but you may find (as I do) that less than perfect color vision combined with high ambient lighting and some screen glare results in a display that is largely incompressible. To disable color-coded output from Git commands:

$ git config --global color.ui false
$ git config --global color.diff false
$ git config --global color.status false
$ git config --global color.branch false
$ git config --global color.interactive false

Use .gitignore

Applications can dynamically generate files, such as compiled templates, that you don’t want Git to do anything with. Achievo writes files to achievotmp/, which can be added to the project’s .gitignore file (which may already be done if you are cloning the canonical project repository in GitHub).

achievotmp/

Also, your development environment, especially is you are using an IDE (Integrated Development Environment) such as PhpStorm or NetBeans, may create its own project directory that you also want Git to ignore. Because this is developer-specific, add an entry to your global ~/.gitignore file for Git to ignore them.

.idea/

Conclusion

As Vincent Driessen said in “A successful Git branching model“, there is nothing really new about this model. It’s just about communicating a concept so that it can be understood and accepted. Isn’t that what solving most problems is about?

Further Reading

In addition to A successful Git branching model, I found the following references also helpful in figuring this all out:

Dual-Boot Windows 7 and Linux Mint 13 on a T61 ThinkPad

I’ve finally joined the ranks of the dual-booters. I use Windows 7 as my primary environment for web-deployed application development (deployed on FreeBSD), but it seems some things are just done more efficiently in a Linux environment (such as converting an svn repo to Git using svn2git).

I had been using separate Linux and Windows laptops due to concerns over the reliability of the Linux NTFS driver, but after months of swapping an external NTFS USB drive back and forth between Windows systems and Linux systems without trouble, I decided to make the plunge (having my HP dv9000 Windows laptop die a premature death was an added incentive).

Here’s the basic procedure I followed:

1. Perform a new Windows 7 install. Windows recognized all the hardware in the T61 out of the box, which was a nice surprise (I had expected I would need to install the Ethernet adapter myself, and had downloaded it from Lenovo’s website in anticipation). I used a Windows 7 upgrade (which required installing WinXP first) which resulted in a single NTFS partition on the drive. After activating Windows, I spent the rest of the night updating Windows.

2. Install the Lenovo ThinkVantage System Update utility and use it to download and install all recommended drivers and utilities. Painless.

4. Install Firefox and configure Sync (to keep Firefox bookmarks/etc synchronized with my work desktop, my PortableApps USB drive, and the home family PC).

5. Compress the drive using Windows (I compressed it by 100G, which will be more than enough for Linux Mint, especially as all my development files will be kept on the NTFS partition).

6. Boot Linux Mint XFCE from the distribution DVD and install “Alongside Windows” (it’s not well documented, but if the Linux Mint installer finds enough unused space on the drive, it will create a new partition for the unused space and then install Linux Mint into it). The installer will also replace the Windows bootloader with GRUB, and although I had read recommendations against this, I haven’t had any problems.

5. Boot into Linux Mint and update the system. Edit /etc/default/grub to make Windows the default OS at boot (and as instructed, run grub-update afterwards to rebuild /etc/grub.cfg). Edit /etc/fstab to mount the Windows partition at boot so KeePassX can access my password database on the Windows partition without me first having to mount the partition (but instead of editing /etc/fstab directly, I used pysmb).

7. Configure Firefox Sync in Linux Mint.

8. Install git, gitk, and svn2git following this Nine Productions post.

The only thing I don’t know is why I didn’t do this sooner!

Achievo and ATK Moving to Community Governance

The process has started to move the ATK Framework and Achievo projects to community governance from corporate governance.

Update 2012/07/19 – the GitHub organization created for the ATK Framework, ATK Demo and Achievo repositories is the ATK PHP Framework – https://www.github.com/atkphpframework (the code will be there soon!).

The ATK Framework is an open-source object-oriented full-stack PHP web application framework that enables rapid development of business-oriented web applications, such as HRM, CRM, data management and CMS. iBuildings created the ATK Framework in ~2000 and have closely managed its development project and project infrastructure, including a public web site, forum, wiki, bug tracker and code repository (although only iBuildings has commit access to the repository). iBuildings also controls the development projects of two closely related applications:

  • ATK Demo – a tutorial application demonstrating basic ATK Framework concepts, and
  • Achievo – a fully-featured and extensible resource management application based on ATK (iBuildings had used Achievo internally for managing development projects) .

I became involved in 2004 when I implemented Achievo 1.0RC1 as part of an engineering portfolio project management initiative for a high-tech product development team. Support from iBuildings was excellent, with senior developers responding to my forum posts and the lead developer even logging into my server at one point to help debug an issue related to hosting on Windows. More recently, I have selected Achievo (and the ATK Framework) for prototyping an open-source business support system for the fictional Swift Construction Company.

Over the past few years though, iBuildings’ involvement in the ATK Framework and Achievo projects has seemed to be declining, while community involvement has been growing. After a number of recent pleas from the community for iBuildings to make their intentions public, Tom Schenkenberg (iBuildings co-founder) confirmed our suspicions, but also graciously committed support for moving the ATK Framework, ATK Demo, and Achievo projects to community governance.

“… we took the business decision to no longer participate in active development and stop using this framework for our commercial application development work.”

“I’d like to offer anything and everything belonging to ATK/Achievo to you guys, the true maintainers of these projects. I’m happy to hand over the servers/domains/applications/websites/repositories/etc. to the community. Please help me to get ATK/Achievo in the right hands and in the right place.”

So how does a loose collection of independent developers scattered across the globe turn themselves into an efficient project team? Tom may have offered up the reins, but it’s up to us to decide where we’re going.

Since Tom’s announcement, an informal leadership team has been formed from community members, a GitHub organization has been created for the project code repositories, and documentation is starting to be written on the GitHub ATK project wiki. Once it has been decided how to best migrate the iBuildings svn repos to GitHub, the real fun will begin!

Adding to the excitement is a recent announcement from Ivo Jansch (former iBuildings CTO and now Eugeniq founder) that he was creating a “second incarnation of ATK” called Adapto, to be released under the business-friendly BSD license. Ivo originally conceived ATK, was its lead developer and power user within iBuildings, and is a copyright holder for much of its source. Here’s how Ivo describes Adapto.

Adapto will not be “focusing on anything that is already provided by common frameworks. So I would like to leave caching, view rendering, database connectivity etc. to an existing framework (Zend Framework) and have Adapto … just contain the code that makes it great. I also have ideas to extend the UI beyond just websites (think mobile/tablet apps).

… Another point is that the codebase is quite complex and one reason for that is the 12 years of legacy. By starting fresh and not worrying so much initially about backwards compatibility, we can leave some of that baggage behind.

So while the ATK Framework has a new team who will be focusing on maintenance and feature updates to ATK and Achievo (and documentation), Adapto will be under development as a future solution for concepts proven by ATK.  However, simply from its existence, Adapto also adds to the complexity of the ATK ecosystem. Not only will developers be considering the future of ATK and Achievo, they will also be considering the future of Adapto on ATK.

To provide some possible clarity into the situation, I’d like to offer this roadmap proposal for consideration (and hopefully some spirited debate). Comments are encouraged (but be warned, I will be re-posting relevant comments made here to the ATK forum and/or Adapto mail list).

Image of AtkAchievoAdapto Integration Roadmap (proposal)

Watch out for more news, it’s going to be a fun year!

Dale