Project

General

Profile

HowTo Install Redmine (3xx) on Heroku » History » Revision 2

Revision 1 (S.H. (GAMELINKS), 2018-01-18 08:16) → Revision 2/3 (Go MAEDA, 2018-01-18 08:23)

h1. HowTo Install Redmine (3.x.x) (3xx) on Heroku  

 Refer to these article 
 * https://stackoverflow.com/questions/39261996/heroku-and-rails-gem-load-error-with-postgres-however-it-is-specified-in-gemfi 
 * https://medium.com/mozaix-llc/how-to-deploy-redmine-to-heroku-41684d888b05 

 First, git clone to Redmine stable source 

 <pre> 
 git clone https://github.com/redmine/redmine.git -b 3.4-stable 
 </pre> 

 And move to redmine project directory 

 <pre> 
 cd redmine 
 </pre> 


 Edit .gitignroe file, and remove such line's 

 <pre> 
 Gemfile.lock 
 Gemfile.local 
 public/plugin_assets  
 config/initializers/session_store.rb  
 config/initializers/secret_token.rb  
 config/configuration.yml  
 config/email.yml 
 </pre> 

 Editing Gemfile, remove or comment this block 

 <pre> 
 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) 
    adapters = database_config.values.map {|c| c['adapter']}.compact.uniq 
    if adapters.any? 
      adapters.each do |adapter| 
        case adapter 
        when 'mysql2' 
          gem "mysql2", "~> 0.4.6", :platforms => [:mri, :mingw, :x64_mingw] 
        when /postgresql/ 
          gem "pg", "~> 0.18.1", :platforms => [:mri, :mingw, :x64_mingw] 
        when /sqlite3/ 
          gem "sqlite3", (RUBY_VERSION < "2.0" && RUBY_PLATFORM =~ /mingw/ ? "1.3.12" : "~>1.3.12"), 
                         :platforms => [:mri, :mingw, :x64_mingw] 
        when /sqlserver/ 
          gem "tiny_tds", (RUBY_VERSION >= "2.0" ? "~> 1.0.5" : "~> 0.7.0"), :platforms => [:mri, :mingw, :x64_mingw] 
          gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw, :x64_mingw] 
        else 
          warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems") 
        end 
      end 
    else 
     warn("No adapter found in config/database.yml, please configure it first") 
    end 
  else 
   warn("Please configure your config/database.yml first") 
  end 
 </pre> 

 And add this block 

 <pre> 
 group :production do 
   gem 'pg', '~> 0.20' 
 end 
 </pre> 

 install the gem's to bundle install 

 <pre> 
 bundle install 
 </pre> 

 get secret token with this command 

 <pre> 
 rake generate_secret_token  
 </pre> 

 In config/enviroment.rb edit to "exit 1" (remove or comment) 

 <pre> 
  exit 1 
 </pre> 

 In config/application.rb add to this line 

 <pre> 
 config.assets.initialize_on_precompile = false 
 </pre> 

 Create to Heroku App 

 <pre> 
 heroku apps:create -a APP_NAME 
 </pre> 

 Add, postgreaql addon's 

 <pre> 
 heroku addons:create heroku-postgresql  
 </pre> 

 Link to remote (heroku) 

 <pre> 
 heroku git:remote -a APP_NAME 
 </pre> 

 Deploy to Heroku these command 

 <pre> 
 git add -A 
 git commit -m “Redmine for Heroku deployment” 
 git push heroku 3.4-stable:master 
 </pre> 

 Finally, migrate & loding default data 

 <pre> 
 heroku run rake db:migrate 
 heroku run rake redmine:load_default_data 
 </pre>