<?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>DrElmo, Code Monkey &#187; Hosting</title>
	<atom:link href="http://www.drelmo.net/category/hosting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.drelmo.net</link>
	<description>A place for my ramblings</description>
	<lastBuildDate>Wed, 28 Sep 2011 21:57:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Open Past&#8230; what day?</title>
		<link>http://www.drelmo.net/2008/03/03/open-past-what-day/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-past-what-day</link>
		<comments>http://www.drelmo.net/2008/03/03/open-past-what-day/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 18:37:53 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[CogSci 121: HCI Programming]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.drelmo.net/2008/03/03/open-past-what-day/</guid>
		<description><![CDATA[It&#8217;s been too long since the last update, especially since we&#8217;ve overcome a lot of hurdles in building this system. I&#8217;ll talk about each in its own right. Hours of Operation The primary quandary we faced was in how to represent a store&#8217;s hours of operation in the database. The obvious implementation is to have [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been too long since the last update, especially since we&#8217;ve overcome a lot of hurdles in building this system.  I&#8217;ll talk about each in its own right.</p>
<h2>Hours of Operation</h2>
<p>The primary quandary we faced was in how to represent a store&#8217;s hours of operation in the database. The obvious implementation is to have separate columns for each day&#8217;s open and close times.  This gives us 14 columns added to the &#8216;store&#8217; table, named &#8216;monday_open&#8217;, &#8216;monday_close&#8217;, &#8216;tuesday_open&#8217;&#8230; and so on.  Since we have a different column for each day, it would make sense to have the column be of type &#8216;<em>time</em>&#8216; right?  <strong>No!</strong></p>
<p>Especially because we&#8217;re dealing with locations that are open late, we need to deal with cases like <strong>&#8220;On Monday, we&#8217;re open from 10am &#8211; 2am&#8221;</strong>.  If the columns only handle time, then we&#8217;ll have a store with <strong>monday_open = 10:00</strong> and <strong>monday_close = 2:00</strong>.  That means we need to do some serious condition checking to see if its open.  Better yet, how do we query for all stores that are open at a specific time? Not very efficient.</p>
<p>So how did we deal with this?  We want the columns to be able to know not just the time of day, but also the day of the week.  For the example above, we want the columns to read more like <strong>monday_open = Mon 10:00</strong> and <strong>monday_close = Tue 2:00</strong>. This would make queries a whole lot easier, as we can resort to a simple <strong>open &lt; right_now &lt; close</strong> test, without having to create extra logic. But SQL databases don&#8217;t have a type to represent time + day of week.  The options are <em>time</em> (hours, minutes, seconds only) or fullblown <em>datetime</em> (year, month, day, hour, etc). Since we&#8217;ve concluded that <em>time</em> is not enough on its own, we&#8217;re forced into using a full <em>datetime </em>field.</p>
<p>But wait! That means <strong>monday_close</strong> will look more like <strong>March 4, 2008 2:00 -0800</strong>. How are you going to deal with the comparisons when it&#8217;s now June? The condition will always fail, thinking the store closed months ago! And that&#8217;s where our solution comes in. The solution is, to some degree, in the question.  Our comparisons will involve the entire <em>datetime</em>, but we only care about day-of-week and time. Therefore, we just need to pick arbitrary values for the rest of the <em>datetime</em> fields and have the code enforce their usage. We ended up using the week of Jan 1, 2007 for our project, primarily because Jan 1 is a Monday, making it very easy to translate a number to day-of-week. Throw in a few helper functions to make the date translation seamless to the user, and we&#8217;re set!</p>
<h2>Website Hosting</h2>
<p>As I said in my previous <a href="http://www.drelmo.net/2007/09/11/my-top-2-web-hosting-companies/">post about web hosting companies</a>, DreamHost is a great cheap shared-hosting solution, but its Rails support leaves a bit to be desired. I was pleased to see that they&#8217;ve cleaned up their <a href="http://wiki.dreamhost.com/Rails" target="_blank">documentation</a>, and getting a Rails site running requires a lot fewer hacks now. But the speed issue is still a huge one. Big enough for me to still say that for a commercial Rails app, I would not use them. For a class project, they&#8217;re perfect.</p>
<h2>Introducing the Team to Rails</h2>
<p>We&#8217;ve transitioned the project to Rails completely, which has made, as usual, a lot of grunt work disappear into thin air. It&#8217;s working well for what we need from it, albeit a very simple site. The real issue with Rails is that, being so new, still very few people know about it, much less have used it before. Whenever introducing a group of people to a new technology, you&#8217;re going to have mixed results, and our team is no exception. Some have taken to it excitedly, some with reserve, and some are just not very interested. All this is fine, especially since there&#8217;s plenty of work to do outside of Rails. It&#8217;s interesting to have such a cross-section of reactions to it all working together.</p>
<h2>Interfacing with Google</h2>
<p>Since our project employs Google Maps to display store locations, we need to interface with their API. More importantly, we need to load latitude and longitude coordinates of the stores into our own database. Since we all quickly agreed that we didn&#8217;t want to do that by hand, we worked out an alternate solution.</p>
<p>The interface to add a new store to the database employs Google Local Search to find stores that are already in Google&#8217;s system, and therefore already have all of the information we need (except hours). From the search results we get back from Google, we can click a button that then pushes the data up to our own server. Then we go in and set the hours of operation and assign a category. It took a lot of tweaking to get it working right, but after a few hours of Rodolphe working on the client-side Javascript and me working on the server-side receiving end, we got it ironed out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drelmo.net/2008/03/03/open-past-what-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up your own Ubuntu repository on Dreamhost</title>
		<link>http://www.drelmo.net/2007/09/17/setting-up-your-own-ubuntu-repository-on-dreamhost/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setting-up-your-own-ubuntu-repository-on-dreamhost</link>
		<comments>http://www.drelmo.net/2007/09/17/setting-up-your-own-ubuntu-repository-on-dreamhost/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 05:54:02 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.drelmo.net/2007/09/17/setting-up-your-own-ubuntu-repository-on-dreamhost/</guid>
		<description><![CDATA[Following up on my post about installing a receipt printer on Ubuntu, I mentioned that I would post my experiences setting up a Ubuntu repository. Most of the documentation out there only covers setting up a repo on your own local machine, for your own local use only. On top of that, the docs vary [...]]]></description>
			<content:encoded><![CDATA[<p>Following up on my post about <a href="http://www.drelmo.net/2007/09/17/installing-a-star-micronics-tsp600-receipt-printer-on-ubuntu-feisty-704/" title="Installing a Star Micronics TSP600 receipt printer on Ubuntu Feisty 7.04">installing a receipt printer on Ubuntu</a>, I mentioned that I would post my experiences setting up a Ubuntu repository.  Most of the documentation out there only covers setting up a repo on your own local machine, for your own local use only.  On top of that, the docs vary between how much they tell you about the specifics of a Ubuntu vs Debian setup.  Since I am likely not the only one trying to make this kind of thing, I&#8217;m posting a step-by-step guide on how to do it yourself.</p>
<h2>The Goal</h2>
<p>We want to setup a publicly accessible Ubuntu repository so that we can distribute our own .deb packages to other users.  Since we&#8217;re on a budget, we&#8217;re going to host this repo on our <a href="http://www.dreamhost.com/" target="_blank">DreamHost</a> account.  Above all else, it needs to be easy to maintain, since we want this to make life easier, not harder.</p>
<h2>The Plan</h2>
<p>We&#8217;re going to create a local repository on our development machine using <em>dput</em> and <em>mini-dinstall</em>. Then we&#8217;ll sync it to the remote web server using <em>rsync</em> and <em>ssh</em>.</p>
<h2>The Prerequisites</h2>
<p>As always, this guide assumes that you are familiar with Linux and are comfortable doing things on the command line.  If not, <em>turn back now</em>, before it is too late! This is <em>not</em> a guide for beginners.</p>
<p>We&#8217;re also going to assume that you&#8217;ve got a hosting package with DreamHost, and a domain name to which you can add sub-domains.</p>
<p>Lastly, we&#8217;ll assume that your development machine is running some form of <a href="http://www.ubuntu.com" target="_blank">Ubuntu Linux</a>.  I used Feisty (7.04) when writing this article. Adjust the steps as needed for your own setup.</p>
<h2>The Process</h2>
<h3>1. Set up a domain</h3>
<p>To keep your website clean, it&#8217;s a good idea to set up a sub-domain of your primary site on which to host your repo.  Using my site <code>www.drelmo.net</code> as our example, we set up <code>packages.drelmo.net</code> as our domain.  On DreamHost, you want to set this up as a Fully Hosted Domain.  If you know what you&#8217;re doing, you can customize the options on the setup screen, but the defaults are all fine.</p>
<h3>2. Configure your SSH login to the new domain</h3>
<p>To make life easier down the road, we&#8217;ll need a password-less SSH login to the site.  I won&#8217;t go into the details of how to do this, as it has been documented far better in countless places.  The <a href="http://wiki.dreamhost.com/SSH" target="_blank">DreamHost wiki</a>, for example.  I&#8217;ll assume from here on out that you can simply type &#8220;<code>ssh user@server.dreamhost.com</code>&#8221; and get dropped into a bash shell.</p>
<p>Again, if you don&#8217;t understand that last sentence, <em>stop now</em>, before you hurt yourself.</p>
<h3>3. Create a folder for the public repository</h3>
<p>To keep things clean, I like to segment things a bit.  This is an optional step, but one that I suggest doing unless you have a really good reason not to.  Log into your server real quick and in the webroot, make a folder called &#8216;archive&#8217;.  In the case of our example, this would go something like this:</p>
<pre>
ssh user@server.dreamhost.com
cd packages.drelmo.net/
mkdir archive
exit</pre>
<h3>4. Set up your repository&#8230;  locally</h3>
<p>I know, I know, we don&#8217;t care about having a local repo, we want to share it with the world!  Sit tight, junior.  This is part of the process.  On shared hosting, you likely won&#8217;t have access to the tools needed to easily maintain a repository, and for good reason.  So we&#8217;re going to set it up (and yes, keep it there) on our development machine first.</p>
<p>Rather than rewrite it, I&#8217;ll point you to the excellent guide that I followed called <a href="https://help.ubuntu.com/community/LocalAptGetRepository" title="Local Apt-Get Repository on Ubuntu" target="_blank">LocalAptGetRepository</a>, over at the <a href="https://help.ubuntu.com/community/" title="Ubuntu Community User Documentation" target="_blank">Ubuntu Community</a> site.  Follow that all the way down to (but not including) the section called &#8220;<em>Changing your systems apt-get sources.list</em>&#8220;.</p>
<p>All done?  Great!  Let&#8217;s move forward.</p>
<h3>5. What you should have so far</h3>
<p>At this point, you should have a folder somewhere on your dev machine that looks something like this:</p>
<pre>
/home/marc/archive
/home/marc/archive/feisty
/home/marc/archive/gusty
/home/marc/archive/mini-dinstall</pre>
<p>And in those folders should basically be everything you need for your repo, hopefully with one or more packages already imported.  If not, I suggest getting to that point before you move on.</p>
<h3>6. Copying your local repo to the remote webhost</h3>
<p>We can simply type in the <code>rsync</code> command to get all our files up there, but we want this to be easy later on, remember?  So let&#8217;s make a simple bash script that can do it all for us, so we don&#8217;t need to constantly retype the whole thing.  I recommend calling it something simple like &#8220;<code>sync-repo</code>&#8220;.  Stick the following into it, making sure to adjust for your setup.</p>
<blockquote><p><strong>A few notes about the script:</strong> WordPress messes up the display of the rsync command, so there are two things to pay attention to.
<ol>
<li>The three lines, starting with the rsync one, should all be on one line.</li>
<li>The long dashes in front of &#8220;stats&#8221;, &#8220;progress&#8221;, and &#8220;exclude&#8221; should actually be two normal dashes.</li>
</ol>
</blockquote>
<pre>
#!/bin/bash
rsync -rlptvzh --stats --progress --exclude=mini-dinstall 
-e "ssh -l user" /home/marc/archive/ 
user@server.dreamhost.com:/home/user/packages.drelmo.net/archive/</pre>
<p>Now save the script, <code>chmod +x</code> it, and run it! If all went well, you should be able to point your browser at the equivalent of <code>http://packages.drelmo.net/archive</code> and see the same folder tree as the one on your machine.  You&#8217;ll notice that we excluded the <code>mini-dinstall</code> folder, because that should not be made public.</p>
<h2>The Beautiful Finish</h2>
<p>The final step is to add your brand new repository to your <code>/etc/apt/sources.list</code>.  Open up the list in your favorite editor:</p>
<pre>sudo vim /etc/apt/sources.list</pre>
<p>Then add in the lines for your repo:</p>
<pre>
deb http://packages.drelmo.net/archive feisty/
deb-src http://packages.drelmo.net/archive feisty/</pre>
<p>Update your cache and you&#8217;re done!</p>
<pre>sudo apt-get update</pre>
<h2>The Conclusion</h2>
<p>If you&#8217;ve followed along, you should now have your very own Ubuntu repository.  To add new packages to it, just use <code>dput</code> on your local machine, then run your <code>sync-repo</code> script to update the online version.  It&#8217;s that easy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drelmo.net/2007/09/17/setting-up-your-own-ubuntu-repository-on-dreamhost/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Step-by-step Rails setup using Capistrano 2.0 and Mongrel</title>
		<link>http://www.drelmo.net/2007/09/11/step-by-step-rails-setup-using-capistrano-20-and-mongrel/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=step-by-step-rails-setup-using-capistrano-20-and-mongrel</link>
		<comments>http://www.drelmo.net/2007/09/11/step-by-step-rails-setup-using-capistrano-20-and-mongrel/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 21:10:33 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.drelmo.net/2007/09/11/step-by-step-rails-setup-using-capistrano-20-and-mongrel/</guid>
		<description><![CDATA[I started working on a new client site in Rails recently and reached the point where I was ready to launch a starter-version over at OCS. In the process, I wanted to upgrade a few of my practices and utilities, most notably Capistrano. I have been using the 1.4 series for a while, but this [...]]]></description>
			<content:encoded><![CDATA[<p>I started working on a new client site in Rails recently and reached the point where I was ready to launch a starter-version over at <a href="http://www.ocssolutions.com/" title="OCS Solutions" target="_blank">OCS</a>.  In the process, I wanted to upgrade a few of my practices and utilities, most notably <a href="http://www.capify.org/" title="Capistrano" target="_blank">Capistrano</a>.  I have been using the 1.4 series for a while, but this was a brand new site, so what better opportunity would there be to start using 2.0?</p>
<p>Since Capistrano 2.0 is relatively new to the scene, the documentation (as with most Rails-related projects) was lagging behind.  The team changed a lot about how 2.0 works, making most of my old deployment recipes obsolete.  The problem is, the info about how to write new ones is still very scattered and hard to navigate.  OCS was suffering from much the same problem, with no detailed guide on getting a new Rails app ready and launched on their servers.  Since I knew I&#8217;d need to repeat the process in the future, I decided to document the process as I went.  Halfway through, I realized that I was likely not the only one who could benefit from such a guide.</p>
<p>The result of my efforts was posted later that day on the <a href="http://wiki.ocssolutions.com/" title="OCS Solutions Tech Support Wiki" target="_blank">official OCS Support Wiki</a>, as an article entitled &#8220;<a href="http://wiki.ocssolutions.com/Step-by-step_setup_using_Capistrano_2.0_and_Mongrel" title="Step-by-step setup using Capistrano 2.0 and Mongrel" target="_blank">Step-by-step setup using Capistrano 2.0 and Mongrel</a>&#8221; under their Ruby on Rails section.  It even got a mention and some kind words on the <a href="http://www.ocsblog.com/2007/09/06/deploying-with-capistrano-20-and-mongrel-guide/" target="_blank">OCS Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drelmo.net/2007/09/11/step-by-step-rails-setup-using-capistrano-20-and-mongrel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Top 2 Web Hosting Companies</title>
		<link>http://www.drelmo.net/2007/09/11/my-top-2-web-hosting-companies/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=my-top-2-web-hosting-companies</link>
		<comments>http://www.drelmo.net/2007/09/11/my-top-2-web-hosting-companies/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 20:52:16 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.drelmo.net/2007/09/11/my-top-2-web-hosting-companies/</guid>
		<description><![CDATA[Like most web developers, I get asked fairly regularly who I recommend for setting up simple websites. For the record, my experience with project hosting has been very polar. I&#8217;ve done a few sites where the requirements called for a full dedicated server, which I got to set up by hand. If there is interest [...]]]></description>
			<content:encoded><![CDATA[<p>Like most web developers, I get asked fairly regularly who I recommend for setting up simple websites.  For the record, my experience with project hosting has been very polar.  I&#8217;ve done a few sites where the requirements called for a full dedicated server, which I got to set up by hand.  If there is interest in those installations, I can post some info about them.  For now, I&#8217;m going to focus on the other end of the spectrum: shared hosting.</p>
<h2><a href="http://www.ocssolutions.com/" target="_blank">#1: OCS Solutions</a></h2>
<p>My uncontested favorite.  If you&#8217;re setting up anything beyond a simple personal site, these are the folks to go to.  Not only do they specialize in Rails hosting, but they actually answer the phone!  No, wait, I&#8217;ll do you one better.  Their CEO (Robert) is part of the 24/7 phone support shift and actually knows exactly what he&#8217;s talking about!  I know of no other (legitimate) hosting companies that can make that claim.</p>
<p>I&#8217;ve already got a few client sites hosted with them, so the team there has seen my name in a good number of support requests already.  They never fail to get back to me within 24 hours, but usually less than 3.  When I have a truly urgent issue, they are always there on the phone.  I have yet to ever leave a voicemail.</p>
<p>More than anything else, their Rails hosting is phenomenal.  The first site I moved over to them was a relatively basic Rails app that had been having speed and uptime problems on Dreamhost, even with minimal load.  Ever since the move (with zero changes to my code) the site has performed like an athlete on speed.  From now on, all of my Rails apps are going on the OCS servers.</p>
<p>My only gripe with them is the occasional usability issues with their web panels, which is where I still use #2 for a few things.</p>
<h2><a href="http://www.dreamhost.com/" target="_blank">#2: Dreamhost</a></h2>
<p>Very strong in some areas.  Very weak in others.</p>
<p>Dreamhost is the ideal &#8220;budget-hosting&#8221; solution.  For a not-expensive price, an account with them will let you do a lot of things.  You can register and host a virtually unlimited number of domains with one account.  Their &#8220;One Click Installs&#8221; make basic sites (like this one) ridiculously easy to manage.  Even their interface to Subversion, while lacking some more advanced functionality, is ideal for small projects.</p>
<p>On the other hand, their Rails support is not 100%.  Google it and you&#8217;ll see what I mean.  There are posts and discussions abound all over the net about how to get your app to work smoothly, with mixed results.   I spent a long time tweaking the code on the <a href="http://www.muirsurf.com" title="Muir Surf &amp; Sport" target="_blank">Muir Surf &amp; Sport</a> site to get it to work.  The best I could get it still had a 1-2% rate of 500 errors.  Not acceptable.</p>
<p>To make things worse, their support is sub-par.  Their target audience is a very broad client base, so they can&#8217;t afford to offer phone support.  Ok, fine, I can email them when all hell breaks loose.  But when one of my client&#8217;s e-commerce sites went offline, completely, it took Dreamhost over <strong>8 hours</strong> to get back to me.  And guess what?  It was their fault it had gone down in the first place!  That was the brick that broke the camel&#8217;s back for me.  I will never again have a client ask me &#8220;Why is my site down?&#8221; and have to answer &#8220;Oh, I&#8217;m waiting on the host to get back to me.&#8221;</p>
<h2>Concluding Thoughts</h2>
<p>The basic summary is that Dreamhost works for most circumstances.  If your needs are basic, and/or reliability is not mission-critical, then they are a fine host.  But for critical projects, 99% uptime means that 10,000 out of every million hits will fail.  If you need Rails hosting, and/or actually want good support, go with OCS.  The cost is not much higher, but you&#8217;ll notice a huge difference.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.drelmo.net/2007/09/11/my-top-2-web-hosting-companies/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

