Tomorrow...

Posted by John
on Saturday, 02 August 2008

The Joker

Well after a lot of research and hard work the server's ready to drop off at colocation. There's still some grey areas but in all everything looks ready to go, better off there and running than sitting it home waiting.

So tomorrow I'll be driving down to RapidSwitch in Slough to drop it off, after which Michelle wants us to visit her grandparents who live in Farnborough; not far off from the facility.

Here's a quick rundown of the spec:

  • O/S: Debian Etch 4.0 64-bit
  • HDD: Software RAID 1 - 1TB
  • MEMORY: 4GB Corsair
  • CPU: AMD AM2 2+ghz
  • BANDWIDTH: 3TB per month

Bit of a step up from the virtual server environment I get from SliceHost, but fingers crossed it should all go fine; had so much fun putting it together already planning the next incarnation ;-)

P.S.

Dark Knight is really really good, Heath Ledger has pulled off such a believable and terrifying character; have to see it again.

Update

Just got back from her grandparents; boy do they know how to cook a sunday lunch, lovely couple.

Server's online, it's stopped resyncing the raid drives thankfully, was a little worried about that but everythings loaded running and operating well.

Cat sitting next weekend, let's hope mickey isn't in one of his moods ;-)

All the best, have a great week people.

RAID 1 with Fedora Unity

Posted by John
on Monday, 19 May 2008

Over the weekend I went thru the process of setting up and installing the O/S on my private server preparing it for colocating. During this I wanted to bind the twin 1TB drives together in a RAID 1 configuration. Now the ASUS BIOS has the facility to do this at the hardware level but by doing so it ties you down to the physical setup you used to build it. However Linux provides the facility to do this at the software level without the ties which both alleviates you from the reliance and provides you with a more manageable alternative.

However for the uninitiated it's nowhere as simple, what follows is a short guide to setup a simple twin drive software RAID solution; handle with care.

Fedora Unity

Before I start, get a copy of Fedora Unity. It's basically Fedora 8 with more stable drivers and packages. I was speaking with one of my friends last week and he suggested using it for this very same reason, and although Debian does the same it is nowhere near as up-to-date.

Grab the latest distro and burn it to a blank DVD, it's about 4.3gb in size so if your downloading I'd leave it going for the night.

Software RAID with LINUX

Once you've burned it to DVD, boot your machine up and go thru the install process, this example obviously assumes you have 2 identical drives but there's no stopping you using this to build a more advanced RAID setup later on.

