<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.lstoll.net/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.lstoll.net/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Lincoln Stoll</title>
	
	<link>http://lstoll.net</link>
	<description />
	<pubDate>Wed, 23 Jul 2008 04:39:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.lstoll.net/lstollnet" type="application/rss+xml" /><item>
		<title>A brief update</title>
		<link>http://feeds.lstoll.net/~r/lstollnet/~3/343139881/</link>
		<comments>http://lstoll.net/2008/07/a-brief-update/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 02:20:14 +0000</pubDate>
		<dc:creator>lstoll</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://staging.lstoll.net/?p=39</guid>
		<description><![CDATA[Firstly, my apolgies to those who have had their RSS read re-filled with old posts, I&#8217;ve moved the site to Wordpress. Enki was fantastic, however Wordpress is quite well featured, and their iPhone application tipped me over the edge. I also had many ideas to implement on the site, but ended up with no time [...]]]></description>
			<content:encoded><![CDATA[<p>Firstly, my apolgies to those who have had their RSS read re-filled with old posts, I&#8217;ve moved the site to Wordpress. Enki was fantastic, however Wordpress is quite well featured, and their iPhone application tipped me over the edge. I also had many ideas to implement on the site, but ended up with no time - so at least someone else has already done it for me here.</p>
<p>As for hghub, the project stalled due to other commitments, and the fact that git has grown on me, and I&#8217;ve switched to it and <a href="http://github.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://github.com');">GitHub</a>. For those looking for the same kinda thing for mercurial, please check out <a href="http://bitbucket.org" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://bitbucket.org');">bitbucket.org</a> (Thanks Dennis!). I&#8217;ve had a quick look at it, and it looks impressive.</p>
<p>Lastly, the project I&#8217;ve been working on lately is now coming to fruition - please go check out <a href="http://stripe.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://stripe.com');">stripe.com</a> and tell me what you think!</p>
<img src="http://feeds.lstoll.net/~r/lstollnet/~4/343139881" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lstoll.net/2008/07/a-brief-update/feed/</wfw:commentRss>
		<feedburner:origLink>http://lstoll.net/2008/07/a-brief-update/</feedburner:origLink></item>
		<item>
		<title>Shell Meme</title>
		<link>http://feeds.lstoll.net/~r/lstollnet/~3/343139882/</link>
		<comments>http://lstoll.net/2008/04/shell-meme/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 14:33:50 +0000</pubDate>
		<dc:creator>lstoll</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://staging.lstoll.net/?p=37</guid>
		<description><![CDATA[I ran

1
history&#124;awk '{a[$2]++} END{for(i in a){printf &#34;%5d\t%s\n &#34;,a[i],i}}'&#124;sort -rn&#124;head

and got this:

1
2
3
4
5
6
7
8
9
10
100	cd
62	ls
60	git
28	ssh
26	hg
19	mate
17	psql
15	sudo
15	mv
14	rake

Looks like I&#8217;ve spent too much time looking for things, and not enough time working on them.
]]></description>
			<content:encoded><![CDATA[<p>I ran</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash"><span style="color: #7a0874; font-weight: bold;">history</span><span style="color: #000000; font-weight: bold;">|</span>awk <span style="color: #ff0000;">'{a[$2]++} END{for(i in a){printf &quot;%5d<span style="color: #000099; font-weight: bold;">\t</span>%s<span style="color: #000099; font-weight: bold;">\n</span> &quot;,a[i],i}}'</span><span style="color: #000000; font-weight: bold;">|</span>sort -rn<span style="color: #000000; font-weight: bold;">|</span>head</pre></td></tr></table></div>

<p>and got this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="bash"><span style="color: #000000;">100</span>	<span style="color: #7a0874; font-weight: bold;">cd</span>
<span style="color: #000000;">62</span>	<span style="color: #c20cb9; font-weight: bold;">ls</span>
<span style="color: #000000;">60</span>	git
<span style="color: #000000;">28</span>	<span style="color: #c20cb9; font-weight: bold;">ssh</span>
<span style="color: #000000;">26</span>	hg
<span style="color: #000000;">19</span>	mate
<span style="color: #000000;">17</span>	psql
<span style="color: #000000;">15</span>	<span style="color: #c20cb9; font-weight: bold;">sudo</span>
<span style="color: #000000;">15</span>	<span style="color: #c20cb9; font-weight: bold;">mv</span>
<span style="color: #000000;">14</span>	rake</pre></td></tr></table></div>

<p>Looks like I&#8217;ve spent too much time looking for things, and not enough time working on them.</p>
<img src="http://feeds.lstoll.net/~r/lstollnet/~4/343139882" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lstoll.net/2008/04/shell-meme/feed/</wfw:commentRss>
		<feedburner:origLink>http://lstoll.net/2008/04/shell-meme/</feedburner:origLink></item>
		<item>
		<title>Information management, pt. 1</title>
		<link>http://feeds.lstoll.net/~r/lstollnet/~3/343139883/</link>
		<comments>http://lstoll.net/2008/04/information-management-pt-1/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 12:06:15 +0000</pubDate>
		<dc:creator>lstoll</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://staging.lstoll.net/?p=35</guid>
		<description><![CDATA[This is a quick post, as you may notice there is a new &#8220;Notebook&#8221;:http://preview.evernote.com/pub/lstoll/public/ option in the sidebar. I&#8217;ve decided to open up some of my notes from now on in a public format, because a lot of the good stuff is there - useful information, that I never get time to write up. So [...]]]></description>
			<content:encoded><![CDATA[<p>This is a quick post, as you may notice there is a new &#8220;Notebook&#8221;:http://preview.evernote.com/pub/lstoll/public/ option in the sidebar. I&#8217;ve decided to open up some of my notes from now on in a public format, because a lot of the good stuff is there - useful information, that I never get time to write up. So check it out, and beware - it can be pretty raw. Big props to &#8220;evernote&#8221;:http://evernote.com for this - their new beta is a pretty good notetaking app in its own right, but combined with the online service and syncing - it becomes awesome, and makes something like this possible. I also plan on integrating search with it somehow.</p>
<p>Which leads me on to one of my favorite topics - information management. I seem to go through so much information and generate so many notes it&#8217;s not funny, and trying to look after it is difficult. I&#8217;ve settled on Evernote and EagleFiler for now. Evernote is great for note taking and jotting things down wherever I am, and EagleFiler works well for storing larger documents, manuals etc. I also use a bunch of other tools around this - I plan on writing up some more of my processes here real soon, so keep an eye out. Also, if you have any tools or methods you find indispensable please let me know - I&#8217;d love to hear.</p>
<img src="http://feeds.lstoll.net/~r/lstollnet/~4/343139883" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lstoll.net/2008/04/information-management-pt-1/feed/</wfw:commentRss>
		<feedburner:origLink>http://lstoll.net/2008/04/information-management-pt-1/</feedburner:origLink></item>
		<item>
		<title>EC2 Persistent Storage</title>
		<link>http://feeds.lstoll.net/~r/lstollnet/~3/343139884/</link>
		<comments>http://lstoll.net/2008/04/ec2-persistent-storage/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 02:12:53 +0000</pubDate>
		<dc:creator>lstoll</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://staging.lstoll.net/?p=33</guid>
		<description><![CDATA[I got an email from Amazon yesterday, talking about persistent storage for EC2 - Based on the email (full text below). From what I can see this works almost like a SAN, which is awesomely cool - you can store you database on here, and if your DB server dies, just start a new instance, [...]]]></description>
			<content:encoded><![CDATA[<p>I got an email from Amazon yesterday, talking about persistent storage for EC2 - Based on the email (full text below). From what I can see this works almost like a SAN, which is awesomely cool - you can store you database on here, and if your DB server dies, just start a new instance, and mount the same filesystem on it. It also supports snapshot backups to S3 - both MySQL and PostgreSQL can work with this. It&#8217;s adding a SAN service to go with the storage and hosting services that amazon already provide. Can&#8217;t wait to see the pricing..</p>
<p>I think this takes EC2 away from being a cool idea, and turns it into a serious hosting platform. Bring it on!</p>
<p>The email from Amazon:</p>
<p><span id="more-33"></span></p>
<p>Dear Amazon EC2 Developer,<br />
Many Amazon EC2 customers have been requesting that we let them know ahead of time about features that are currently under development so that they can better plan for how that functionality might integrate with their applications. To that end, we would like to share some details about a major upcoming feature that many of you have requested - persistent storage for EC2.</p>
<p>This new feature provides reliable, persistent storage volumes, for use with Amazon EC2 instances. These volumes exist independently from any Amazon EC2 instances, and will behave like raw, unformatted hard drives or block devices, which may then be formatted and configured based on the needs of your application. The volumes will be significantly more durable than the local disks within an Amazon EC2 instance. Additionally, our persistent storage feature will enable you to automatically create snapshots of your volumes and back them up to Amazon S3 for even greater reliability.</p>
<p>You will be able to create volumes ranging in size from 1 GB to 1 TB, and will be able to attach multiple volumes to a single instance. Volumes are designed for high throughput, low latency access from Amazon EC2, and can be attached to any running EC2 instance where they will show up as a device inside of the instance. This feature will make it even easier to run everything from relational databases to distributed file systems to Hadoop processing clusters using Amazon EC2.</p>
<p>When persistent storage is launched, Amazon EC2 will be adding several new APIs to support the persistent storage feature. Included will be calls to manage your volume (CreateVolume, DeleteVolume), mount your volume to your instance (AttachVolume, DetachVolume) and save snapshots to Amazon S3 (CreateSnapshot, DeleteSnapshot).</p>
<p>This new functionality is already being used privately by a handful of EC2 customers, and will be publicly available later this year. We will be expanding the private offering as we get closer to launch. Please sign up if you are interested in participating.</p>
<p>We hope this information is useful to you as you plan, design and deploy your applications in Amazon EC2.</p>
<p>Sincerely,<br />
The Amazon EC2 Team</p>
<img src="http://feeds.lstoll.net/~r/lstollnet/~4/343139884" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lstoll.net/2008/04/ec2-persistent-storage/feed/</wfw:commentRss>
		<feedburner:origLink>http://lstoll.net/2008/04/ec2-persistent-storage/</feedburner:origLink></item>
		<item>
		<title>Quick guide to making an iPhone work in Australia (1.1.4).</title>
		<link>http://feeds.lstoll.net/~r/lstollnet/~3/343139885/</link>
		<comments>http://lstoll.net/2008/04/quick-guide-to-making-an-iphone-work-in-australia-114/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 01:13:29 +0000</pubDate>
		<dc:creator>lstoll</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://staging.lstoll.net/?p=31</guid>
		<description><![CDATA[I&#8217;ve been working with the iPhone since it came out, and I&#8217;m amazed at how far everything has come, back from coding up the first TurboSIM hardware hack and all the messing around for jaikbreak and activation, to now where it&#8217;s just point a click. Really, only two steps are needed: The first is to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with the iPhone since it came out, and I&#8217;m amazed at how far everything has come, back from coding up the first TurboSIM hardware hack and all the messing around for jaikbreak and activation, to now where it&#8217;s just point a click. Really, only two steps are needed: The first is to unlock and activate the phone which I won&#8217;t cover here, as there are good references elsewhere, the second is to tweak it for Australian Carriers (Telstra,. Optus, Vodafone and Virgin have been tested by myself)</p>
<p>First, unlock according to this guide: &#8220;Mac&#8221;:http://www.iclarified.com/entry/index.php?enid=893 &#8220;Windows&#8221;:http://www.iclarified.com/entry/index.php?enid=849<br />
Then, tap on installer on the home screen. Tap on sources at the bottom right. Tap edit, then add. Enter http://wpool.com/iphone , then tap OK. Wait for it to refresh the sources, then tap on Install on the bottom of the screen. Scroll down to the localisation (1.1.4) menu, then for each item in there tap on it, then tap install. Once they are all down hold down the power button to turn the phone off, then turn it back on - and enjoy!</p>
<p>Sorry if this is a little short - kinda busy right now!</p>
<img src="http://feeds.lstoll.net/~r/lstollnet/~4/343139885" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lstoll.net/2008/04/quick-guide-to-making-an-iphone-work-in-australia-114/feed/</wfw:commentRss>
		<feedburner:origLink>http://lstoll.net/2008/04/quick-guide-to-making-an-iphone-work-in-australia-114/</feedburner:origLink></item>
		<item>
		<title>Passenger (a.k.a. mod_rails)</title>
		<link>http://feeds.lstoll.net/~r/lstollnet/~3/343139886/</link>
		<comments>http://lstoll.net/2008/04/passenger-aka-mod_rails/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 00:58:51 +0000</pubDate>
		<dc:creator>lstoll</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://staging.lstoll.net/?p=29</guid>
		<description><![CDATA[Passenger is now available for download - http://www.modrails.com .  If you haven&#8217;t heard of it, is basically an apache module for running rails apps - nice and easily. I&#8217;ve just moved it over to this site, and it was incredibly easy. The install on my ubuntu server went like this:

1
2
3
sudo apt-get install apache2-prefork-dev libapr1-dev
sudo [...]]]></description>
			<content:encoded><![CDATA[<p>Passenger is now available for download - http://www.modrails.com .  If you haven&#8217;t heard of it, is basically an apache module for running rails apps - nice and easily. I&#8217;ve just moved it over to this site, and it was incredibly easy. The install on my ubuntu server went like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sudo</span> apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> apache2-prefork-dev libapr1-dev
<span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> passenger
passenger-install-apache2-module</pre></td></tr></table></div>

<p>I then added the apache config lines to the end of the apache config, and set my site up like:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;VirtualHost</span> *:<span style="color: #cc66cc;">80</span><span style="font-weight: bold; color: black;">&gt;</span></span>
ServerName lstoll.net
DocumentRoot /home/xxx/sites/lstoll.net/current/public
ServerAdmin xxx@xxx.net
ErrorLog /home/xxx/logs/lstoll.net_error.log
CustomLog /home/xxx/logs/lstoll.net_access.log combined
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/VirtualHost<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Then, when apache started up it automatically started the rails app, and it just worked.  It&#8217;s simple to use with capistrano, here&#8217;s my deploy tasks from deploy.rb:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="ruby">namespace <span style="color:#ff3333; font-weight:bold;">:deploy</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  desc <span style="color:#996600;">&quot;Custom restart task for passenger&quot;</span>
  task <span style="color:#ff3333; font-weight:bold;">:restart</span>, <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#ff3333; font-weight:bold;">:except</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:no_release</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    run <span style="color:#996600;">&quot;touch #{deploy_to}/current/tmp/restart.txt&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  desc <span style="color:#996600;">&quot;Custom start task for passenger&quot;</span>
  task <span style="color:#ff3333; font-weight:bold;">:start</span>, <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:app</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#008000; font-style:italic;"># Don't need to do anything, it's automatic</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  desc <span style="color:#996600;">&quot;Custom stop task for passenger&quot;</span>
  task <span style="color:#ff3333; font-weight:bold;">:stop</span>, <span style="color:#ff3333; font-weight:bold;">:roles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:app</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#008000; font-style:italic;"># currently no way I know of to 'stop' the app</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Once that is done, capistrano can flag to passenger to restart the app.</p>
<p>A bit of casual benchmarking shows it&#8217;s fast too. I&#8217;m very happy this is out there, it makes running rails apps as easy as PHP - saving all the messing around with mongrel/thin/monit. It also works with rails caching, so so more messing around with rewrite rules to get cached files to be read right off disk. This should hopefully make rails better on shared hosts, and lower the barrier of entry. Only downside is that this is currently rails only - so for merb/camping/anything else the old way is still needed. I&#8217;m hoping that soon passenger will support rack, or mod_rack/mod_rubinius will come out, so this ease is brought to all ruby frameworks.</p>
<img src="http://feeds.lstoll.net/~r/lstollnet/~4/343139886" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lstoll.net/2008/04/passenger-aka-mod_rails/feed/</wfw:commentRss>
		<feedburner:origLink>http://lstoll.net/2008/04/passenger-aka-mod_rails/</feedburner:origLink></item>
		<item>
		<title>Stand-alone ActiveRecord migrations</title>
		<link>http://feeds.lstoll.net/~r/lstollnet/~3/343139887/</link>
		<comments>http://lstoll.net/2008/04/stand-alone-activerecord-migrations/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 14:01:56 +0000</pubDate>
		<dc:creator>lstoll</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://staging.lstoll.net/?p=27</guid>
		<description><![CDATA[Currently working on a merb project using datamapper - nice framework, but the auto-migrate feature is fairly limited - So I decided to hook up ActiveRecord&#8217;s migrations into the app. This code could be equally as easily adapted in to anything else.
First, I created a folder for the migrations to live in:

1
mkdir -p db/ar_migrations

I then [...]]]></description>
			<content:encoded><![CDATA[<p>Currently working on a merb project using datamapper - nice framework, but the auto-migrate feature is fairly limited - So I decided to hook up ActiveRecord&#8217;s migrations into the app. This code could be equally as easily adapted in to anything else.</p>
<p>First, I created a folder for the migrations to live in:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> -p db<span style="color: #000000; font-weight: bold;">/</span>ar_migrations</pre></td></tr></table></div>

<p>I then appended a few tasks ripped out of Rails and slightly tweaked to the Rakefile:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="ruby">APP_BASE = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">expand_path</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
namespace <span style="color:#ff3333; font-weight:bold;">:db</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  task <span style="color:#ff3333; font-weight:bold;">:ar_init</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#008000; font-style:italic;"># Load the database config</span>
    <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'active_record'</span>
    database_yml = <span style="color:#CC00FF; font-weight:bold;">YAML</span>::<span style="color:#CC0066; font-weight:bold;">load</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span>APP_BASE <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/config/database.yml&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    init_env == <span style="color:#996600;">&quot;rake&quot;</span> ? current_env = <span style="color:#996600;">&quot;development&quot;</span>.<span style="color:#9900CC;">to_sym</span> : current_env = init_env.<span style="color:#9900CC;">to_sym</span> <span style="color:#008000; font-style:italic;"># Default to dev env, symbolize</span>
    <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>.<span style="color:#9900CC;">establish_connection</span><span style="color:#006600; font-weight:bold;">&#40;</span>database_yml<span style="color:#006600; font-weight:bold;">&#91;</span>current_env<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#008000; font-style:italic;"># set a logger for STDOUT</span>
    <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>.<span style="color:#9900CC;">logger</span> = <span style="color:#CC00FF; font-weight:bold;">Logger</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>STDOUT<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  desc <span style="color:#996600;">&quot;Migrate the database through scripts in db/migrate. Target specific version with VERSION=x. Turn off output with VERBOSE=false.&quot;</span>
  task <span style="color:#ff3333; font-weight:bold;">:migrate</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:ar_init</span>  <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Migration</span>.<span style="color:#9900CC;">verbose</span> = ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;VERBOSE&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span> ? ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;VERBOSE&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span> == <span style="color:#996600;">&quot;true&quot;</span> : <span style="color:#0000FF; font-weight:bold;">true</span>
    <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Migrator</span>.<span style="color:#9900CC;">migrate</span><span style="color:#006600; font-weight:bold;">&#40;</span>APP_BASE <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/db/ar_migrations/&quot;</span>, ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;VERSION&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span> ? ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;VERSION&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span> : <span style="color:#0000FF; font-weight:bold;">nil</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#6666ff; font-weight:bold;">Rake::Task</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;db:schema:dump&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">invoke</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>.<span style="color:#9900CC;">schema_format</span> == <span style="color:#ff3333; font-weight:bold;">:ruby</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  namespace <span style="color:#ff3333; font-weight:bold;">:schema</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    desc <span style="color:#996600;">&quot;Create a db/ar_schema.rb file that can be portably used against any DB supported by AR&quot;</span>
    task <span style="color:#ff3333; font-weight:bold;">:dump</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:ar_init</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'active_record/schema_dumper'</span>
      <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span>ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'SCHEMA'</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">||</span> APP_BASE <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/db/ar_schema.rb&quot;</span>, <span style="color:#996600;">&quot;w&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>file<span style="color:#006600; font-weight:bold;">|</span>
        <span style="color:#6666ff; font-weight:bold;">ActiveRecord::SchemaDumper</span>.<span style="color:#9900CC;">dump</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>.<span style="color:#9900CC;">connection</span>, file<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    desc <span style="color:#996600;">&quot;Load a ar_schema.rb file into the database&quot;</span>
    task <span style="color:#ff3333; font-weight:bold;">:load</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:ar_init</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      file = ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'SCHEMA'</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">||</span> APP_BASE <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;/db/ar_schema.rb&quot;</span>
      <span style="color:#CC0066; font-weight:bold;">load</span><span style="color:#006600; font-weight:bold;">&#40;</span>file<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>These will read from database.yml in config/ , so make sure you&#8217;ve got datamapper set up.</p>
<p>Lastly, Let&#8217;s create an example migration to create the datamapper sessions table in db/ar_migrations/001_create_dm_session_table.rb:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="ruby"><span style="color:#9966CC; font-weight:bold;">class</span> CreateDmSessionTable <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Migration</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">up</span>
    create_table<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:sessions</span>, <span style="color:#ff3333; font-weight:bold;">:id</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span>
      t.<span style="color:#CC0066; font-weight:bold;">string</span> <span style="color:#ff3333; font-weight:bold;">:session_id</span>, <span style="color:#ff3333; font-weight:bold;">:null</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span>
      t.<span style="color:#9900CC;">text</span> <span style="color:#ff3333; font-weight:bold;">:data</span>
      t.<span style="color:#9900CC;">timestamp</span> <span style="color:#ff3333; font-weight:bold;">:updated_at</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#008000; font-style:italic;"># Need this because ar in unhappy with a varchar primary key</span>
    sql = <span style="color:#996600;">&quot;ALTER TABLE sessions ADD CONSTRAINT sessions_pkey PRIMARY KEY  ( session_id )&quot;</span>
    execute<span style="color:#006600; font-weight:bold;">&#40;</span>sql<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
    add_index <span style="color:#ff3333; font-weight:bold;">:sessions</span>, <span style="color:#ff3333; font-weight:bold;">:session_id</span>
    add_index <span style="color:#ff3333; font-weight:bold;">:sessions</span>, <span style="color:#ff3333; font-weight:bold;">:updated_at</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">down</span>
    drop_table <span style="color:#ff3333; font-weight:bold;">:sessions</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Once this is done, you can run rake db:migrate , and the DB will get the sessions table added. The db:schema:load task is also there, so you should use this when you first deploy your app to a new server. The naming is also consistent with rails, so capistrano should interact with it out of the box, with the exception that the environment to load/migrate needs to be called MERB_ENV instead of RAILS_ENV</p>
<p>When creating additional migrations you will need to follow the &#8216;proper&#8217; naming scheme: the filename should start with an incrementing three digit number, and the rest should be a &#8216;flattened&#8217; version of the class name. (i.e migration class AddPostTable becomes add_post_table).</p>
<img src="http://feeds.lstoll.net/~r/lstollnet/~4/343139887" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lstoll.net/2008/04/stand-alone-activerecord-migrations/feed/</wfw:commentRss>
		<feedburner:origLink>http://lstoll.net/2008/04/stand-alone-activerecord-migrations/</feedburner:origLink></item>
		<item>
		<title>Postgres Plus 8.3 + Ruby</title>
		<link>http://feeds.lstoll.net/~r/lstollnet/~3/343139888/</link>
		<comments>http://lstoll.net/2008/03/postgres-plus-83-ruby/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 04:08:59 +0000</pubDate>
		<dc:creator>lstoll</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://staging.lstoll.net/?p=23</guid>
		<description><![CDATA[EnterpriseDB have done some reshuffling, and have release a package called Postgres Plus - contains their tweaked version of postgresql bundled with some other pieces for a bunch of platforms including mac - well recommended.
I did have a few problems getting the postgres gem working with it - here&#8217;s what I had to do
*Mac OS [...]]]></description>
			<content:encoded><![CDATA[<p>EnterpriseDB have done some reshuffling, and have release a package called Postgres Plus - contains their tweaked version of postgresql bundled with some other pieces for a bunch of platforms including mac - well recommended.</p>
<p>I did have a few problems getting the postgres gem working with it - here&#8217;s what I had to do</p>
<p>*Mac OS X:*</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash"><span style="color: #007800;">PATH=</span><span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>PostgresPlus<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.3</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> postgres -- --with-pg-<span style="color: #007800;">include=</span><span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>PostgresPlus<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.3</span><span style="color: #000000; font-weight: bold;">/</span>include --with-pg-<span style="color: #007800;">lib=</span><span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>PostgresPlus<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.3</span><span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #007800;">ARCHFLAGS=</span><span style="color: #ff0000;">'-arch i386'</span></pre></td></tr></table></div>

<p>*Linux:*</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash"><span style="color: #007800;">PATH=</span><span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>PostgresPlus<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.3</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> -s <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libssl.so<span style="color: #000000;">.0</span><span style="color: #000000;">.9</span><span style="color: #000000;">.8</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libssl.so<span style="color: #000000;">.4</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> -s <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libcrypto.so<span style="color: #000000;">.0</span><span style="color: #000000;">.9</span><span style="color: #000000;">.8</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libcrypto.so<span style="color: #000000;">.4</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> postgres -- --with-pg-<span style="color: #007800;">include=</span><span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>PostgresPlus<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.3</span><span style="color: #000000; font-weight: bold;">/</span>include --with-pg-<span style="color: #007800;">lib=</span><span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>PostgresPlus<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.3</span><span style="color: #000000; font-weight: bold;">/</span>lib</pre></td></tr></table></div>

<p>You&#8217;ll probably want to make the PATH change permanent for access to psql.</p>
<p>And that should get you going. Those of you who use postgres should definately check it out at &#8220;http://www.enterprisedb.com/&#8221;:http://www.enterprisedb.com/ - and for those using any other DB it&#8217;s worth checking out too.</p>
<img src="http://feeds.lstoll.net/~r/lstollnet/~4/343139888" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lstoll.net/2008/03/postgres-plus-83-ruby/feed/</wfw:commentRss>
		<feedburner:origLink>http://lstoll.net/2008/03/postgres-plus-83-ruby/</feedburner:origLink></item>
		<item>
		<title>SSL/HTTPS Support error with MacPorts Mercurial 1.0</title>
		<link>http://feeds.lstoll.net/~r/lstollnet/~3/343139889/</link>
		<comments>http://lstoll.net/2008/01/sslhttps-support-error-with-macports-mercurial-10/#comments</comments>
		<pubDate>Sun, 06 Jan 2008 12:23:21 +0000</pubDate>
		<dc:creator>lstoll</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://staging.lstoll.net/?p=25</guid>
		<description><![CDATA[I recently upgraded to mercurial 1.0 using macports, and when I tried to communicate with a HTTPS repository I got the following error:

1
abort: Python support for SSL and HTTPS is not installed

The solution was simple:

1
sudo port install py25-socket-ssl

After that, HTTPS operations worked fine.
]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded to mercurial 1.0 using macports, and when I tried to communicate with a HTTPS repository I got the following error:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash">abort: Python support <span style="color: #000000; font-weight: bold;">for</span> SSL and HTTPS is not installed</pre></td></tr></table></div>

<p>The solution was simple:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> py25-socket-ssl</pre></td></tr></table></div>

<p>After that, HTTPS operations worked fine.</p>
<img src="http://feeds.lstoll.net/~r/lstollnet/~4/343139889" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lstoll.net/2008/01/sslhttps-support-error-with-macports-mercurial-10/feed/</wfw:commentRss>
		<feedburner:origLink>http://lstoll.net/2008/01/sslhttps-support-error-with-macports-mercurial-10/</feedburner:origLink></item>
		<item>
		<title>Installing Mercurial on Ubuntu 7.04</title>
		<link>http://feeds.lstoll.net/~r/lstollnet/~3/343139890/</link>
		<comments>http://lstoll.net/2007/11/installing-mercurial-on-ubuntu-704/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 09:17:18 +0000</pubDate>
		<dc:creator>lstoll</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://staging.lstoll.net/?p=21</guid>
		<description><![CDATA[I&#8217;ve finally decided to bite the bullet and move to a distributed VCS - after looking around it seems that mercurial is the way to go. There is a TextMate bundle for it, and NetBeans plugin, Trac plugin, and seems to be well supported. I also looked around and particularly at git - however even [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally decided to bite the bullet and move to a distributed VCS - after looking around it seems that mercurial is the way to go. There is a TextMate bundle for it, and NetBeans plugin, Trac plugin, and seems to be well supported. I also looked around and particularly at git - however even though its name comes up often, it doesn&#8217;t seem to have anywhere near the support.</p>
<p>So this is a little document I put together on how I got it up and running on my Ubuntu 7.04 server, with trac support and web access. This document extends my previous setup doc which as of yet unpublished - to it is assumed you already have trac and subversion installed, with a htpasswd file for authentication against them located at /etc/apache2/projects.htpasswd - please adjust the references to this below to suit your environment. You will also need to make changes to the apache config file to suit your naming etc.</p>
<p><span id="more-21"></span></p>
<h3>Getting the basic system up and running</h3>
<p>Start a root shell &#038; install install the software:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sudo</span> -s
apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> mercurial</pre></td></tr></table></div>

<p>Set up the repository storage</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> -p <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>hg<span style="color: #000000; font-weight: bold;">/</span>htdocs
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>hg<span style="color: #000000; font-weight: bold;">/</span>repos
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>mercurial<span style="color: #000000; font-weight: bold;">/</span>examples<span style="color: #000000; font-weight: bold;">/</span>hgwebdir.cgi <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>hg<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span></pre></td></tr></table></div>

<p>Create the apache config file /etc/apache2/sites-available/hg.lstoll.net and make it look like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td><td class="code"><pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;VirtualHost</span> *:<span style="color: #cc66cc;">80</span><span style="font-weight: bold; color: black;">&gt;</span></span>
ServerName hg.lstoll.net
RewriteEngine On
RewriteRule ^/(.*)$ https://hg.lstoll.net/$1 [R]
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/VirtualHost<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;VirtualHost</span> *:<span style="color: #cc66cc;">443</span><span style="font-weight: bold; color: black;">&gt;</span></span>
ServerName hg.lstoll.net
DocumentRoot /var/lib/hg/htdocs
ServerAdmin lstoll@lstoll.net
ErrorLog /var/log/apache2/hg.lstoll.net_ssl_error.log
CustomLog /var/log/apache2/hg.lstoll.net_ssl_access.log combined
&nbsp;
RewriteEngine on
RewriteRule ^/(.*) /hgwebdir.cgi/$1
&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;Directory</span> /var/lib/hg/htdocs<span style="font-weight: bold; color: black;">&gt;</span></span>
DirectoryIndex hgwebdir.cgi
AddHandler cgi-script .cgi
Options ExecCGI
AllowOverride None
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/Directory<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;Location</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
AuthUserFile /etc/apache2/projects.htpasswd
AuthType Basic
AuthName &quot;hg.lstoll.net&quot;
Require valid-user
Order allow,deny
allow from all
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/Location<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/VirtualHost<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Create the hg web directory config file</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>hg<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span>hgweb.config <span style="color: #000000; font-weight: bold;">&lt;&lt;</span> EOF
<span style="color: #7a0874; font-weight: bold;">&#91;</span>collections<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>hg<span style="color: #000000; font-weight: bold;">/</span>repos<span style="color: #000000; font-weight: bold;">/</span> = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>hg<span style="color: #000000; font-weight: bold;">/</span>repos
<span style="color: #7a0874; font-weight: bold;">&#91;</span>web<span style="color: #7a0874; font-weight: bold;">&#93;</span>
style = gitweb
EOF</pre></td></tr></table></div>

<p>Correct permissions, and enable the site in apache</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">chown</span> -R www-data:www-data <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>hg
<span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>hg<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span>hgwebdir.cgi
a2ensite hg.lstoll.net
apache2ctl graceful</pre></td></tr></table></div>

<p>You should now be able to browse to the site, authenticate, and see that their is no repositories available. So lets create one:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">su</span> www-data -c <span style="color: #ff0000;">&quot;hg init /var/lib/hg/repos/hgtest&quot;</span></pre></td></tr></table></div>

<p>You should now have a basic mercurial environment up and running.</p>
<p>If like me you used user@host for the htpasswd usernames previously (so you can do things like have trac send email notifications), you will need to also add usernames without the @ symbol - mercurial doesn&#8217;t seem to handle these well when trying to save a username and password in a clone operation. I now maintain both a user@host and user accounts for all users.</p>
<h3>Migrating a SVN repository into your new setup</h3>
<p>Install hgsvn</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash">apt-get <span style="color: #c20cb9; font-weight: bold;">install</span> python-setuptools
easy_install hgsvn</pre></td></tr></table></div>

<p>change to the repo dir, and import the repository</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="bash"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>hg<span style="color: #000000; font-weight: bold;">/</span>repos
<span style="color: #c20cb9; font-weight: bold;">su</span> www-data -c <span style="color: #ff0000;">&quot;hgimportsvn file:///var/lib/svn/test&quot;</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #7a0874; font-weight: bold;">test</span>
<span style="color: #c20cb9; font-weight: bold;">su</span> www-data -c <span style="color: #ff0000;">&quot;hgpullsvn&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">su</span> www-data -c <span style="color: #ff0000;">&quot;hg update&quot;</span></pre></td></tr></table></div>

<p>Clean out the svn remnants</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">find</span> . -name .svn <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> -fr
<span style="color: #c20cb9; font-weight: bold;">find</span> . -name .hgignore <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> -fr</pre></td></tr></table></div>

<h3>Setting up the trac integration</h3>
<p>Install the plugin</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="bash"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>trac<span style="color: #000000; font-weight: bold;">/</span>plugins
svn <span style="color: #c20cb9; font-weight: bold;">co</span> http:<span style="color: #000000; font-weight: bold;">//</span>svn.edgewall.com<span style="color: #000000; font-weight: bold;">/</span>repos<span style="color: #000000; font-weight: bold;">/</span>trac<span style="color: #000000; font-weight: bold;">/</span>sandbox<span style="color: #000000; font-weight: bold;">/</span>mercurial-plugin
<span style="color: #7a0874; font-weight: bold;">cd</span> mercurial-plugin
python setup.py bdist_egg
<span style="color: #7a0874; font-weight: bold;">cd</span> dist
easy_install TracMercurial<span style="color: #000000;">-0.10</span><span style="color: #000000;">.0</span><span style="color: #000000;">.2</span>-py2<span style="color: #000000;">.5</span>.egg</pre></td></tr></table></div>

<p>(note - the egg filename may differ for you)<br />
Edit the config file for the project you are moving to mercurial</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>trac<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span><span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>trac.ini</pre></td></tr></table></div>

<p>enable the plugin by adding something like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash"><span style="color: #7a0874; font-weight: bold;">&#91;</span>components<span style="color: #7a0874; font-weight: bold;">&#93;</span>
tracvc.hg.<span style="color: #000000; font-weight: bold;">*</span> = enabled</pre></td></tr></table></div>

<p>You will also need to change your repository config to something like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash"><span style="color: #7a0874; font-weight: bold;">&#91;</span>trac<span style="color: #7a0874; font-weight: bold;">&#93;</span>
repository_type = hg
repository_dir = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>hg<span style="color: #000000; font-weight: bold;">/</span>repos<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span></pre></td></tr></table></div>

<p>Your trac project is now set up to read the mercurial repository</p>
<h3>Installing the client on Mac OS X, and checking it out</h3>
<p>This assumes you have <a href="http://macports.org" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://macports.org');">macports</a> Installed.</p>
<p>Install mercurial</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> mercurial</pre></td></tr></table></div>

<p>Create a local copy to work with:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash">hg clone http:<span style="color: #000000; font-weight: bold;">//</span>username:password<span style="color: #000000; font-weight: bold;">@</span>hg.lstoll.net<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span></pre></td></tr></table></div>

<p>Replace username and password with the username and password you set up. Quick note - your password will be stored in an insecure format, and will be echoed on the screen when performing an operation against the central repository - be aware of this<br />
(Optional) Set up the Mercurial TextMate bundle</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> -p ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles
<span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles
svn <span style="color: #c20cb9; font-weight: bold;">co</span> http:<span style="color: #000000; font-weight: bold;">//</span>macromates.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Mercurial.tmbundle</pre></td></tr></table></div>

<p>Sources: http://ww2.samhart.com/book/export/html/49<br />
http://www.selenic.com/mercurial/wiki/index.cgi/HgWebDirStepByStep</p>
<img src="http://feeds.lstoll.net/~r/lstollnet/~4/343139890" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://lstoll.net/2007/11/installing-mercurial-on-ubuntu-704/feed/</wfw:commentRss>
		<feedburner:origLink>http://lstoll.net/2007/11/installing-mercurial-on-ubuntu-704/</feedburner:origLink></item>
	</channel>
</rss>
