Dec
06
2009
This is a just a quick note about how to deploy Sinatra on Site5.com Passenger
Gems
My gems are installed in my user folder:
INSTALLATION DIRECTORY:
GEM PATHS:
- /home/it808com/.gem/ruby/1.8
- /usr/lib/ruby/gems/1.8
GEM PATHS:
- ~/.gem/ruby/1.8
- /usr/lib/ruby/gems/1.8
In my public_html/sinatra_app/.htaccess
# Phusion Passenger Start
PassengerEnabled on
PassengerAppRoot ~/public_html/sinatra_app
RackBaseURI /sinatra_app
# Phusion Passenger End
My sinatra_app folder consists of
app.rb
config.ru
public/
tmp/
Getting my gems into the sinatra environment requires 2 lines in the config.ru file
ENV['GEM_HOME'] = '~/.gem/ruby/1.8'
ENV['GEM_PATH'] = '~/.gem/ruby/1.8:/usr/lib/ruby/gems/1.8'
require 'rubygems'
require 'sinatra'
require 'app'
run Sinatra::Application
My app.rb looks like
get '/' do
"Hello World #{Time.now.utc} #{params.inspect}"
end
Jul
22
2009
I recently created a little toy rails app to see how easy it was to bring up rails with Site5’s Phusion Passenger. Following the instructions at first everything went as planned and my rails app was working flawlessly.
A few days later I was writing a 2nd rails app and noticed a Wordpress 404 error whenever I asked for a route other than the root URL. I tried my original rails app and it was broken also. I hadn’t touched a thing.
After a chat session with Site5 support (awesome response), it wasn’t resolved. Their level 1 support said it was my .htaccess file, and provided no other help (poor response).
After opening a ticket myself and providing them my .htaccess, environment.rb and symlink they again said it was my .htaccess file, but this time it was my public_html .htaccess file that was wrong. But still no other url or hint.
Turns out my public_html .htaccess file has some wordpress rewrite rules in it. I needed to exclude the rails subdirectories so that wordpress wouldn’t see them.
Here’s what I added to my public_html .htaccess
RewriteCond %{REQUEST_URI} !^/rails_app_name/
Jul
11
2009
After setting up my account at github I created my first repository and followed their directions for configuring my local copy.
Things were going well but I got stuck on the public key portion. The rest of this is what I did to complete the configuration:
Followed the steps in the github for adding public keys
My first problem was this error when I tried to git push
Permission denied (publickey).
I had to follow these steps to generate my public key correctly
ssh-agent /bin/bash
ssh-add (without the .pub)
Now I could push to github.
Jul
05
2009
I just spent several hours looking at a error code 500 for a wpremix3 style.php page in Firebug. When I tried the url manually I got the same error with a generic Apache error page.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Resolution:
This post in the Site 5 forums lists the correct folder and file permissions.
I set the permissions for wpremix folder to 755 and files to 644. Problem solved.
Nov
04
2007
For the drupal installation I have installed fckeditor, google_analytics, and pathauto.
For themes, I selected the LiteJazz theme from rooplethemes.
Nov
02
2007
Since my son started kindergarten this year I thought I would be a proactive parent and be involved in the school’s PTA. I quickly learned that the PTA only used email and no other internet based technology.
Based on a co-worker’s experience and recommendation I signed the PTA up for Google Apps Standard Edition. I also reserved the domain name (.org and .com) for them. I learned that the Gmail part of Google Apps is top-notch. I had some hiccups with the Start page and Google Docs.
I also selected Drupal for their public and member’s only website. I also seriously considered Wordpress, because I saw several posts about using Wordpress as a CMS. After I got an idea of how many committees and people were involved, I decided that Drupal gives me the most flexibility in trying to meet each committees’ needs.
The current status is that I have about 25 Google Apps accounts created, but only a handful of people using it regularly. I setup email lists (aliases) that forward mail to individual accounts. I have configured the individual accounts to also send as the email alias. This configuration solved my dilemma of the PTA using co-chairs, meaning no one person was the “leader”. I didn’t want to configure a main committee account and have it forward to a secondary account. This would also not have solved the send as requirement. So I think the email alias is the right way to go.
Part II will discuss configuring Drupal and learning about which modules and themes I decided to implement.
Oct
27
2007
After yesterday’s post I realized that I only proved that the subdomain worked. I didn’t actually get rails running. So today I’m continuing.
- Renamed public/index.html
- Edit config/routes.rb to define a default route, I uncommented the welcome controller entry
- Generated the welcome controller (ruby ./script/generate controller Welcome index)
- Added this to the index method
- render :text => ‘Hello World’
- Opened my browser and got this great error message:
- Rails application failed to start properly”
Now I thought, okay I didn’t create the DB yet. I also checked the logs and they were all 0.
I ended up using Site5’s SiteAdmin to create the DB. I discovered that my account doesn’t have create database rights through PhpMyAdmin or MySql command-line. Interesting, but no big deal (right now).
I tried to access the site again and got the same error. I thought about killing the cgi/fcgi processes, but I didn’t think I had started them yet. So I put the error into google and found this page: http://6brand.com/application-error-rails-app-failed-to-start-properly
I fired up my ssh connection and performed these commands:
- cd ~/myrailsapp
- chmod 755 public
- chmod 755 public/dispatch.fcgi
- chmod -R 775 log
- chmod -R 775 tmp
I tried the site again and viola, rails is up with the render :text message.
Next, I try some real functionality. Or maybe I’ll try a capistrano deploy to get that all worked out first. And I guess subversion too.
Oct
26
2007
I have Wordpress as my domain root and when I tried to nest a rails app as a subfolder things didn’t work out. Instead I created a subdomain (i.e. test.mydomain.com), then I symlinked the rails_apps/public to the subdomain.
At site5 this boils down to the following steps:
- Sign in to your SiteAdmin url
- Click Manage My Domains, Subdomains
- Add the subdomain
- ssh to your domain
- cd ~
- Create your rails app > rails myapp
- Delete the subdomain directory created by SiteAdmin
- cd public_html
- rm -r subdomain
- Create the symlink from your rail app/public to the subdomain
- cd ~
- ln -s ~/myapp/public/ ~/public_html/subdomain
- Open your browser to http://subdomain.mydomain.com
- You should see the default index.html file for Rails
References:
http://www.hostingrails.com/forums/deployment_troubleshooting_thread/145
Oct
16
2007
I selected Site5 for my webhosting needs and so far it’s been okay. I had some trouble with their initial provisioning; it said I would be up in “minutes”, but it turned out to be 3 days. I opened 3 tickets and the response was fair (7 hours), but they were informative.