<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Power &amp; Light: Getting Typo 4 running on DreamHost</title>
    <link>http://blog.aidenbordner.com/articles/2006/07/24/getting-typo-4-0-0-running-on-dreamhost</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Spiels, rants and occassional pieces of useful information from Aiden Bordner</description>
    <item>
      <title>Getting Typo 4 running on DreamHost</title>
      <description>&lt;p&gt;This has been an interesting day, attempting to get a fresh build of &lt;a href="http://www.typosphere.org"&gt;Typo 4.0.1&lt;/a&gt; installed on a shared hosting account with &lt;a href="http://www.dreamhost.com"&gt;DreamHost&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;The reason for this, predominantly, was to practice deploying a Rails application on DreamHost in preparation for the launch of &lt;a href="http://www.witnessinglife.com"&gt;Witnessing Life&lt;/a&gt; which I&amp;#8217;m currently spending my days (and nights) thinking about.&lt;/p&gt;


	&lt;p&gt;Without further ado, here&amp;#8217;s the rundown of how I achieved my goal.
&lt;br/&gt;&lt;br/&gt;
&lt;hr&gt;
&lt;em&gt;Disclaimer: I am not well versed in server configuration, ruby, rails or typo. This is simply a documentation of the steps I took to get typo up and running on my page. I am a newbie with the intention of helping other newbies get their feet wet. If things go wrong, see the list of related links at the bottom and seek assistance at #typo on irc.freenode.net, but more importantly please let me know what went wrong so I can correct this information for the future.
&lt;br/&gt;&lt;br /&gt;
Another Note: This post is under the assumption you&amp;#8217;re installing your blog as a subdomain, like &lt;b&gt;this blog&lt;/b&gt;, e.g.: blog.yourdomain.com.)&lt;/em&gt;
&lt;hr&gt;
&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;1. Install using Subversion (not gems)&lt;/strong&gt;&lt;/p&gt;


Although the Typo folks were kind enough to create a RubyGems installer, you can&amp;#8217;t install your own gems (easily) with DreamHost. (To do so requires creating your own gems install on your account. I followed the DreamHost &lt;a href="http://wiki.dreamhost.com/index.php/RubyGems"&gt;wiki&lt;/a&gt; to this effect, but it did not work properly; I think a misconfiguration in the bash_config).  Regardless. it proved easier to use &lt;strong&gt;subversion&lt;/strong&gt; and install from the typo trunk. Use your terminal to &lt;span class="caps"&gt;SSH&lt;/span&gt; to your server (&lt;em&gt;e.g., ssh yourusername@your.website.com&lt;/em&gt;) and enter the following into the command line at the dreamhost server.
&lt;pre&gt;&lt;code&gt;
svn checkout svn://typosphere.org/typo/trunk typo
&lt;/pre&gt;&lt;/code&gt;
&lt;br /&gt;
This is going to take a while. Bounce over to your browser and go on to step 2 (or get a sandwich).
&lt;br /&gt;&lt;br /&gt;

	&lt;p&gt;&lt;strong&gt;2. DreamHost Setup&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;You need to configure a subdomain for Typo. Under the &lt;a href="http://panel.dreamhost.com/"&gt;DreamHost Control Panel&lt;/a&gt; choose &amp;#8220;Domains &amp;gt; Manage Domains&amp;#8221; on the left hand side. Then configure a subdomain    with &lt;b&gt;blog.&lt;em&gt;yourdomain&lt;/em&gt;.com&lt;/b&gt; as the domain, &lt;b&gt;FastCGI enabled&lt;/b&gt; and a directory of &lt;b&gt;home/&lt;em&gt;username&lt;/em&gt;/typo/public&lt;/b&gt;. Save your settings.&lt;/p&gt;


	&lt;p&gt;&lt;br /&gt;&lt;img src="/files/dreamhost1.jpg" width="500"&gt;&lt;br /&gt;&lt;/p&gt;


	&lt;p&gt;You also need to create a database where typo is going to store your posts, etc. I&amp;#8217;m using MySQL. Under &amp;#8220;Goodies &amp;gt; Manage MySQL&amp;#8221; you can create a new database, for instance &lt;b&gt;&amp;#8220;typo_db&amp;#8221;&lt;/b&gt; with a username of &lt;b&gt;typo&lt;/b&gt; and a subdomain of &lt;b&gt;mysql.&lt;em&gt;yourdomain&lt;/em&gt;.com&lt;/b&gt; Create an original and strong password and save it for the next step.&lt;/p&gt;


	&lt;p&gt;&lt;br /&gt;&lt;img src="/files/dreamhost2.jpg" width="500"&gt;&lt;br /&gt;&lt;/p&gt;


	&lt;p&gt;It&amp;#8217;s going to take a 10 or so minutes for your new subdomains to propagate on the dreamhost &lt;span class="caps"&gt;DNS&lt;/span&gt; servers, and some of the following steps to work properly (namely for typo to find the database, since DreamHost wont accept localhost for a MySQL server). If you haven&amp;#8217;t already had that sandwhich, now might be the time.
