HowTo Install Redmine (3xx) on Heroku » History » Version 1
S.H. (GAMELINKS), 2018-01-18 08:16
add "How To Install Redmine 3.x.x on Heroku" process
| 1 | 1 | S.H. (GAMELINKS) | h1. HowTo Install Redmine (3xx) on Heroku |
|---|---|---|---|
| 2 | |||
| 3 | Refer to these article |
||
| 4 | * https://stackoverflow.com/questions/39261996/heroku-and-rails-gem-load-error-with-postgres-however-it-is-specified-in-gemfi |
||
| 5 | * https://medium.com/mozaix-llc/how-to-deploy-redmine-to-heroku-41684d888b05 |
||
| 6 | |||
| 7 | First, git clone to Redmine stable source |
||
| 8 | |||
| 9 | <pre> |
||
| 10 | git clone https://github.com/redmine/redmine.git -b 3.4-stable |
||
| 11 | </pre> |
||
| 12 | |||
| 13 | And move to redmine project directory |
||
| 14 | |||
| 15 | <pre> |
||
| 16 | cd redmine |
||
| 17 | </pre> |
||
| 18 | |||
| 19 | |||
| 20 | Edit .gitignroe file, and remove such line's |
||
| 21 | |||
| 22 | <pre> |
||
| 23 | Gemfile.lock |
||
| 24 | Gemfile.local |
||
| 25 | public/plugin_assets |
||
| 26 | config/initializers/session_store.rb |
||
| 27 | config/initializers/secret_token.rb |
||
| 28 | config/configuration.yml |
||
| 29 | config/email.yml |
||
| 30 | </pre> |
||
| 31 | |||
| 32 | Editing Gemfile, remove or comment this block |
||
| 33 | |||
| 34 | <pre> |
||
| 35 | database_file = File.join(File.dirname(__FILE__), "config/database.yml") |
||
| 36 | if File.exist?(database_file) |
||
| 37 | database_config = YAML::load(ERB.new(IO.read(database_file)).result) |
||
| 38 | adapters = database_config.values.map {|c| c['adapter']}.compact.uniq |
||
| 39 | if adapters.any? |
||
| 40 | adapters.each do |adapter| |
||
| 41 | case adapter |
||
| 42 | when 'mysql2' |
||
| 43 | gem "mysql2", "~> 0.4.6", :platforms => [:mri, :mingw, :x64_mingw] |
||
| 44 | when /postgresql/ |
||
| 45 | gem "pg", "~> 0.18.1", :platforms => [:mri, :mingw, :x64_mingw] |
||
| 46 | when /sqlite3/ |
||
| 47 | gem "sqlite3", (RUBY_VERSION < "2.0" && RUBY_PLATFORM =~ /mingw/ ? "1.3.12" : "~>1.3.12"), |
||
| 48 | :platforms => [:mri, :mingw, :x64_mingw] |
||
| 49 | when /sqlserver/ |
||
| 50 | gem "tiny_tds", (RUBY_VERSION >= "2.0" ? "~> 1.0.5" : "~> 0.7.0"), :platforms => [:mri, :mingw, :x64_mingw] |
||
| 51 | gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw, :x64_mingw] |
||
| 52 | else |
||
| 53 | warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems") |
||
| 54 | end |
||
| 55 | end |
||
| 56 | else |
||
| 57 | warn("No adapter found in config/database.yml, please configure it first") |
||
| 58 | end |
||
| 59 | else |
||
| 60 | warn("Please configure your config/database.yml first") |
||
| 61 | end |
||
| 62 | </pre> |
||
| 63 | |||
| 64 | And add this block |
||
| 65 | |||
| 66 | <pre> |
||
| 67 | group :production do |
||
| 68 | gem 'pg', '~> 0.20' |
||
| 69 | end |
||
| 70 | </pre> |
||
| 71 | |||
| 72 | install the gem's to bundle install |
||
| 73 | |||
| 74 | <pre> |
||
| 75 | bundle install |
||
| 76 | </pre> |
||
| 77 | |||
| 78 | get secret token with this command |
||
| 79 | |||
| 80 | <pre> |
||
| 81 | rake generate_secret_token |
||
| 82 | </pre> |
||
| 83 | |||
| 84 | In config/enviroment.rb edit to "exit 1" (remove or comment) |
||
| 85 | |||
| 86 | <pre> |
||
| 87 | exit 1 |
||
| 88 | </pre> |
||
| 89 | |||
| 90 | In config/application.rb add to this line |
||
| 91 | |||
| 92 | <pre> |
||
| 93 | config.assets.initialize_on_precompile = false |
||
| 94 | </pre> |
||
| 95 | |||
| 96 | Create to Heroku App |
||
| 97 | |||
| 98 | <pre> |
||
| 99 | heroku apps:create -a APP_NAME |
||
| 100 | </pre> |
||
| 101 | |||
| 102 | Add, postgreaql addon's |
||
| 103 | |||
| 104 | <pre> |
||
| 105 | heroku addons:create heroku-postgresql |
||
| 106 | </pre> |
||
| 107 | |||
| 108 | Link to remote (heroku) |
||
| 109 | |||
| 110 | <pre> |
||
| 111 | heroku git:remote -a APP_NAME |
||
| 112 | </pre> |
||
| 113 | |||
| 114 | Deploy to Heroku these command |
||
| 115 | |||
| 116 | <pre> |
||
| 117 | git add -A |
||
| 118 | git commit -m “Redmine for Heroku deployment” |
||
| 119 | git push heroku 3.4-stable:master |
||
| 120 | </pre> |
||
| 121 | |||
| 122 | Finally, migrate & loding default data |
||
| 123 | |||
| 124 | <pre> |
||
| 125 | heroku run rake db:migrate |
||
| 126 | heroku run rake redmine:load_default_data |
||
| 127 | </pre> |