" /> Braindump: février 2008 Archives

« octobre 2007 | Main | septembre 2008 »

février 22, 2008

Plesk 8.3 - Ruby package (gem update)

The package included with Plesk 8.3 (on linux) does not include RDoc. If you try to update gem using the command: gem update --system... the installation will exit with an error. You need to install ruby-rdoc (using yum install ruby-rdoc) and its dependencies before re-running gem update --system. Then it will update Rails and all the other gem to their latest versions.

Plesk 8.3 - ROR app at domain root level

To make the app show up at the document root, we have to create a vhost.conf file in your domain's conf directory, and then use the websrvmng application to regenerate your domain's configuration. Change directory to the domain's conf directory: Code: cd /var/www/vhosts/{domainname.com}/conf/ Create and begin editing a vhost.com file: Code: touch vhost.conf nano vhost.conf Add the following line, replacing data in brackets: Code: DocumentRoot /var/www/vhosts/{domainname.com}/httpdocs/{railsapp}/public Reconfigure the virtualhost using websrvmng: Code: /usr/local/psa/admin/sbin/websrvmng -u --vhost-name={domainname.com} Verify that the following line is in /var/www/vhosts/{domainname.com}/conf/httpd.include (usually at the bottom): Code: Include /var/www/vhosts/{domainname.com}/conf/vhost.conf Restart apache: Code: apache2ctl graceful Visit your site: Code: http://www.{domainname.com}

PLESK 8.3 - RUBY ON RAILS Setup

Ruby on Rails - WORKING This is how I got Ruby on Rails (RoR) working on my Plesk machine. I didn't find any major problems with Plesk's implementation, although it took me about 6 hours of trial-and-error to get it working right. SWSoft - you could seriously use some documentation for each Operating System you support.

First thing's first: In your Plesk control panel, make sure that you have your server updated with Ruby On Rails is installed. To do so, go to Server > Updater and enable "Ruby on Rails Support."

After this, go to your domain, and enable FastCGI, which will allow your site to use RoR.

Change to your httpdocs directory:

Code:

cd /var/www/vhosts/{domainname.com}/httpdocs

Create a basic rails application. To do so, use this command:

Code:

rails {railsapp}

Remember to replace {railsapp} with the name of your application.

Change the file ownership to the domains user/group:

Code:

chown {user}:{group} {railsapp}

Change the permissions on the sessions directory:

Code:

chmod 777 {railsapp}/tmp/sessions

Note: Someone let me know if this is a bad idea ... I don't think it is, but I'm not sure. My system had problems writing to the sessions folder unless I chmod'd 777.

Change directory to your new application and edit your .htaccess file in the public/ directory:

Code:

nano {railsapp}/public/.htaccess

On line 2, change:
Code:

AddHandler fastcgi-script .fcgi

To:
Code:

AddHandler fcgid-script .fcgi

On line 32, change:
Code:

RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

To:
Code:

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

Test your installation. Go to http://www.{domainname.com}/{railsapp}/public/

You should see the standard "Welcome Aboard" Rails index page.