&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt; 3. Configuring Typo&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;The next step is to configure typo to work with your account. Enter the following in the command line:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;cd ~/typo
pico config/database.yml.example&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;This is an example version of the database.yml for mysql. You want to edit this file to match the settings you just created.&lt;/p&gt;


	&lt;p&gt;Under the &amp;#8216;login&amp;#8217; callout, change &lt;b&gt;host&lt;/b&gt; to &lt;b&gt;mysql.&lt;em&gt;yourdomain&lt;/em&gt;.com&lt;/b&gt;, change the &lt;b&gt;username&lt;/b&gt; to &lt;b&gt;typo&lt;/b&gt; (or whatever you set the mysql user to be in step 2) and enter the strong password from the end of step two where it says &lt;b&gt;password&lt;/b&gt;.&lt;/p&gt;


	&lt;p&gt;You also need to change the name of the database (marked &lt;b&gt;database&lt;/b&gt;) under each of the three application modes (development, test, production) to your newly created db, &lt;b&gt;typo_db&lt;/b&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;br /&gt;&lt;img src="/files/terminal1.jpg" width="500"&gt;&lt;br /&gt;&lt;/p&gt;


	&lt;p&gt;Type &amp;#8216;&lt;b&gt;Control-X&lt;/b&gt;&amp;#8217; to exit. When it prompts you to &amp;#8220;save modified buffer&amp;#8221;, type Y. Pico will then prompt you for a name for the changed file. &lt;b&gt;Remove the .example&lt;/b&gt; from the end of the filename, naming the file &lt;b&gt;database.yml&lt;/b&gt;.&lt;/p&gt;


	&lt;p&gt;Next, at the command line, type:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;pico config/environment.rb&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;On the fifth line, uncomment the line that reads &amp;#8216;ENV[&amp;#8216;RAILS_ENV&amp;#8217;] = &amp;#8216;production&amp;#8217; (remove the &amp;#8216;&lt;b&gt;#&lt;/b&gt;&amp;#8217; from before the line). It should look like this:&lt;/p&gt;


	&lt;p&gt;&lt;br /&gt;&lt;img src="/files/terminal2.jpg" width="500"&gt;&lt;br /&gt;&lt;/p&gt;


	&lt;p&gt;This will force rails into production mode for DreamHost. When complete, type &amp;#8216;&lt;b&gt;Control-X&lt;/b&gt;&amp;#8217; to exit and save the file with the same name.&lt;/p&gt;


	&lt;p&gt;Finally, back at the command line, type:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;rake migrate RAILS_ENV=production&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This will take a while, but it will get the database schema configured on the typo_db MySQL database. 
&lt;br/&gt;
&lt;hr&gt;
&lt;em&gt;Note: If you have problems here and the output indicates the rake script was looking for a typo_dev database, you need to restart your rails processes on your dreamhost account. To do this, try &amp;#8216;killall ruby&amp;#8217; and try again.&lt;/em&gt;
&lt;hr&gt;&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;4. DreamHost Tweaking&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;If everything has been going ok so far, there&amp;#8217;s just a few more things to do for you to be Typo Powered.&lt;/p&gt;


	&lt;p&gt;We need to edit a couple more documents:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;pico public/dispatch.fcgi&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;First of all, change the top line that reads &amp;#8217;#!/usr/bin/env ruby&amp;#8217; to &amp;#8216;&lt;b&gt;#!/usr/bin/ruby&lt;/b&gt;&amp;#8217;.  This, called the &amp;#8220;shebang&amp;#8221; line, is the path to ruby, and DreamHost&amp;#8217;s path is slightly different than the default.&lt;/p&gt;


	&lt;p&gt;Next, scroll down to the bottom of the document and look for the line that reads &amp;#8216;require fcgi_handler&amp;#8217;. Underneath that line, add the following code:&lt;/p&gt;


&lt;code&gt;&lt;pre&gt;class RailsFCGIHandler
  private
    def frao_handler(signal)
      dispatcher_log :info, "asked to terminate immediately" 
      dispatcher_log :info, "frao handler working its magic!" 
      restart_handler(signal)
    end
    alias_method :exit_now_handler, :frao_handler
