How to Setup Typo Subversion

From ReduxWiki

Jump to: navigation, search

First make one mysql database with all privileges

Now login your cPanel and click the icon named SSH/Shell access, then type in your login and password (We'll be using shell access to do all the work).

Once you login you should see something like this:

username@server [~]#

You're doing good so far, so let's get started with getting the subverison (note: don't type in username@server [~]#)

username@server [~]# svn checkout http://svn.typosphere.org/typo/trunk yourtypo

This downloads the subverison files from typosphere and puts them in a folder that you want, for example "yourtypo". You can rename this to whatever you want.

username@server [~]# cd public_html

This just moves you to the public_html folder, you can cd www if you want. Now let's create the symlink to our typo folder.

username@server [~/public_html]# ln -s ~/yourtypo/public yourtypo

Now that we have the symlink created, now let's edit the mysql database stuff.

username@server [~]# cd yourtypo/config

This just moves you to the config file, now let's rename it and edit it for our mysql database.

username@server [~/yourtypo/config]# mv database.yml.example database.yml

Alright now we have the database file renamed so we can get typo working, now let's edit the database file.

username@server [~/yourtypo/config]# pico database.yml

pico is the command to edit the database.yml file you'll be using this alot throughout the tutorial.

login: &login
  adapter: mysql
  host: localhost
  username: cpanelusername_username
  password: passwordyoumade
 

development:
  database: cpanelusername_databasename
  <<: *login

test:
  database: cpanelusername_databasename
  <<: *login

production:
  database: cpanelusername_databasename
  <<: *login

Once you're done editing the file hit Ctrl + O then hit Enter, then Ctrl + X

Now let's open the environment.rb file its also located in the config file, so let's open it up

username@server [~/yourtypo/config]# pico environment.rb

Yet again using the pico command to edit the environment.rb file

# Uncomment below to force Rails into production mode
# (Use only when you can't set environment variables through your web/app server)
# ENV['RAILS_ENV'] = 'production'

This is all you need to look at uncomment "ENV['RAILS_ENV'] = 'production', once you've done that repeat by hitting Ctrl + O, ENTER, Ctrl + X

username@server [~/yourtypo/config]# cd

This just moves you back to the root files, so let's get the MySQL stuff in your database

username@server [~]# cd yourtypo

Now your should be in your typo directory, now type this:

username@server [~/yourtypo]# rake migrate RAILS_ENV=production

You should see alot of stuff happening. This is just the MySQL values being added in the MySQL database you put in the database.yml file.

Now let's edit the .htaccess file and fix the trailing slash problem. So let's cd back to the root directory again:

username@server [~/yourtypo]# cd

Alright let's setup that .htaccess file.

username@server [~]# cd yourtypo/public

This sends us to the directory where the .htaccess file is located.

username@server [~/yourtypo/public]# pico .htaccess

Using the pico command to edit the hidden .htaccess file

# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
#Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
RewriteEngine On

# If Typo is accessed via an Alias directive, then you MUST also set
# the RewriteBase in this htaccess file.
#
# Example:
#   Alias /blog /path/to/typo/public
RewriteBase /yourtypo
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !yourtypo\.html
RewriteRule ^(.*)$ dispatch.fcgi [QSA]
RewriteRule yourtypo\.html /yourtypo/ [R]

# In case Typo experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
# 
# Example:
#   ErrorDocument 500 /500.html

ErrorDocument 500 "Typo Error, please Refresh."

Just make sure your .htaccess file looks like this, but make sure to change "yourtypo" to whatever you've named it too. Now save and close by Ctrl + O, ENTER, Ctrl + X.

Now let's fix the dispatch.fcgi file and dispatch.rb, because the Ruby is located in local on the NetworkRedux servers.

username@server [~/yourtypo/public]# pico dispatch.fcgi

Using the pico command to edit the dispatch.fcgi file, make sure you type dispatch.*f*cgi not dispatch.cgi

#!/usr/local/bin/ruby

Make sure that this line looks like this. Now save and close by Ctrl + O, ENTER, Ctrl + X

Now let's edit that dispatch.rb file.

username@server [~/yourtypo/public]# pico dispatch.rb

Using the pico command to edit the dispatch.rb file

#!/usr/local/bin/ruby

Yet again make sure this line looks like this. Now save and close by Ctrl + O, ENTER, Ctrl + X

This should do it. Now go to http://www.yourdomain.com/yourtypo

Typo should be asking you to setup an admin account, if not then you did something wrong.

Image:Tip.png Back to How To Documents
Personal tools