Redmine on Dreamhost with Passenger
May 16th, 2008
As of May 13, 2008 Dreamhost provides a feature called Passenger for Ruby on Rails. This make is significantly easier to install Ruby On Rails Apps on Dreamhost!!!
The following is how I install Redmine on Dreamhost with Passenger
- From the Dreamhost control panel, create a new subdomain for the application such as yoursubdomain.yourdomain.com
- Make sure the domain supports “Ruby on Rails Passenger (mod_rails)?”
- Specify your web directory: /home/username/yoursubdomain.yourdomain.com/public
- you must add the public!!!
- From the Dreamhost control panel create a new MySQL database named yourdatabasename
- ssh into your Dreamhost account
cd ~/yoursubdomain.yourdomain.comsvn export --force svn://rubyforge.org/var/svn/redmine/branches/0.7-stable ./- check http://www.redmine.org/wiki/redmine/Download for the latest version
- also watch out for permissions
chmod -v -R 755 ./*
cd ~/yoursubdomain.yourdomain.com/configcp database.yml.example database.ymlnano database.yml- edit the database.yml config file with the appropriate info. Should be similar to the following
production:
adapter: mysql
database: yourdatabasename
username: yourusername
password: yourpassword
host: mysql.yourdomain.com
- edit the database.yml config file with the appropriate info. Should be similar to the following
cd ~/yoursubdomain.yourdomain.com/publiccp dispatch.rb.example dispatch.rbnano .htaccess(replace with following text)
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
ErrorDocument 500 “<h2>Application error</h2>Rails application failed to start properly”cd ~/yoursubdomain.yourdomain.com- from application root type
rake db:migrate RAILS_ENV="production"
- also type the following to load config defaults
rake redmine:load_default_data RAILS_ENV="production"
- choose “en” for english
- browse to http://yoursubdomain.yourdomain.com
Reference
http://www.redmine.org/wiki/redmine/RedmineInstall
www.jorgeivanmeza.com
http://www.redmine.org/boards/2/topics/show/69
http://wiki.dreamhost.com/Passenger
May 16th, 2008 at 1:01 pm
I ran into a problem where my RedMine install was displaying only in plain text. It wasn’t serving the static files (CSS, Images, etc) that make it look like a normal webpage. The following is how I fixed the problem - hope this helps someone!
1 - ssh into yoursubdomain.yourdomain.com
2 - run the following commands to build and implement a fresh .htaccess file.
ruby rortest
cp rortest/public/.htaccess public/
3 - run the following commands to restart redmine.
cd tmp
echo ‘x’ > reboot.txt
That did it for me. Good luck!
May 16th, 2008 at 2:09 pm
It looks like DreamHost likes to kill RedMine after a minute or two of inactivity. This makes the next page load subject to a 30 second wait as redmine is restarted.
Any ideas on how to get around this…? Faster load times? Or a way to keep the app from stalling?
May 21st, 2008 at 11:28 pm
You try setting up a cron job to “ping” the application to keep it alive.
crontab -e */15 * * * * curl -s http://www.yourhost.com/your_non_cached_file/ > /dev/nullSee dreamhost wiki for details
http://wiki.dreamhost.com/index.php/Ruby_on_Rails
May 23rd, 2008 at 7:58 pm
I think you meant
rails rortest
not
ruby rortest
June 5th, 2008 at 10:30 pm
I think it is actually restart.txt not reboot.txt
June 9th, 2008 at 10:06 pm
A few little issues I came across:
It seems like passenger and fastcgi aren’t best of friends. I couldn’t get it running unless I turned off fastcgi. (a bit frustrating as Dreamhost’s wiki says to turn on fastcgi for RoR apps)
Also, what are the caveats with using an svn export as opposed to svn checkout? I’m assuming that the main issue is that updating won’t be as easy? or do you simple export again to the same directory?
June 13th, 2008 at 11:01 am
With dreamhost, I never mix RoR apps with other apps that might need FastCGI support, so I turn off the FastCGI, and turn on the mod_rails. I assume the Dreamhost wiki was just a little out of date, since mod_rails is a relatively new thing.
I never really thought much about the SVN Checkout/Export intricacies. I just don’t like having all the “.svn” information in my production (public viewable app). It kinda felt dirty & like a potential security risk. I know the official redmine docs says to use co (checkout), and this does make it very easy to update the app. I currently manually update the app, which involves, backing it up, deleting the existing app, doing another export, and copying the config files/uploaded docs/other pertinent data back. Wow that seems like a lot of work, but I do feel it is important to remove the potential old files, and not just do another export. Not removing the extra files could lead to a potential security risk. Also if you just do an export, you may overwrite your existing config. So much for my 5 nines of uptime. ;) I may document and post my exact update steps, next time I have to do it.
I did a quick search on Google to see if I was crazy for using export instead of co and found this.
http://www.rubyinside.com/capistrano-security-issue-svn-info-often-publicly-viewable-415.html
June 13th, 2008 at 11:11 am
In a non-dreamhost world you can add a few lines of code to your apache’s httpd.conf to prevent Apache from serving the .svn directories.
http://subversion.tigris.org/faq.html#website-auto-update
On dreamhost you may be able to do something with the .htaccess file. See this
http://www.webmasterworld.com/apache/3189079.htm
July 2nd, 2008 at 11:08 pm
Can you post instructions on how to setup svn with dreamhost? I mean, having multiple repositories for each project automatically. I’ve never set up svn before and from the page on the dreamhost wiki, it appears to make it so that I have to set up a repository for each project in Redmine. Is that true or am i just reading it incorrectly?
July 3rd, 2008 at 3:33 pm
nvm, I understand SVN a little more and realize I’ll have to setup each one myself.
Can you explain what the non-cached file is in the crontab command? I’m having troubles with long load times as well.
August 27th, 2008 at 7:42 pm
No need to tinker with dispatch.rb or .htaccess or pings to keep the app alive if you use Passenger. Passenger doesn’t need any of these, and it disables rewrites.
Also note that you need to unpack redmine before you set up Passenger hosting or you’ll get an error message in the panel. Passenger expects a ready-to-go Rails app before the subdomain can be created.
And I wouldn’t name that directory after the domain if it isn’t the www-root for the domain. That’s confusing. I’d just call it ~/redmine (or ~/redmine-0.7) and either host the subdomain at ~/redmine/public/ or create a symlink ~/subdomain.domain.tld that redirects there. But that’s a matter of taste.
August 27th, 2008 at 8:12 pm
Oh, I see what the .htaccess thing is about. The .htaccess that comes with Redmine breaks the paths to scripts and CSS.
With Passenger, just delete public/.htaccess, restart and you’re fine.