Procedure to Install Redmine on Heroku

Tadashi Shigeoka ·  Sun, December 11, 2011

I installed Redmine, a Ruby-based project management software, on Heroku, so I’ll share the procedure.

Heroku

・Official: Redmine.JP

The procedure for installing Redmine on Heroku was based on the following site. Thank you.

Herokuにredmineを設置する « yukku@wp (Installing redmine on Heroku « yukku@wp)

Download/Extract Redmine

wget http://rubyforge.org/frs/download.php/75593/redmine-1.2.3.tar.gz
tar zxvf redmine-1.2.3.tar.gz
mv redmine-1.2.3 redmine-bkr
cd redmine-bkr/

Specify Gems to Install on Heroku

Redmine apparently doesn’t work unless Rails, Rack, and i18n versions are properly aligned, so we’ll create a .gem file referencing the official blog.

・Reference: Redmine 1.2をCentOS5.6にインストールする手順 | Redmine.JP Blog (Procedure to Install Redmine 1.2 on CentOS5.6 | Redmine.JP Blog)

■ .gems

rails --version 2.3.11
rack --version 1.1.1
i18n --version 0.4.2

Edit Source Code for Heroku

Rails applications running on Heroku can only create files under /tmp, so we’ll change the storage location for attachments and such.

First, create the necessary directories. Since git cannot add empty directories, we’ll also create dummy files.

mkdir tmp/files
mkdir tmp/plugin_assets
touch tmp/files/dummy
touch tmp/plugin_assets/dummy

Next, edit the corresponding files:

■ app/models/attachment.rb

@@storage_path = Redmine::Configuration['attachments_storage_path'] || "#{RAILS_ROOT}/files"

↓ (Change)

@@storage_path = Redmine::Configuration['attachments_storage_path'] || "#{RAILS_ROOT}/tmp/files"

■ vendor/plugins/engines/lib/engines.rb

self.public_directory = File.join(RAILS_ROOT, 'public', 'plugin_assets')

↓ (Change)

self.public_directory = File.join(RAILS_ROOT, 'tmp', 'plugin_assets')

Add session secret key configuration:

■ config/environment.rb

config.action_controller.session = { :key => "_my_redmine_session", :secret => "some-secret-phrase-over-30-length" }

Configure the database:

■ config/database.yml

cp config/database.yml.example config/database.yml
vim config/database.yml
production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: postgres
  password: "postgres_passwd"

Configure the mail server:

■ config/configuration.yml

cp config/configuration.yml.example config/configuration.yml
vim config/configuration.yml
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "localhost"
      port: 25
      domain: 'yourappname.heroku.com'

Git Initialization/Commit

git init
git add .
git commit -m 'init'

Create Heroku App/Deploy

heroku create
git push heroku master
heroku rake db:migrate

Operation Check

heroku open

That’s all from the Gemba for those wanting to deploy Redmine to Heroku.