<?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>A programmer&#039;s rants &#187; warehouse</title>
	<atom:link href="http://blog.andremedeiros.info/tag/warehouse/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.andremedeiros.info</link>
	<description>Random rants about code and life.</description>
	<lastBuildDate>Fri, 25 Sep 2009 10:40:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Warehouse installation tutorial</title>
		<link>http://blog.andremedeiros.info/2008/10/warehouse-installation-tutorial/</link>
		<comments>http://blog.andremedeiros.info/2008/10/warehouse-installation-tutorial/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 00:28:39 +0000</pubDate>
		<dc:creator>changelog</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[active reload]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[justin palmer]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rick olson]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[warehouse]]></category>

		<guid isPermaLink="false">http://blog.andremedeiros.info/?p=20</guid>
		<description><![CDATA[Today I got to the office, and the first thing that popped into my eyes when I opened Twitterrific was this:]]></description>
			<content:encoded><![CDATA[<p>Today I got to the office, and the first thing that popped into my eyes when I opened Twitterrific was this:</p>
<p><a href="http://blog.andremedeiros.info/wp-content/uploads/2008/10/twitterrific.png"><img src="http://blog.andremedeiros.info/wp-content/uploads/2008/10/twitterrific.png" alt="Rick Olson announces that Warehouse goes open-source" " title="Rick Olson announces that Warehouse goes open-source" width="433" height="349" class="aligncenter size-full wp-image-21" /></a></p>
<p><a href="http://techno-weenie.net/">Rick Olson</a> <a href="http://github.com/entp/warehouse/tree/master">announcing that Warehouse is now open-source</a>. Damn, it HAS to be Christmas! I have always loved the products that <a href="http://activereload.net/">Active Reload</a> builds, mostly because they follow the &#8220;do more with less&#8221; and &#8220;keep it simple stupid&#8221; principles, but also because their web-applications look awesome, thanks to <a href="http://alternateidea.com/">Justin Palmer</a>, the self-taught and self-proclaimed Design Ninja (I&#8217;ll have to agree with him on this one).</p>
<p>I have always wanted to give Warehouse a spin on my projects (professional and personal), but never got around to buy it because I was afraid it could be of no use for me (you guys have to find a way to distribute trials or something). Now that it&#8217;s open-source, I am going to try and provide a guide on how to install it.</p>
<p><span id="more-20"></span></p>
<h3>Step 1. Requirements</h3>
<p>Since I don&#8217;t have a spare computer lying around, I&#8217;m going to create a virtual machine to accomplish the task. I&#8217;ll try to build a dedicated SVN server, using <a href="http://www.ubuntu.com/getubuntu/download">Ubuntu Server</a> (you can use anything else that&#8217;s <a href="http://www.debian.org/misc/children-distros">Debian based</a>) so all the dependencies will be installed using <code>apt-get</code> <img src='http://blog.andremedeiros.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Please take note that this is not a solution to be used in a production environment. It is most suited for &#8220;evaluation&#8221; purposes.</p>
<p>As for what virtualization software is concerned, there are several options:</p>
<ul>
<li><strong>Windows:</strong>
<ol>
<li><a href="http://www.virtualbox.org/">VirtualBox</a> (free, as in beer or open-source)</li>
<li><a href="http://www.vmware.com/products/server/">VMWare Server</a> (free, as in beer)</li>
<li><a href="http://www.vmware.com/products/ws/">VMWare Workstation</a> (commercial, starts at $189.00)</li>
<li><a href="http://www.microsoft.com/windows/products/winfamily/virtualpc/default.mspx">Microsoft Virtual PC</a> (free, as in beer, has a few quirks with Linux as guest)</li>
</ol>
</li>
<li><strong>Linux:</strong>
<ol>
<li><a href="http://www.virtualbox.org/">VirtualBox</a> (free, as in beer or open-source)</li>
<li><a href="http://www.vmware.com/products/server/">VMWare Server</a> (free, as in beer)</li>
</ol>
</li>
<li><strong>Mac OS X:</strong>
<ol>
<li><a href="http://www.virtualbox.org/">VirtualBox</a> (free, as in beer or open-source)</li>
<li><a href="http://www.vmware.com/products/fusion/">VMWare Fusion</a> (commercial, starts at $79.99, <strong>well worth the money, ahem&#8230;</strong>)</li>
<li><a href="http://www.parallels.com/">Parallels Desktop</a> (commercial, starts at $79.99)</li>
</ol>
</li>
</ul>
<p>So, go ahead and pick one, create a new virtual machine and install Ubuntu Server on that (any of these virtualization solutions can mount an ISO image, which you will have to download from Ubuntu&#8217;s website). I chose <code>svnserver</code> for the server hostname, and <code>developer</code> for the default username.</p>
<h3>Step 2. Creating the user</h3>
<p>Next we need to create a user for our Warehouse installation. The following commands create the <code>warehouse</code> user and add it to the <code>www-data</code> group (the same group Apache runs with by default).</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> adduser warehouse</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> adduser warehouse www-data</div>
</li>
</ol>
</div>
<h3>Step 3. Getting all the dependencies in place</h3>
<p>After creating the user, you&#8217;ll have to add a repository so that you can apt-get the Phusion Passenger Apache module. Edit <code>/etc/apt/sources.list</code> and add the following lines in the end:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="co0"># Phusion Passenger for Apache</span></div>
</li>
<li class="li1">
<div class="de1">deb http:<span class="sy0">//</span>apt.brightbox.net hardy main</div>
</li>
</ol>
</div>
<p>Afterwards, run the following command in order to update your apt repositories and install all the requirements to run Warehouse:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> apt-get update</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> apt-get <span class="kw2">install</span> git-core subversion subversion-tools ruby libsvn-ruby libmysql-ruby libopenssl-ruby ruby1<span class="nu0">.8</span>-dev rdoc ri mysql-server mysql-client apache2 libapache2-mod-passenger</div>
</li>
</ol>
</div>
<p><strong>NB: The Passenger module package might have a bug where the <code>mod_passenger.so</code> is extracted to the root. If that happens, issue the following command:</strong></p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> <span class="kw2">mv</span> <span class="sy0">/</span>mod_passenger.so <span class="sy0">/</span>usr<span class="sy0">/</span>lib<span class="sy0">/</span>apache2<span class="sy0">/</span>modules<span class="sy0">/</span></div>
</li>
</ol>
</div>
<p>Install Rails 2.0.2, Rake and Erubis</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> gem <span class="kw2">install</span> rails -<span class="re2">v=</span><span class="nu0">2.0</span><span class="nu0">.2</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> gem <span class="kw2">install</span> rake</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> gem <span class="kw2">install</span> erubis</div>
</li>
</ol>
</div>
<p>Create a mysql user and databases for Warehouse:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">mysqladmin create warehouse -h localhost -u root -p</div>
</li>
<li class="li1">
<div class="de1">mysqladmin create warehouse_development -h localhost -u root -p</div>
</li>
<li class="li1">
<div class="de1">mysqladmin create warehouse_test -h localhost -u root -p</div>
</li>
</ol>
</div>
<p>To add a new user and give it permission to those databases, run these commands inside a mysql shell:</p>
<div class="geshi no sql">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">GRANT</span> <span class="kw1">ALL</span> PRIVILEGES <span class="kw1">ON</span> warehouse.* <span class="kw1">TO</span> <span class="st0">&#39;warehouse&#39;</span>@<span class="st0">&#39;localhost&#39;</span> <span class="kw1">IDENTIFIED</span> <span class="kw1">BY</span> <span class="st0">&#39;warehouse_user_password&#39;</span> <span class="kw1">WITH</span> <span class="kw1">GRANT</span> <span class="kw1">OPTION</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">GRANT</span> <span class="kw1">ALL</span> PRIVILEGES <span class="kw1">ON</span> warehouse_development.* <span class="kw1">TO</span> <span class="st0">&#39;warehouse&#39;</span>@<span class="st0">&#39;localhost&#39;</span> <span class="kw1">IDENTIFIED</span> <span class="kw1">BY</span> <span class="st0">&#39;warehouse_user_password&#39;</span> <span class="kw1">WITH</span> <span class="kw1">GRANT</span> <span class="kw1">OPTION</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">GRANT</span> <span class="kw1">ALL</span> PRIVILEGES <span class="kw1">ON</span> warehouse_test.* <span class="kw1">TO</span> <span class="st0">&#39;warehouse&#39;</span>@<span class="st0">&#39;localhost&#39;</span> <span class="kw1">IDENTIFIED</span> <span class="kw1">BY</span> <span class="st0">&#39;warehouse_user_password&#39;</span> <span class="kw1">WITH</span> <span class="kw1">GRANT</span> <span class="kw1">OPTION</span>;</div>
</li>
</ol>
</div>
<h3>Step 4. Creating first SVN repository and gitting Warehouse</h3>
<p>
Login as <code>warehouse</code>. First off, we&#8217;ll create our first repository that will hold your project. Here&#8217;s how to do it:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">mkdir</span> svn</div>
</li>
<li class="li1">
<div class="de1">svnadmin create svn<span class="sy0">/</span>topsecretproject</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">chown</span> -R :www-data svn</div>
</li>
</ol>
</div>
<p>We&#8217;ll assume <code>topsecretproject</code> is your project name. Next, inside your home directory, issue the following commands:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">git clone git:<span class="sy0">//</span>github.com<span class="sy0">/</span>entp<span class="sy0">/</span>warehouse.git www</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">chown</span> -R :www-data www</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">chmod</span> -R <span class="nu0">775</span> www</div>
</li>
</ol>
</div>
<p>This will checkout the Warehouse code into <code>/home/warehouse/www/</code>. You can also <a href="http://github.com/entp/warehouse/tarball/master">get a tarball</a>, but using this method is easier if you want to stay on the edge (I hear Rick is adding git support into Warehouse). It will also make the directory readable by the <code>www-data</code> group.<br />
Next, we need to configure the database and run the first migration:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw3">cd</span> www</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">cp</span> config<span class="sy0">/</span>database.sample.yml config<span class="sy0">/</span>database.yml</div>
</li>
</ol>
</div>
<p>Edit database.yml and put in the correct values. After that, head back to <code>/home/warehouse/www/</code> and run:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">mkdir</span> log </div>
</li>
<li class="li1">
<div class="de1">rake tmp:create</div>
</li>
<li class="li1">
<div class="de1"><span class="re2">RAILS_ENV=</span>production rake db:schema:load</div>
</li>
</ol>
</div>
<h3>Step 5. Creating the Apache virtualhost</h3>
<p>
Log in again as the <code>developer</code> user, and cd to <code>/etc/apache2/sites-available/</code>. In that directory, create a file named <code>warehouse-site</code> with the following content:</p>
<div class="geshi no apache">
<ol>
<li class="li1">
<div class="de1">&lt;VirtualHost *:<span class="nu0">80</span>&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">DocumentRoot</span> /home/warehouse/www/public</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">ErrorLog</span> /var/log/apache2/warehouse_error.log</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">LogLevel</span> warn</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">CustomLog</span> /var/log/apache2/warehouse_access.log combined</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; RailsEnv production</div>
</li>
<li class="li1">
<div class="de1">&lt;/VirtualHost&gt;</div>
</li>
</ol>
</div>
<p>Finally, issue the following commands to enable the site you just configured, remove the default one, activate the rewrite module and restart apache:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> <span class="kw2">ln</span> -s <span class="sy0">/</span>etc<span class="sy0">/</span>apache2<span class="sy0">/</span>sites-available<span class="sy0">/</span>warehouse-site <span class="sy0">/</span>etc<span class="sy0">/</span>apache2<span class="sy0">/</span>sites-enabled<span class="sy0">/</span>warehouse-site</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> <span class="kw2">rm</span> <span class="sy0">/</span>etc<span class="sy0">/</span>apache2<span class="sy0">/</span>sites-enabled<span class="sy0">/</span><span class="nu0">000</span>-default</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> a2enmod rewrite</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> apache2ctl restart</div>
</li>
</ol>
</div>
<p>Now all you have to do is to open a browser window and type <code>http://&lt;your_virtual_machine_ip&gt;/install</code> in the URL and you&#8217;ll be up and running. I recommend, however, that you define the site with a <code>ServerName</code>, so that the sub-domains work properly.
</p>
<h3>Step 6. Giving your svn server a domain name and accessing it</h3>
<p>
Edit <code>/etc/apache2/sites-available/warehouse-site</code> and, right after the <code>&lt;VirtualHost&gt;</code> tag, add the following line:</p>
<div class="geshi no apache">
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">ServerName</span> svnserver.dev</div>
</li>
</ol>
</div>
<p>You can change <code>svnserver.dev</code> to whatever you like. Afterwards, add that host to your hosts file. Here&#8217;s how to do it in <a href="http://www.mvps.org/winhelp2002/hostsfaq.htm#Editor">Windows</a>, <a href="http://www.lockergnome.com/linux/2004/10/20/using-the-etchosts-file/">Linux</a> or <a href="http://www.mactips.org/archives/2007/07/19/modify-hosts-file-change-your-local-dns/">Mac OS X</a>. If all goes well, enter the new URL (including <code>/install</code> in the end) in your browser, and you should be seeing something like this:
</p>
<p><a href="http://blog.andremedeiros.info/wp-content/uploads/2008/10/safari.png"><img src="http://blog.andremedeiros.info/wp-content/uploads/2008/10/safari-300x243.png" alt="Warehouse installation screen" title="Warehouse installation screen" width="300" height="243" class="aligncenter size-medium wp-image-22" /></a></p>
<p>In doubt, fill the &#8220;Absolute path to repository&#8221; with the following value:<br />
<code>/home/warehouse/svn/topsecretproject/</code>, where <code>topsecretproject</code> is the repository name you&#8217;ve created in step 4. Also, after completing the installation, you might get an URL like <code>http://topsecretproject.svnserver.dev/</code>. In that case, you&#8217;ll have to go back to your hosts file and add another entry with that hostname.</p>
<h3>Wrapping up</h3>
<p>
<a href="http://blog.andremedeiros.info/wp-content/uploads/2008/10/safariscreensnapz012.png"><img src="http://blog.andremedeiros.info/wp-content/uploads/2008/10/safariscreensnapz012-300x203.png" alt="" title="Warehouse up and running" width="300" height="203" class="aligncenter size-medium wp-image-23" /></a><br />
There you have it. Warehouse up and running syncing your first (and empty) repository. To serve it through apache (ie. enable you to make commits outside of the virtual machine), check <a href="http://www.geocities.com/arhuaco/doc/subversion/apache-subversion-in-debian.html">this tutorial out</a>. I hope this helps you in any way. I would appreciate some feedback, so don&#8217;t hesitate to fill that little form bellow.</p>
<p>Thanks and see you next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andremedeiros.info/2008/10/warehouse-installation-tutorial/feed/</wfw:commentRss>
		<slash:comments>54</slash:comments>
		</item>
	</channel>
</rss>

