We are forever trying to streamline our workflows.  That sounds like managerial speech, but it’s what we do every day.  Today we make another step forward with Knectar’s Stage Media, an important yet missing link.

Like almost every development team, most of our work is done through git or some other versioning system.  There are branches for “master” and “dev.” Code committed to these branches is deployed to the production and staging servers.  In our case, Knectar relies on Beanstalk for its automatic deployment.  First, the developer must write and test the code on their individual local server.  Commits then ‘bubble up’ from local, to dev, to master in turn.

To make sites work, they need data. Databases are not stored in git, we often copy from the production server to the others.  Content then ‘trickles down’ from production to stage and local machines.

This doesn’t reflect the entire process.  Through normal use, the production server accumulates images and other media files which we also want to ‘trickle down’.  A Drupal module called Stage File Proxy exists for this purpose, but the same isn’t true for Magento.  To resolve this discrepancy, we made Stage Media, a Magento module which is only for use on development sites.

For example, let’s say you import a fresh copy of the database. Before doing anything else, make sure Stage Media is installed, perhaps with the command:

modman clone https://github.com/Knectar/Magento-Stage-Media

Now visit the development site in your browser. It will configure itself behind the scenes, and the whole site just works.  Images download as you need them so you won’t even notice the break.

Along with providing accessibility to production media, Stage Media auto-configures itself based on the previous “base URL.” It then updates the base URL to the new server.  This saves the effort of editing ‘core_config_data’ entries each time the production database gets copied.

With this module in place, Knectar has been able to simplify its workflow and enhance productivity. To learn more about Stage Media, check out https://github.com/Knectar/Magento-Stage-Media.