<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Taras Mankovski Blog &#187; Tools</title>
	<atom:link href="http://taras.cc/index.php/category/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://taras.cc</link>
	<description>Building Beecoop and generaly making developer&#039;s lives easier and more productive.</description>
	<lastBuildDate>Wed, 25 Nov 2009 03:41:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to deploy: database, source and binary changes in 1 patch?</title>
		<link>http://taras.cc/index.php/2009/11/24/how-to-deploy-database-source-and-binary-changes-in-1-patch/</link>
		<comments>http://taras.cc/index.php/2009/11/24/how-to-deploy-database-source-and-binary-changes-in-1-patch/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 03:40:15 +0000</pubDate>
		<dc:creator>Taras</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://taras.cc/?p=183</guid>
		<description><![CDATA[Today, was an exciting day for me, again.  
I was working on several client&#8217;s projects and something seems to have crystalized in my brain today. This crystallization created a new question that I posted on stackoverflow: How to deploy: database, source and binary changes in 1 patch?
Amazingly, 6 hours went by and I only [...]]]></description>
			<content:encoded><![CDATA[<p>Today, was an exciting day for me, again. <img src='http://taras.cc/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I was working on several client&#8217;s projects and something seems to have crystalized in my brain today. This crystallization created a new question that I posted on stackoverflow: <a href="http://stackoverflow.com/questions/1791426/how-to-deploy-database-source-and-binary-changes-in-1-patch">How to deploy: database, source and binary changes in 1 patch?</a></p>
<p>Amazingly, 6 hours went by and I only got 20 views and 0 answers. You know what this says to me? To me this says that people do not have an easy answer to this question. I know for myself, i usually look for questions that I have quick answers to, I think this is not one of those questions.</p>
<p>Well, this actually was a test to see if something like this already exists, because I think I have an answer to this question. I outlined it in my conversation with Trevor today. I put it to your for consideration, I would love to get feedback so please tell me what you think.</p>
<p>A transcript of this conversation is in this post:</p>
<p><span id="more-183"></span></p>
<blockquote><p><strong>Taras Mankovski</strong></p>
<p>I have multiple developers checking out projects from repository, the repo contains db dump of the project, they import the db, make changes to code, dump db, commit changes and db back to repo, problem is that sql dump site is pretty much useless in terms of figuring out what has changed in db</p>
<p>diff, is a well established mechanism for comparing text files. It works pefectly. I can at any point, check what&#8217;s changed between revision of a project. This is especially nice with git because I can choose arbitrary commits and see their changes.</p>
<p>This brings us back to db. DB sql dump is pretty much useless in determining what has changed in the DB because of the nature of the file. It&#8217;s long it&#8217;s wordy, it plain sucks to read.</p>
<p>So here is the solution:</p>
<p>I think it would be possible to represent the database as a directory with files in it. Every table in the database would be a directory. Every record a text file that contains in it the data from the record, represented as JSON.</p>
<p>What this means is that it would be extremely easy to commit the database into the repository and see what has changed.</p>
<p>We can use existing established mechanisms to determine the changes in the database.</p>
<p>The information included in the file system can be quiet extensive. For example, every directory can contain a schema file, that represents the schema of the table as json file. Again, it would be very easy to compare schema changes from revision to revision by comparing the schema files.</p></blockquote>
<blockquote><p><strong>Trevor Twining</strong><br />
I think it&#8217;s a really interesting solution to the problem, just trying to work out how implementation details would work with Drupal&#8217;s architecture and how it might support or conflict with other partial solutions to the problem.</p>
<p>There&#8217;s been a push in drupal lately to allow more config to be exported as code for just that reason, but a lot of it is happening at the object level. There&#8217;s a growing number of modules that are using OOP principles in their code even though Drupal is procedural, so they&#8217;re basically providing var exports for some of those objects some of that work is for reusability of code as well, so that configurations can be saved and implemented in different projects</p></blockquote>
<blockquote><p><strong>Taras Mankovski</strong><br />
Ok, so there is more. The title of this wave is Unified Patching. The problem with what we have right now is that &#8220;It&#8217;s very difficult to deploy changes to the server.&#8221;</p>
<p>The problem actually is that deployment is easy, if you&#8217;re doing it wrong. Deployment is hard if you&#8217;re doing it right.</p>
<p>What do I mean by that?<br />
It&#8217;s easy to make changes to client&#8217;s site by working directly on client site. That in many many many ways is very wrong. If you break something you&#8217;re essentially screwed, it looks bad and it&#8217;s just extremely unprofessional. But it&#8217;s so damn easy.</p>
<p>The hard part is to do it right &#8211; do all development offline, test the changes, show the changes to the client on demo server, stage the changes and then finally apply them to client&#8217;s site without impacting the live site. This is hard.</p>
<p>I&#8217;m finding that deployment takes as much time as development. This is what I want to change. This is where Unified Patching will come in.</p>
<p>I&#8217;m breaking up project changes into 4 categories.</p>
<ul>
<li>Database Structure</li>
<li>Database Data</li>
<li>Source Code</li>
<li>Binary Files</li>
</ul>
<p>Actually, when working with CMS, Database Data can be broken up into 2 categories: Content Changes and Structural Changes. In Drupal, this would be defining the content types and the actual content data. We will ignore this point for now.</p>
<p>I think it would be possible to systematically apply all 4 of these changes using a unified tool, that would apply them in a reliable and predictable manner.</p>
<p>What&#8217;s I&#8217;m talking about is unix &#8216;patch&#8217; utitility on steroids.</p>
<p>I have an idea of how this could be done in a very simple and reliable way.</p>
<p>Ok, so I think it would be possible to use diff to generate Unified Patches.</p>
<p>Diff is a very simple format that can be generated from any VCS.</p>
<p>Git&#8217;s diff includes information about the changes that happened between version with source code, binary files and permissions. It has no capacity to handle database changes.</p>
<p>I think if we were to use the solution outlined above, then we could create a Unified Patch generator that would parse the diff to determine changes in the 4 data types that were outlined above.</p>
<p>For example:</p>
<p>Let&#8217;s assume that we have all of the database dumpted as files onto the files system. We are going to run DIFF between 2 revisions.</p>
<ol>
<li>Parse the diff to determine if any of the schema files have changed in the /db directory have changed. If changed then generate ALTER statements that correspond to the changes made to the schema.</li>
<li>Parse the diff to determine if any files in the /db directory have changed, if they have then create a corresponding REPLACE or DELETE/INSERT statement for each changed file</li>
<li>If binary files were added/removed or modified, then include the modifed files a temprorary location</li>
<li>Include standard patch for source code or text files</li>
</ol>
<p>Now that we have all of the data types processed, put them together into 1 directory and tar.gz the directory.</p>
<p>Now you have an Unified Patch.</p>
<ol>
<li>Upload the patch to the server.</li>
<li>run upatch ourpatch.tar.gz</li>
</ol>
<p>upatch will perform the following actions.</p>
<ol>
<li>dry-run database schema changes (possibly inside of a trasaction)</li>
<li>dry-run database content import</li>
<li>dry-run binary file move</li>
<li>dry-run patch</li>
</ol>
<p>I don&#8217;t know how to do step 1 and 2. Step 3 could be fairily simple, we just need to know if have permissions to overwrite these files.</p>
<p>If dry-run succeds, then it&#8217;s fairily safe to perform live update.</p></blockquote>
<blockquote><p><strong>Trevor Twining</strong><br />
I don&#8217;t know if you could do a dry run, but you could make changes in a test version (makes a dump of current live db and changes that instead of live)</p>
<p>transactional support might allow you to do the rollback, but you&#8217;d need to be able to do several operations before the commit, shouldn&#8217;t be a problem, but dummy database might be more useful because you can connect to it and actually see if anything is messed up, which you couldn&#8217;t do with a transactional approach.</p></blockquote>
<blockquote><p><strong>Taras Mankovski</strong><br />
We really just want to know if the query succeeded. The other approach would be use to test, like you said, but actual make it a staging environment where you can push the changes to and test if the site is working before you apply the same change to the live site</p></blockquote>
<blockquote><p><strong>Trevor Twining</strong><br />
Here&#8217;s a question though, what about the cases where the database is storing some serialized version of a code-object for persistance? Not looking for an immediate answer, but it&#8217;s an important question</p></blockquote>
<blockquote><p><strong>Taras Mankovski</strong><br />
Is the data stored as php serialized object?</p></blockquote>
<blockquote><p><strong>Trevor Twining</strong><br />
a portion, yes, and it&#8217;s how code is shared/exported, basically via a var_export call. code for views can then be moved out of the database and stored as modules</p></blockquote>
<blockquote><p><strong>Taras Mankovski</strong><br />
ok, let&#8217;s take a few example:<br />
Multiple developers are working on same site<br />
Developer A checked out changes from repo, made changes in the view and commited them.<br />
At the same time, Developer B also made changes to the db and try to commit them. Now, for Developer B, his commit would fail because his dbfiles are out of date. He needs to perform merge. I do not know how you would merge 2 view exports or if it&#8217;s at all possible, but atleast the developers know that there is a conflict in the views right away.</p></blockquote>
<p>That&#8217;s it for today, not bad for 1 days, work.</p>
<p>Ok, what do you guys think about this?</p>
]]></content:encoded>
			<wfw:commentRss>http://taras.cc/index.php/2009/11/24/how-to-deploy-database-source-and-binary-changes-in-1-patch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building python development environment</title>
		<link>http://taras.cc/index.php/2009/09/30/building-python-development-environment/</link>
		<comments>http://taras.cc/index.php/2009/09/30/building-python-development-environment/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 15:30:52 +0000</pubDate>
		<dc:creator>Taras</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Beecoop]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[open]]></category>

		<guid isPermaLink="false">http://taras.cc/?p=130</guid>
		<description><![CDATA[I&#8217;m preparing to start development on beecoop and anonymous websites and I would like to establish a comfortable python development environment to make development and deployment of different applications easier.
There are several factors that I need to consider:

I&#8217;m going to be working on several different projects at the same time.
Each project is going to be [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m preparing to start development on beecoop and anonymous websites and I would like to establish a comfortable python development environment to make development and deployment of different applications easier.</p>
<p>There are several factors that I need to consider:</p>
<ul>
<li>I&#8217;m going to be working on several different projects at the same time.</li>
<li>Each project is going to be using different python modules.</li>
<li>Some projects will run on apache, others on cherokee.</li>
<li>Cherokee does not have installer for Mac OS X, so I can not replicate our production environment locally.</li>
<li>I would like to start working in TDD</li>
<li>Last and not least, I have to make it easy for our sysadmin to deploy these projects.</li>
</ul>
<p><span id="more-130"></span>Here are technologies that I&#8217;ve found so far and how I would like to combine them together.</p>
<p><a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with <i>&#8211;no-site-packages</i> switch allows you to create virtual environments that are seperate from your system. This forces you to be conscious of what packages your application is using. This is particularly useful when you&#8217;re doing development of applications that require different versions of python. We&#8217;re going to stick to python2.5 for the near future so this is not a major concern for us.</p>
<p><a href="http://pypi.python.org/pypi/zc.buildout">Buildout</a> is the tool that i think we&#8217;re actually going to be using. It makes it easy for sysadmin to deploy the applications, while maintaining the benefit of forcing us to be conscious of what packages particular application requires. Buildout makes virtualenv unnecessary for us because it simulates virtualenv&#8217;s functionality by including the paths for all necessary packages in sys.path of every project.</p>
<p><a href="http://pypi.python.org/pypi/PasteScript">Paste Script</a> allows to create packages that we can include inside of our applications. It makes it easy to integrate multiple modules that are under development into our applications while keeping things clean and modular.</p>
]]></content:encoded>
			<wfw:commentRss>http://taras.cc/index.php/2009/09/30/building-python-development-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Opening images in Preview from Mac OS X Command Line</title>
		<link>http://taras.cc/index.php/2009/09/30/opening-images-in-preview-from-mac-os-x-command-line/</link>
		<comments>http://taras.cc/index.php/2009/09/30/opening-images-in-preview-from-mac-os-x-command-line/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 15:30:39 +0000</pubDate>
		<dc:creator>Taras</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://taras.cc/?p=124</guid>
		<description><![CDATA[If you&#8217;re in command line and you got a bunch of images in a directory and you would like to preview them without touching the mouse.


open -a Preview *


Since that is too much to type, you can add an alias to your ~/.bash_profile


alias preview="open -a Preview"


Copy and paste the above text into your ~/.bash_profile
Usage: preview [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re in command line and you got a bunch of images in a directory and you would like to preview them without touching the mouse.<span id="more-124"></span>
<pre>
<code>
open -a Preview *
</code>
</pre>
<p>Since that is too much to type, you can add an alias to your <strong>~/.bash_profile</strong></p>
<pre>
<code>
alias preview="open -a Preview"
</code>
</pre>
<p>Copy and paste the above text into your <strong>~/.bash_profile</strong></p>
<p>Usage: preview * or preview *.jpg</p>
<p>Enjoy,<br />
Taras</p>
]]></content:encoded>
			<wfw:commentRss>http://taras.cc/index.php/2009/09/30/opening-images-in-preview-from-mac-os-x-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create beautiful source code output with vim2html</title>
		<link>http://taras.cc/index.php/2009/09/30/create-beautiful-source-code-output-with-vim2html/</link>
		<comments>http://taras.cc/index.php/2009/09/30/create-beautiful-source-code-output-with-vim2html/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 15:30:29 +0000</pubDate>
		<dc:creator>Taras</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://taras.cc/?p=120</guid>
		<description><![CDATA[I came a very interesting command line utility that converts your source code into html. The cool thing is that it uses your vim color scheme to color the output source code. So the output html looks the same as it does when I work on it in vim.
The app is called vim2html. It&#8217;s available [...]]]></description>
			<content:encoded><![CDATA[<p>I came a very interesting command line utility that converts your source code into html. The cool thing is that it uses your vim color scheme to color the output source code. <span id="more-120"></span>So the output html looks the same as it does when I work on it in vim.</p>
<p>The app is called <a href="http://chip.cuccio.us/projects/hacks/#vim2html"><b>vim2html</b></a>. It&#8217;s available in RPM, source tarball and Macports.</p>
]]></content:encoded>
			<wfw:commentRss>http://taras.cc/index.php/2009/09/30/create-beautiful-source-code-output-with-vim2html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Password-less SSH Login on Media Temple GS account</title>
		<link>http://taras.cc/index.php/2008/07/28/password-less-ssh-login-on-media-temple-gs-account/</link>
		<comments>http://taras.cc/index.php/2008/07/28/password-less-ssh-login-on-media-temple-gs-account/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 04:35:31 +0000</pubDate>
		<dc:creator>Taras</dc:creator>
				<category><![CDATA[Media Temple]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://taras.cc/?p=68</guid>
		<description><![CDATA[I&#8217;m really not sure why Media Temple support told me this is not possible to do, but it is.
I use Media Temple ssh 5-10 times a day, that&#8217;s why typing in
ssh serveradmin@positivesum.org@s43472.gridserver.com
and then entering password is way too slow.
There is a better way.
To login, I use 
ssh ps
ps &#8211; is acronym for positivesum.org
In this tutorial, I will explain to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m really not sure why Media Temple support told me this is not possible to do, but it is.</p>
<p>I use Media Temple ssh 5-10 times a day, that&#8217;s why typing in</p>
<p><strong>ssh serveradmin@positivesum.org@s43472.gridserver.com</strong></p>
<p>and then entering password is way too slow.</p>
<p>There is a better way.</p>
<p>To login, I use </p>
<p><strong>ssh ps</strong></p>
<p>ps &#8211; is acronym for positivesum.org</p>
<p>In this tutorial, I will explain to you how to set this up.<br />
<span id="more-68"></span><br />
First, I will address the the Password-less SSH login and then I will tell you how to setup the acronym.</p>
<h4>Password-less SSH Login</h4>
<ol>
<li>You need Public Key (run ssh-keygen if you haven&#8217;t already)</li>
<li>in your ~/.ssh folder you will have a id_rsa.pub</li>
<li>you need to copy this file to your mediatemple ssh<br />
<strong>scp ~/.ssh/id_rsa.pub serveradmin@yourdomain.com@yourdomain.com:~/.ssh </strong><br />
should do the trick</li>
<li>now ssh into your media temple<br />
<strong>ssh serveradmin@yourdomain.com@yourdomain.com</strong></li>
<li>run<br />
<strong>cd ~/.ssh</strong></li>
<li>now to add your key to list of authorized_keys run<br />
<strong>cat authorized_keys id_rsa.pub &gt; authorized_keys2</strong></li>
<li>and replace old list with new list<br />
<strong>mv authorized_keys2 authorize_keys</strong></li>
<li>run change mod to protect your authorized_keys file<br />
<strong>chmod 600 authorized_keys</strong></li>
<li>now you should be able to logout<br />
<strong>exit</strong></li>
<li> and log back in without requiring to enter a password.</li>
</ol>
<h4>Acronym instead of your domain name</h4>
<ol>
<li>with vim(or your favorite command line editor) edit ~/.ssh/config,<br />
<strong>vim ~/.ssh/config</strong></li>
<li>add<strong><br />
Host ps<br />
     HostName s43472.gridserver.com<br />
     User serveradmin@positivesum.org</strong></li>
<p><strong>lines after <strong>Host ps</strong> have to be <strong>indented</strong> You have to <strong>replace ps</strong> with your own acronym(whatever is applicable in your case) and change the HostName and User</strong> to your hostname and user name. You can create as many of these entries as you would like for all of your servers.</li>
</ol>
<p>Here your go, this should work, if it doesn&#8217;t let me know in the comments.<br />
 </p>
]]></content:encoded>
			<wfw:commentRss>http://taras.cc/index.php/2008/07/28/password-less-ssh-login-on-media-temple-gs-account/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
