Yu-Chieh’s Blog (Y.C. Chang)

Ruby on Rails / Rubygems / FullStack / Git / Mac notes.

How to Install and Deploy Redmine 2.6.x on Heroku

1
2
$ git clone https://github.com/redmine/redmine.git -b 2.6-stable
$ cd redmine
  • remove those files from .gitignore
1
2
3
4
5
6
7
Gemfile.lock
Gemfile.local
public/plugin_assets 
config/initializers/session_store.rb 
config/initializers/secret_token.rb 
config/configuration.yml 
config/email.yml
  • remove those block from Gemfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
platforms :mri, :mingw do
  # Optional gem for exporting the gantt to a PNG file, not supported with jruby
  group :rmagick do
    # RMagick 2 supports ruby 1.9
    # RMagick 1 would be fine for ruby 1.8 but Bundler does not support
    # different requirements for the same gem on different platforms
    gem "rmagick", (RUBY_VERSION < "1.9" ? "2.13.3" : ">= 2.0.0")
  end

  # Optional Markdown support, not for JRuby
  group :markdown do
    # TODO: upgrade to redcarpet 3.x when ruby1.8 support is dropped
    gem "redcarpet", "~> 2.3.0"
  end
end

platforms :jruby do
  # jruby-openssl is bundled with JRuby 1.7.0
  gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0'
  gem "activerecord-jdbc-adapter", "~> 1.3.2"
end

# and
database_file = File.join(File.dirname(__FILE__), "config/database.yml") if File.exist?(database_file)
  database_config = YAML::load(ERB.new(IO.read(database_file)).result)
    ...
    else
  warn("No adapter found in config/database.yml, please configure it first") end
    else
warn("Please configure your config/database.yml first") end
  • replace above block with this
1
2
3
4
5
6
7
8
9
group :development, :test do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
  gem 'thin' # change this if you want to use other rack web server
end
  • bundle it without production
1
$ bundle install --without production test
  • generate secret token for redmine
1
$ rake generate_secret_token
  • create heroku app
1
$ heroku create APP_NAME
  • To avoid aborting when deploying to heroku, we have to do the following two steps: In config/environment.rb we have to remove (or comment) line 10, where it says
1
2
3
exit 1
# remove it or comment it
# exit 1
  • add this under config/application.rb
1
2
3
4
5
...
module RedmineApp
  classApplication<Rails::Application
    config.assets.initialize_on_precompile = false # add this line
...
1
2
3
$ git add -A
$ git commit -m "preparing for heroku" 
$ git push heroku 2.6-stable:master
1
2
3
4
5
6
7
8
9
10
11
12
$ heroku run rake db:migrate
$ heroku run rake redmine:load_default_data
$ heroku open

# Logging into the application
# Use default administrator account to log in:
#
# login: admin
# password: admin
# 
# if you want to reset db, run the following command
# heroku pg:reset DB_NAME
  • done.

Comments