end&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;This is a &lt;a href="http://work.alexyoung.org/archives/102/dreamhost-and-rails-500-errors"&gt;method of dealing with intermittant 500 errors&lt;/a&gt; at DreamHost devised by Alex Young.  When you&amp;#8217;re done, the file should look like this:&lt;/p&gt;


	&lt;p&gt;&lt;br /&gt;&lt;img src="/files/terminal3.jpg" width="500"&gt;&lt;br /&gt;&lt;/p&gt;


	&lt;p&gt;Hit &amp;#8216;&lt;b&gt;Control-X&lt;/b&gt;&amp;#8217; and save your changes again. Now we do the same shebang line change to dispatch.rb:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;pico public/dispatch.rb&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Again, if the top line reads &amp;#8217;#!/usr/bin/env ruby&amp;#8217; change it to &amp;#8216;&lt;b&gt;#!/usr/bin/ruby&lt;/b&gt;&amp;#8217;.  Close and save.&lt;/p&gt;


	&lt;p&gt;Finally, we have just a few permissions to set. At the command line:&lt;/p&gt;


&lt;code&gt;&lt;pre&gt;chmod 755 public
chmod 755 public/dispatch.fcgi
chmod 755 public/dispatch.rb&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;&lt;b&gt;And you&amp;#8217;re done!&lt;/b&gt; At this point you should be able to go to blog.&lt;em&gt;yourdomain&lt;/em&gt;.com and create your first user. Note that, at first, the response of the system may be a bit sluggish. This is because the first time the controllers are accessed they haven&amp;#8217;t yet been cached. You should notice a performance increase quickly through use.&lt;/p&gt;


	&lt;p&gt;&lt;br /&gt;
&lt;hr&gt;
&lt;em&gt;Again, I am a Ruby/Rails/Typo amature myself, so if these instructions don&amp;#8217;t work, my appologies. Please let me know and I&amp;#8217;ll revise them. Additionally if you &lt;b&gt;are&lt;/b&gt; a pro at this and notice I&amp;#8217;m doing something wrong, please let me know and I&amp;#8217;ll happily correct it.&lt;/p&gt;


	&lt;p&gt;That said, my experiences were based on trial and error and a lot of help from the following:
&lt;br /&gt;&lt;br /&gt;
&lt;a href="http://www.typosphere.org/trac/wiki/DreamHost"&gt;DreamHost 2.6 Installation on TypoTrac&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://wiki.dreamhost.com/index.php/Typo"&gt;Official DreamHost Wiki for Typo&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://work.alexyoung.org/archives/102/dreamhost-and-rails-500-errors"&gt;Alex Young&amp;#8217;s DreamHost 500-error fix&lt;/a&gt;&lt;br /&gt;&lt;/em&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 24 Jul 2006 16:37:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:f6bf81d8-a2d9-414d-a4d7-0a259a281953</guid>
      <author>Aiden Bordner</author>
      <link>http://blog.aidenbordner.com/articles/2006/07/24/getting-typo-4-0-0-running-on-dreamhost</link>
      <category>Geek Speak</category>
      <category>ruby</category>
      <category>rails</category>
      <category>dreamhost</category>
      <category>typo</category>
      <trackback:ping>http://blog.aidenbordner.com/articles/trackback/1</trackback:ping>
    </item>
    <item>
      <title>"Getting Typo 4 running on DreamHost" by Chris H</title>
      <description>Hi,
many many thanks for the very clear guidelines.

I had one glitch - on rake-ing, it aborted with the following:

       private method 'gsub' called for nil:NilClass 

however, as I found at blog.kibara.com, this was due to this line in &lt;i&gt;db/migrate//051_fix_canonical_server_url.rb&lt;/i&gt;

b.settings['canonical_server_url'] =
b.settings['canonical_server_url'].gsub(%r{/$},'')


which I commented out, and then ran the process again - it worked fine.</description>
      <pubDate>Mon, 21 Aug 2006 14:58:38 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:2a3f2654-aaca-4250-8519-d6244445d599</guid>
      <link>http://blog.aidenbordner.com/articles/2006/07/24/getting-typo-4-0-0-running-on-dreamhost#comment-25</link>
    </item>
    <item>
      <title>"Getting Typo 4 running on DreamHost" by MarFarMa</title>
      <description>Installed Typo - it's up and running except .....

It's URL is &lt;a href="http://www.blog.mydomain.com/typo/public" rel="nofollow"&gt;www.blog.mydomain.com/typo/public&lt;/a&gt;

when I want it to be at &lt;a href="http://www.blog.mydomain.com" rel="nofollow"&gt;www.blog.mydomain.com&lt;/a&gt;

What did I do wrong?  And do you know how to fix this?