Fedora has a pretty good partition manager which'll help you out a lot, so when it prompts you to decide on your partition layout, choose 'manual' and we'll begin;

  • On the first drive,
  • Create a software [raid] partition of 100mb (we'll use this for /boot).
  • Create a second software [raid] partition using all the remaining space.

  • Select [raid] again and clone the first drive layout to the second drive.

Now next time you select [raid] it'll give you the option to create a raid device, binding both discs together for each partition.

  • So, create a [raid] device using the ext3 filesystem, mount point '/boot', raid level 1, with raid members of 100mb in size (the two small partitions we created at the start), specify it to use both 100mb members (sda1 & sdb1).
  • For the second partition I'm creating a LVM partition for the rest of the filesystem and the swapfile,
  • So create a second [raid] device, file type LVM, raid level 1, using the two large members (sda2 & sdb2).

  • Afterwards select [LVM] in the options panel and define your LVM group.

  • Make an LVM volume group, e.g. 'lvmgroup'.
  • Next add a volume to the group, mount point '/', file system ext3, lvm name 'lvmroot', using all the space (- 10gb for the swap partition).
  • Next add a second volume to the lvm group, file system 'swap', lvm name 'lvmswap', using the remaining 10gb.

Click [finish] and you're done.

Setup your network settings and go make a coffee, Fedora takes a while to build the partitions and install the packages but afterwards you should be left with a pretty stable setup.

I built two partitions (boot & lvm) because I was informed this provides a more stable setup, if one boot partition goes down the other should kick in, providing some degree of failover.

Also creating an LVM group makes your filesystem more manageable and not so hard-wired so if you do need to do changes down the line you can.

Beyond that I'm going to leave in a copy of the Fedora LiveCD so I can boot from that if things get really hairy, I'm going to run the system headless with SSH access so Gnome isn't a necessity but for now it'll help in the system build.

All the best,

Update

One thing to remember is to make sure /boot is marked as bootable on both discs otherwise if you remove one the other won't kick in.

Ubuntu Setup

Posted by John
on Sunday, 11 May 2008

After grabbing and installing Ubuntu 8.04 I then had to put together and setup the baby, luckily I wrote down most of everything I did in case I'd have to do it again and to help out you guys.

What follows are my findings and what I did to fix them. The machine I used is an HP Pavillion dv2000 model dv2742 special edition. It's got a built-in intel graphics card, 3gb memory, sata 250gb drive, wifi, bluetooth and an intel dual core 2 processor.

I installed the o/s using the 64-bit edition of Ubuntu 8.04 Hardy Heron, all what you see below are workable settings which provided the right setup; hope they help your situation if you go down this route.

Update System

First port of call, check for any new updates post-install,

sudo aptitude update
sudo aptitude upgrade

Dependencies / Software / Setup

Next, install Ruby, FlashPlayer, GCC Compiler, MySQL, JAVA, SqlLite,

sudo aptitude install mysql-server flashplugin-nonfree ruby-full libsqlite3-dev build-essential libmysqlclient15-dev sun-java6-jdk

Volume Mixer,

sudo aptitude install gnome-alsamixer

ImageMagick,

sudo aptitude install imagemagick

Ruby Gem Handler

I could get GEM from the repositories but because with each new update it breaks away from the in-built Linux installer it's best to install it from source,

wget http://rubyforge.org/frs/download.php/34638/rubygems-1.1.0.tgz 
tar xzvf rubygems-1.1.0.tgz
cd rubygems-1.1.0
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

Had problems updating the GEM system initally, so logged in as root to finish it off,

su root 
sudo gem update --system

Now when you type gem --version you should see GEM ready to roll,

Gem Libraries

The slow bit, ran this as root just to make sure it worked,

sudo gem install rails rake mongrel mongrel_cluster thin capistrano mysql termios sqlite3-ruby mini_magick will_paginate ZenTest liquid rcov

How to update RubyGem's later

Later on you'll want to update the gem system, which by going this way won't be possible with the usual 'sudo gem update --system', but this:

sudo gem install rubygems-update
sudo update_rubygems

VLC + GIT

Next VLC to play videos,

sudo aptitude install vlc

Transmission for torrents, most important bit,

sudo aptitude install transmission

And GIT to handle code versioning,

sudo aptitude install git-core

Firefox + MS Fonts

Next I need Firebug for Firefox 3. Ubuntu 8.04 comes with Firefox 3 beta 5, the one available thru Tools / Add-ons won't work with it; but thankfully it's in the repositories

sudo aptitude install firebug

And you'll probably need Microsoft Fonts later down the line,

sudo aptitude install msttcorefonts

Pimp GEDIT

The default Gnome Text Editor Isn't bad but let's add some extra's to really kick it in gear,

sudo aptitude install gedit-plugins

And tweak it,

wget http://robzon.kapati.net/rails/rhtml.lang && sudo mv rhtml.lang /usr/share/gtksourceview-2.0/language-specs/
wget http://robzon.kapati.net/rails/rails.xml && sudo mv rails.xml /usr/share/mime/packages
sudo update-mime-database /usr/share/mime

Follow the guide here to get the TextMate look,

Now when you open rails source files they'll actually look right, thanks Grigio.

PostGreSql + Thunderbird

Pretty easy to install the most powerful db system, and the better email handler

sudo aptitude install postgresql thunderbird

Wine for Windows

Thanks to Google for their support the Wine project is going great, to get Windows software running natively on your machine,

First add the key,

wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -

Then add the repository to your default repository list,

sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/hardy.list -O /etc/apt/sources.list.d/winehq.list

And finally install it,

sudo apt-get install wine

Effects

To enable compiz effects make sure Appearance / Visual Effects is set to 'Extra', then install the Advanced Effects Manager,

sudo aptitude install compizconfig-settings-manager

This will give you access to the 3d cube, skydome effect and a host of other cool addons.

My desktop dpi is set to 100dpi, fonts set to 'Bitstream Vera Sans Roman 8pt', with 'Bitstream Vera Sans Bold 8pt' for Windows Title; and 'Liberation Mono 8pt' for fixed width font. Using subpixel smoothing for LCD.

Sound

For my laptop (hp pavillion dv2000 / dv2742se model), i had to use a different sound mixer to make sure the quickplay volume and mute buttons talked to the sound system.

So from the top menu bar, System / Preferences / Sounds, then set the Default Mixer Tracks hander device to: Conexant CX20561 (hermosa) (oss mixer).

Cleanup

To get any temp files carried on from the install, clean with,

sudo aptitude clean

Job done, however I had a problem with Hibernate & Suspend which was lucky fixed with some advice from here

Rails Routes + Sharing Controllers

Posted by John
on Saturday, 28 July 2007

One of the key factors in developing a web app is to determine it’s site structure and how each section permeates to another.

Routes

When your user navigates to your web address, which controller/view is he going to see?. This is managed by Rails Routes which is an efficient upgrade from mod_rewrite rules in PHP.

to start…

go into your rails webapps root directory and open routes.rb in /config. this controls how the user perceives the webs look.

so scroll down till you see…
bq. map.connect ‘:controller/:action/:id.:format’
map.connect ‘:controller/:action/:id’

and above this you can add…
bq. map.connect ‘’, :controller => ’account’, :action => ‘signup’

make sure you rename or delete the index.html file in /public otherwise this won’t work.

now everytime someone goes to www.yours.com/ it’ll navigate them to the signup action of the account controller. this is rather than having www.yours.com/account/signup in the browser’s address bar.

of course, when they navigate away it’ll change to /account/list or whatever actions you’ve setup but at least now you can catch out users from jumping to the root and getting errors or redirecting them to the path manually.

note: the routes operate on precedence, so the one first will knock out the second, etc.

Sharing Controllers

when writing your app you may want to redirect an action in one view to an action in another view. e.g. click on the ‘posts’ link to view your ‘posts’; while your in the ‘accounts’ view/controller.

so to do this, add this inside your method for jumping to your posts

redirect_to :controller => ‘posts’, :action => ‘index’

find more at rails api