September 13, 2007
My app’s up but not quite running. I’m getting this when i go to the beta url (which is http://beta.reeplies.com/public) :
Rails application failed to start properly”
Yesterday, Jay Gooby from the Brighton Ruby group kindly gave me several hours of his time to try and get Reeplies up and running. Here’s a breakdown of what i’ve done so far, before meeting Jay and with his help, as much for my own benefit as anyone elses.
Got my account with bluehost, which included free domain name registration with a years’ hosting (which cost about £45).
Got them to give me SSH access (i needed to provide some id, i emailed photos of the front and back of my driving license which was fine). They provided me with an ssh login and password. I learned that SSH is basically like telnet – a way of communicating with a remote host via the command line The difference is that the communication is encrypted, but that all happens under the hood – from a users perspective it’s like telnet.
Using the bluehost control panel, added an ftp account “email@example.com”. This created a subfolder called /public_html/max_williams.
Jay added another ftp account “firstname.lastname@example.org” which has the folder /rails/beta. This folder is to hold my working rails application folder.
Next step was to copy the application folder over! Bluehost provide their own ftp client for this but it’s a java applet and is a bit clunky. We used CoreFTP which i had already installed. We logged into email@example.com, and then just dragged the ‘newspipe’ (the working name of Reeplies) folder into the root directory (ie into rails/beta).
We were doing this using the wifi in the Windmill on montpelier terrace (nice pub btw – well kept ale and great chips) so the upload took a long time. Tip for anyone doing this – copy your app folder over to a temporary location and clear out anything you don’t need – saved files from the public folder and svn files for example. Then upload the cleaned up copy instead of your original folder. Obviously the PROPER way to do it is to get an online svn repository and install it from there. I’m working on it, for now the priority is to get SOMETHING up there.
Anyway, next step is to deal with Ruby gems and plugins: the host doesn’t have the ones i use, so i need to install them myself. According to Jay this is simple – we just go into the host unix environment (using ssh) and treat it like we would our own local command line. One difference is that the host is a unix environment whereas i’m used to windows: that means that some or all of the plugins/gems will use different versions to the ones i used.
To connect to the ssh command line i used PuTTY, with these connection settings:
Host name = reeplies.com
port = 22
connection type = SSH
(putty lets you save these details for future use)
So, now we’re on the remote server’s command line! Time for me to do a little bit of research into unix commands – i’ve never really ‘done’ unix. OK…
cd dirname – open directory – same as windows.
cd .. – go up – again same as windows
ls – list files and folders – like dir in windows
Next step was to get a mysql database up for my app to use. Created this using the bluehost control panel – a new mysql database called ‘reeplies_newspipedevelopment’ (it wouldn’t let us put underscores in for some weird reason, even though it adds the “reeplies_” prefix itself. Then, after the database.yml file had copied over, Jay changed it to point to the new database, and also set it so that it won’t be overwritten when i copy my files over.
I’m *not sure* whether we actually managed to set the database up, ie create all the tables and fields using my schema. There was an issue with rake – it didn’t seem to want to work. I think that this was maybe just because the files were still copying over the ftp. I just tried it now, but it’s having a problem because hpricot isn’t installed. hpricot is one of my gems (or is it a plugin?), so i guess all the gems and plugins need to be there before the migrate can happen.
Hmm. Think i’ll try commenting out those lines from environment.rb for now to see if i can get the migration to work…nope, now it has a permissions issue:
Access denied for user ‘max’@’localhost’ (using password: YES)
I’m a bit nervous about flailing around with this in case i break something. Think i’ll leave it till i get my next expert help session tomorrow from James McCarthy.
So, might as well get on with installing the gems and plugins! According to my environment.rb file, this is what i’m using (in future it would be a good idea to put in a comment next to them with the precise command i used to install them):
require ‘hpricot’ – used to get the title of a web page from a url
Now, i remember reading about a ruby gem that basically takes all of your gems, and maybe plugins, that you’re using and does something with them that makes them easy to copy over. Looks like this is it – Rick Olsen’s Tzinfo: http://agilewebdevelopment.com/plugins/gems
Looks a bit complex – or rather, i’m nervous :) Going to try installing them one by one. Let’s do hpricot first as i think that was pretty simple (unlike rmagick/imagemagick).
hpricot: seems simple enough – just type
gem install hpricot
Gah, foiled again: i get a choice of versions (windows, jruby, ruby) and when i choose ruby i get:
ERROR: While executing gem … (Errno::EACCES)
Permission denied – /usr/lib/ruby/gems/1.8/cache/hpricot-0.6.gem
OK – time to mail the bluehost people i think…
OK – before i post my question, they suggest some previous replies that may be helpful. One of them is “How do I install my own Gems?”. Let’s have a look.
OK – according to this, i do the following: use their file manager to open .bashrc, which is in the root directory (back it up first). Then add the following lines to the end:
Then connect to the site with ssh (i’m in there already), and enter the following in the root folder:
cp /usr/lib/ruby/gems/1.8/cache/sources-0.0.1.gem ./
gem install sources-0.0.1.gem
gem update -y
Did the first line, got a permission denied error again. OK, i’m mailing them now! Arggh, they’ve got no option to edit your ‘ticket’ ie your help request – it’s either send it or cancel it and start again! That’s really annoying. Going to have to rewrite it as i want to tell them that this other suggestion doesn’t work.
Next day…still waiting for a reply. bah.