Thanks for the great tutorial!!</description>
      <pubDate>Fri, 18 Aug 2006 01:35:56 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:50f7a001-70a8-4104-ae1d-d21bbdf71c8a</guid>
      <link>http://blog.aidenbordner.com/articles/2006/07/24/getting-typo-4-0-0-running-on-dreamhost#comment-24</link>
    </item>
    <item>
      <title>"Getting Typo 4 running on DreamHost" by Sergi</title>
      <description>I've followed your instructions step by step but for an unknown motive I was getting the error message "Access denied for user X to 'database typo'" doing the migration, so I've deleted the typo_db database and I've created another one called just typo, and everything is now working ok.</description>
      <pubDate>Thu, 10 Aug 2006 09:04:10 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:981dc655-5f72-4b77-9898-857e7114e029</guid>
      <link>http://blog.aidenbordner.com/articles/2006/07/24/getting-typo-4-0-0-running-on-dreamhost#comment-23</link>
    </item>
    <item>
      <title>"Getting Typo 4 running on DreamHost" by Eric McWilliams</title>
      <description>Thanks Adien I used your guide and it worked great the Dreamhost Wiki for Typo really didn't work at all for me and your guide worked like a charm.  The only thing I did different was used VI instead of PICO :)

Eric
sends
</description>
      <pubDate>Sat, 05 Aug 2006 09:52:05 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:da3f046d-885a-446d-af1a-cfe665aa87dc</guid>
      <link>http://blog.aidenbordner.com/articles/2006/07/24/getting-typo-4-0-0-running-on-dreamhost#comment-19</link>
    </item>
    <item>
      <title>"Getting Typo 4 running on DreamHost" by David Woodman</title>
      <description>Excellent write-up .... but your link to 
&lt;a href="http://www.typosphere.org" rel="nofollow"&gt;www.typosphere.org&lt;/a&gt; is still broken 

needs to be dot org NOT dot com

</description>
      <pubDate>Sat, 05 Aug 2006 01:46:30 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:30656c87-bfcf-4a4d-94f7-f47ef25e821e</guid>
      <link>http://blog.aidenbordner.com/articles/2006/07/24/getting-typo-4-0-0-running-on-dreamhost#comment-17</link>
    </item>
    <item>
      <title>"Getting Typo 4 running on DreamHost" by Orly</title>
      <description>Finally i get typo running on Dreamhost, thanks a lot!</description>
      <pubDate>Sat, 29 Jul 2006 15:32:38 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:3a9c4e18-cf89-4025-bd05-fdee464eae54</guid>
      <link>http://blog.aidenbordner.com/articles/2006/07/24/getting-typo-4-0-0-running-on-dreamhost#comment-14</link>
    </item>
    <item>
      <title>"Getting Typo 4 running on DreamHost" by Orly</title>
      <description>Hey, first of all, thanks for the post, i been trying to get typo running on dreamhost. I follow the steps but when i get to thew RAKE part, something goes wrong. These is what i get:

[redhot]$ rake migrate RAILS_ENV=production
(in /home/.governor/orlybg/typos.highiqsolutions.net)
rake aborted!
Access denied for user 'orlybg  '@'redhot.dreamhost.com' (using password: YES)

(See full trace by running task with --trace)

I dont know what to do next, i'll apreciatte any help, thanks in advance.

Orlando.</description>
      <pubDate>Fri, 28 Jul 2006 18:39:38 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:3a3aa51d-3f2e-43f6-8945-0e21fa65c2ce</guid>
      <link>http://blog.aidenbordner.com/articles/2006/07/24/getting-typo-4-0-0-running-on-dreamhost#comment-13</link>
    </item>
    <item>
      <title>"Getting Typo 4 running on DreamHost" by Aiden</title>
      <description>Missing a 'w' (oops) ...  fixed now. :)</description>
      <pubDate>Wed, 26 Jul 2006 06:56:09 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:7b7df571-b850-4133-868a-e38d097a7b75</guid>
      <link>http://blog.aidenbordner.com/articles/2006/07/24/getting-typo-4-0-0-running-on-dreamhost#comment-7</link>
    </item>
    <item>
      <title>"Getting Typo 4 running on DreamHost" by Andy</title>
      <description>Your link to &lt;a href="http://www.typosphere.org" rel="nofollow"&gt;www.typosphere.org&lt;/a&gt; is broken -- just so you know. (-:

Blog nOOb!</description>
      <pubDate>Tue, 25 Jul 2006 21:23:03 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:e8bf032c-6eec-41a6-b0e0-b5369eeeb2e7</guid>
      <link>http://blog.aidenbordner.com/articles/2006/07/24/getting-typo-4-0-0-running-on-dreamhost#comment-6</link>
    </item>
  </channel>
</rss>
