Setup Redmine 1.3 on Heroku
I set up Redmine 1.3 on Heroku today. Since I stuck in some points, I leave a memo :)
■ Download Redmine
■ Create a repository & init it
> cd [redmine dir]
> git init
□ Edit .gitignore
> vi .gitignore
Delete the line "/config/configuration.yml" so that changes to config file can be committed.
■ Modify config files for heroku
Since Heroku allows users to put files only under tmp, following modifications are needed.
vi app/models/attachment.rb - @@storage_path = "#{RAILS_ROOT}/files" + @@storage_path = "#{RAILS_ROOT}/tmp/files" vi vendor/plugins/engines/lib/engines.rb - self.public_directory = File.join(RAILS_ROOT, 'public', 'plugin_assets') + self.public_directory = File.join(RAILS_ROOT, 'tmp', 'plugin_assets') vi config/environment.rb + config.action_controller.session = { :key => "_myapp_session", :secret => "secret" } mkdir tmp/files mkdir tmp/plugin_assets [http://d.hatena.ne.jp/answered/20100427/1268664663:title:bookmark] (Japanese)
■ Create an app on Heroku
Specify stack explicitly. Redmine needs Ruby1.8.
> heroku create [app name] --stack=bamboo-ree-1.8.7
■ Email notification with Sendgrid
□ Add the Sendgrid add on
> heroku addons:add sendgrid:starter
SendGrid | Heroku Dev Center
□ Check sendgrid info
> heroku config
BUNDLE_WITHOUT => development:test
DATABASE_URL => postgres://xxx
LANG => en_US.UTF-8
RACK_ENV => production
SENDGRID_PASSWORD => xxxxxxxx
SENDGRID_USERNAME => appxxxxxxx@heroku.com
SHARED_DATABASE_URL => postgres://xxx
□ Add smtp server information in config/config.yml
> cp config/configuration.yml.example config/configuration.yml
> vi config/configuration.yml
production: delivery_method: :smtp smtp_settings: address: smtp.sendgrid.net port: 25 domain: xxx.heroku.com authentication: :plain user_name: [the sendgrid user name you checked out with "heroku config" command. It's like appxxxxxxx@heroku.com password: [the sendgrid password you checked out with "heroku config" command]
Be sure to comment out the default setting...
#default: # Outgoing emails configuration (see examples above) # email_delivery: # delivery_method: :smtp # smtp_settings: # address: smtp.example.net # port: 25 # domain: example.net # authentication: :login # user_name: "redmine@example.net" # password: "redmine"
I forgot this and stuck setting email notification for several hours... Ugh!
■ Deploy redmine on Heroku
> git add .
> git commit -m "[some messages]"
> git push heroku master
■ DB migration on Heroku
> heroku rake db:migrate
■ TODOs after the setup
- change admin password
- load default data (goto "administration" menu then instruction appears. "> heroku rake redmine:load_default_data" didn't work for Heroku)
That's all! Enjoy :)