Avoiding Errors When Setting Up Webistrano

Assuming you already have Ruby, RubyGems and MySQL  installed on your system, along with the necessary development files and tools for compiling, this may help you avoid a lot of confusing errors when you are trying to set up Webistrano.

I got stuck at the part – rake db:migrate. One error would come out after another, it was overwhelming for first timers like me.

However, I could have saved a day of searching on the Internet and trying to figure out what all the errors and warnings meant. I have tried installing Ruby from the distro repositories to compiling Ruby from source with different versions, to installing different RubyGem versions, together with different gem combinations. In the end, it is all about satisfying dependencies.. . and these are all written down in an inconspicuous file. Definitely it is not the README file although I hoped it would have mentioned something about it there.

One of the answers for avoiding errors is right inside a file called environment.rb. This is a small file under the config directory of Webistrano. Open the said file and scroll down where you see a list of config.gem requirements. These are the gem versions you need to install using the gem install command. Below is an example:

config.gem ‘net-ssh’, :version => ‘2.0.15’, :lib => ‘net/ssh’
config.gem ‘net-scp’, :version => ‘1.0.2’, :lib => ‘net/scp’
config.gem ‘net-sftp’, :version => ‘2.0.2’, :lib => ‘net/sftp’
config.gem ‘net-ssh-gateway’, :version => ‘1.0.1’, :lib => ‘net/ssh/gateway’
config.gem ‘capistrano’, :version => ‘2.5.9’
config.gem ‘highline’, :version => ‘1.5.1’
config.gem ‘open4’, :version => ‘0.9.3’
config.gem ‘syntax’, :version => ‘1.0.0’

To install specific versions of the these gems do like so,

gem install net-ssh -v 2.0.15

Note that you do not have to uninstall a version if one is already installed. 2 versions of the same gem can co-exist.

Another answer in getting around those errors is to not use the vendor/rails that comes with the Webistrano package. Delete that directory or simply rename it. But watch out! Once you do so you will need to specify the Rails version to use or have the same one that is in the.. . yet again.. . environment.rb file. Below is an example:

# Specifies gem version of Rails to use when vendor/rails is not present
#RAILS_GEM_VERSION = ‘2.3.5’ unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = ‘2.3.12’

The last advise I can give you is to not have an exclamation mark (!) in your password for your webistrano mysql user. For some reason it conflicts with how the file is read in config/database.yml, thus you will get an error. I don’t know if quotes can be used for the password line. Maybe that is possible. In most examples I have found they never used quotes, nor was it mentioned that quotes can be used. Typical example of a portion of the database.yml content is,

production:
adapter: mysql
database: webistrano_production
username: webistrano
password: PASSWORD
host: localhost
port: 3306

I suppose quotes can be employed, but after a long day of trying to get Webistrano to run I was too annoyed to experiment further. Maybe some other time. Right now I’m just glad that Webistrano is running on port 3000.

Oh, don’t forget to open up said port on your firewall. Otherwise nothing will happen.

Similar Posts: