# Velakor Software

## Installation Instructions

Posted by admin July 07, 2006

Installation instructions:

Notes is not yet compatible with Rails 2.0. A version of Rails compatible with Notes is frozen in the app’s vendor directory.

Note: On DreamHost (and possibly other hosts) it is recommended that you replace the shebang line in public/dispatch.fcgi and public/dispatch.cgi with the real location of ruby (currently on DreamHost it is /usr/bin/ruby1.8) – so replace the first line of these files with the line #!/usr/bin/ruby1.8 if you install this app on DreamHost. Read DreamHost wiki at this address for more info.

DreamHost Note: You should use this application using their new mod_rails (Passenger) option instead of the unstable FastCGI. Check this option when you’r
e adding the domain that will host this application. The public directory you choose there should be the “public” directory in the root of the application
(i.e. notes/public).

Part 1 – Setting up the application

Your server should support FastCGI (the .htaccess points to the FastCGI dispatcher). (See note above for DreamHost)

If your server doesn’t support FastCGI, you may use the slow CGI option:

Edit public/.htaccess

Replace “RewriteRule ^(.*)$dispatch.fcgi [QSA,L]” with “RewriteRule ^(.*)$ dispatch.cgi [QSA,L]” (dispatch.fcgi replaced with dispatch.cgi)

You need to have the xmpp4r ruby gem installed if you want to use the jabber functions:

gem install xmpp4r

If you can’t install gems (shared environment), a more easy way is the following:

Unpack the files in the xmpp4r gem archive (http://rubyforge.org/projects/xmpp4r/)

Copy the files callbacks.rb, xmpp4r.rb and the directory xmpp4r (at the top of the gem archive’s directory structure) to the directory /path/to/notes/lib/

You need to have ImageMagick installed (and in the path) otherwise thumbnails won’t be created for uploaded images. DreamHost has this installed by default.

Also you must have RedCloth-3.0.4 or above installed in Ruby.

If you don’t have it installed, run the following command on your command line (after you’ve installed Ruby):

gem install RedCloth

2. It is recommended that you install the application in its own subdomain.
3. Extract the archive; the web root directory must be the “public” subdirectory of the application.
4. Create a database for the application.
5. Execute the file schema.sql (found in the root of the archive) in the database (you can do this from phpMySQL for example)
6. Edit the file config/database.yml and enter the database settings (the database you just created) for production mode.
7. Edit the file app/views/layouts/tab.rhtml and replace “notes.my-domain.com” with the address you installed the application at.

Part 2 – Setting up the reminders

1. Edit config/environments.rb and replace in the lines shown below, your real SMTP server information:

Found in config/environments.rb (replace with your own information):

ActionMailer::Base.server_settings = {
:port => 25,
:authentication => :plain,
:user_name => “mail_user”,
}

2. A procedure in the application needs to be run constantly, in order to send the reminder notifications:

* On Linux, set up a cron job that checks (ideally every minute, but it works on any interval – of course you’ll get delayed reminder notifications) for reminders to be sent

Example:

* * * * * /usr/bin/ruby /home/myuser/notes/script/runner -e production ‘MonitorManager.check_all’ 2>/dev/null >/dev/null

Explanation:

* * * * *: sets up a cron job that is run every minute
/usr/bin/ruby: is the path to ruby
/home/myuser/notes: is the path where the application is installed
2>/dev/null and >/dev/null: discards the output of the command

* On Windows you can use Task Scheduler or similar tools to run the command (preferably every minute):

ruby c:\path\to\notes\script\runner -e production ‘MonitorManager.check_all’

Part 3 – Using the jabber bot (OPTIONAL)

A jabber listener bot (you can control Notes by chatting with it) is included (app/models/jabber_listener.rb).
It uses the same settings as the bot that sends reminders through jabber. (Set the settings in the ‘Account’ section of Notes.)
This bot is a persistent process (it needs to stay logged on so you can talk to it) so you may not be able to run it on certain hosts. On DreamHost it may be killed by the Process Watcher.

Start the bot on your server by running the commands:

ruby script/runner -e production ‘JabberListener.start’ &

or in daemon mode:

ruby script/runner -e production ‘JabberListener.daemon_start’

Send the text help to your bot to see a description of the available commands.

The application was tested on a DreamHost Hosting Account.
For more detailed information on how to setup a Ruby on Rails Application on DreamHost, visit:

http://wiki.dreamhost.com/index.php/Ruby_on_Rails

Alternatively, you may use the built-in Webrick server, to test (or use) the application locally on your own computer:

1.) Install Ruby

2.) Install Rails

Run this command from your command line:
gem install rails –include-dependencies

3.) Install MySQL

4.) Extract the application to a directory on your disk
5.) Follow the steps 4 through 6 in the above instructions (the address of the app will be http://localhost:3000/)
6.) Using the command line, change the directory to the root of the application directory and run the command:

ruby script/server

7.) Follow the steps 7 through 10 (the address of the app will be http://localhost:3000/)