Redmine 0.8 on Dreamhost
For those who are trying to get Redmine to work on Dreamhost using Passenger, check out these notes.I had lots of problems mostly because 1) of reading too much outdated information, 2) reading wrong information too, so… the simple way is:
Start from a clean base install…
1. Cleaning up the house: 1.1 Remove all stuff related with gems on you home directory $ cd ~ ; rm -rf .gem* 1.2 Remove all GEM_PATH's in your .bash_profile (there are many howtos with inconsistent information about this) (after removing, reload it) $ source .bash_profile 2. Install Rails 2.1.2 because Redmine 0.8 needs it $ gem install rails -v=2.1.2 3. Check its installetion $ gem list --local | grep 'rails' rails (2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.2)
Ok, now lets continue…
(quoting original post: Dreamhost howto)
1. From the Dreamhost control panel, create a new subdomain for the application such as yoursubdomain.yourdomain.com
1. Make sure the domain supports “Ruby on Rails Passenger (mod_rails)?”
2. Specify your web directory: /home/username/yoursubdomain.yourdomain.com/public
* you must add the public!!!
2. From the Dreamhost control panel create a new MySQL database named yourdatabasename
3. ssh into your Dreamhost account
4. cd ~/yoursubdomain.yourdomain.com
5. svn export --force svn://rubyforge.org/var/svn/redmine/branches/0.8-stable ./
* check http://www.redmine.org/wiki/redmine/Download for the latest version
6. also watch out for permissions
* chmod -v -R 755 ./*
7. cd ~/yoursubdomain.yourdomain.com/config
8. cp database.yml.example database.yml
9. nano database.yml
1. 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
10. cd ~/yoursubdomain.yourdomain.com/public
11. cp dispatch.rb.example dispatch.rb
12. nano .htaccess (replace with following text)
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
ErrorDocument 500 "H2Application errorH2 Rails application failed to start properly"
* replace the H2 with the proper HTML tag when you place it in the .htaccess
12. for now just remove .htaccess to get it working, then you can play with it at the end.
$ mv public/.htaccess public/.htaccess_off
13. cd ~/yoursubdomain.yourdomain.com
13.1 Some chamges in environment.rb
$ vi config/environment.rb
13.2 Uncomment this line
ENV['RAILS_ENV'] ||= 'production'
13.3 and take attention to this one, we do want this version!
RAILS_GEM_VERSION = '2.1.2' unless defined? RAILS_GEM_VERSION
13.4 now lets point it to use our gem_path on our local gem directory
ENV["GEM_PATH"]="/home/<YOUR USERNAME>/.gem:/usr/lib/ruby/gems/1.8"
(Attention to .gem agains .gems directory from other tutorials.
with a fresh clean install, rubygem install everything on .gem by default, so lets KISS)
13.5 PStore error? Change this:
# config.action_controller.session_store =
Store
config.action_controller.session = {
:session_key => "_myapp_session",
:secret => "some secret phrase of at least 30 characters"
}
13.6 and finally freeze the app
$ rake rails:freeze:edge TAG=rel_2-1-2
14. from application root type
* rake db:migrate RAILS_ENV="production"
15. also type the following to load config defaults
* rake redmine:load_default_data RAILS_ENV="production"
* choose "en" for english
16. Before pointint your browser to http://yoursubdomain.yourdomain.com
you must RESTART your application. Some tutorials are wrong telling your to REBOOT the app.
$ echo `date`>> tmp/restart.txt ; cat tmp/restart.txt
16. browse to http://yoursubdomain.yourdomain.com
I hope this can help you! Drop me a post if you have some suggestions… I need them too
Alcides Fonseca said,
January 30, 2009 @ 1:43 am
Well, I had it working following the wiki without any issues. Just entered the database and mail settings, get it online, rake migrate and I was good to go.
And it still works, even without any freeze.
include said,
January 30, 2009 @ 2:02 am
Hi @alcides thats great for you
. In fact I can’t explain why some dreamhost users and I had problems on this trivial stuff of deploy a rails app… and even worst deploying on a Passenger environment!!
well, next time I have problems with Rails I know who to chat with
(kidding, love to solve things all by my self… ok I know this is a bad policy but…
)
regards
jed said,
February 5, 2009 @ 9:40 pm
Two questions:
1) in regards to restart, what exactly is redmine looking for? the system time of the last restart?
2) Which dispatch files do you have enabled in your public directory. just .rb, or the fcgi and cgi as well? I could be imagining things but my app seems to run faster with both fcgi and passenger enabled at the dreamhost control panel. Is anyone else getting this result?
Well I guess, actually 3) anyone else getting slow load time off dreamhost? Suggestions?
include said,
February 5, 2009 @ 10:01 pm
Hi Jed
1) If I understand your question, Redmine is not looking for anything. The thing is, whenever you need to restart the Passenger (modrails) for you too “reload” your application, the way you have to do this is by touching the file restart.txt:
http://www.modrails.com/documentation/Users%20guide.html#_redeploying_restarting_the_ruby_on_rails_application
and yes I think Passenger watchs for the presence and (c|m|a)time of this file.
2) I keep just dispatch.fcgi on it. I aggree with you, seems to be faster.
Hope you can get it running faster.
Regards
Francisco
jed said,
February 5, 2009 @ 10:52 pm
Francisco, thanks for the pronto reply. I couldn’t figure out if you were suggesting that you didn’t need to touch the restart.txt file or not. Strangely though, when i usually restart, the restart.txt file is destroyed. today, it persists, so i am not sure it is actually restarting.
I tried to add some more current information to the dreamhost wiki page http://wiki.dreamhost.com/Redmine
so this is easier for the next person.
ATM for me this is just a temp solution so i can decide if i really like the Redmine solution. So far, it is exceptional in all respects. Once my projects start becoming more lucrative, I’ll probably move my rails apps to a ruby specific host. Its just that dreamhost is so damn affordable.. :0
What did your final .htaccess rewrite rules look like? Curiously comparing notes..
jed
include said,
February 6, 2009 @ 12:14 am
Hi again Jed,
No need to thanks
. I like to get help too and help just fits in a short time for us.
It’s not a suggestion. You must touch the tmp/testart.txt file for Passenger to restart.
And yes, Passenger removes that file at the end.
Well I think in fact it does restart or else is something wrong not with your Redmine install but with Dreamhost’s Systems (config). Dreamhost guys says this may take a while.
Yheaa. I love the power of wiki’s. Nice job. thanks!
I love Redmine. Muliprojects, easy git integration, clean layout and many things
. Ok, Trac is fabulous too but no multi-project built-in is a pita.
. I need to start my own too. And yes I aggree with you DH is affordable eheh.
Hope you make losts of money with your projects
Regarding .htaccess, I still ain’t using it et all. I must finish that soon because I wanna test if we can add basic auth to it as we do with Apache. Some months ago this was an issue.
http://code.google.com/p/phusion-passenger/issues/detail?id=94
Regards, and once again good luck
Francisco
PhreeStyler said,
March 4, 2009 @ 5:46 am
Hi there!
I hope this article could help me on setting up a redmine app on my dreamhost account, but I’m stucked in this step:
$ rake db:migrate RAILS_ENV=”production” –trace
(in /home//..com)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant ActionController::AbstractRequest
I followed the tutorial as you wrote, but even changing rails or gem versions I can not move on.
Any tips?
include said,
March 5, 2009 @ 6:32 pm
Hi PhreeStyler,
sorry just to anwser now to your reply.
What Rails versions have you installed?
If I remember Redmine only works with 2.2.2
http://www.redmine.org/wiki/redmine/RedmineInstall
PhreeStyler said,
March 5, 2009 @ 11:26 pm
Thanks for your reply,
Redmine current trunk requires Rails 2.2.2 but Redmine 0.8 requires v2.1.2.
Anyway, I changed the version in config/environment.rb but the error persists
include said,
March 5, 2009 @ 11:36 pm
Hi PhreeStyler,
Well weird. I’m getting out of ideas. Why don’t you start from begining and try trunk version.
PhreeStyler said,
March 5, 2009 @ 11:40 pm
BTW I set up RedMine yesterday on a local Ubuntu Server with no problems, maybe dreamhost has some particularities I’m not getting