HowTo Install Redmine (3xx) on Heroku » History » Version 3
Toshi MARUYAMA, 2018-01-18 12:33
use code highlight
1 | 2 | Go MAEDA | h1. HowTo Install Redmine (3.x.x) on Heroku |
---|---|---|---|
2 | 1 | S.H. (GAMELINKS) | |
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 | 3 | Toshi MARUYAMA | <pre><code class="ruby"> |
35 | 1 | S.H. (GAMELINKS) | 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 | 3 | Toshi MARUYAMA | </code> |
63 | 1 | S.H. (GAMELINKS) | </pre> |
64 | |||
65 | And add this block |
||
66 | |||
67 | 3 | Toshi MARUYAMA | <pre><code class="ruby"> |
68 | 1 | S.H. (GAMELINKS) | group :production do |
69 | gem 'pg', '~> 0.20' |
||
70 | end |
||
71 | 3 | Toshi MARUYAMA | </code></pre> |
72 | 1 | S.H. (GAMELINKS) | |
73 | install the gem's to bundle install |
||
74 | |||
75 | <pre> |
||
76 | bundle install |
||
77 | </pre> |
||
78 | |||
79 | get secret token with this command |
||
80 | |||
81 | <pre> |
||
82 | rake generate_secret_token |
||
83 | </pre> |
||
84 | |||
85 | In config/enviroment.rb edit to "exit 1" (remove or comment) |
||
86 | |||
87 | <pre> |
||
88 | exit 1 |
||
89 | </pre> |
||
90 | |||
91 | In config/application.rb add to this line |
||
92 | |||
93 | <pre> |
||
94 | config.assets.initialize_on_precompile = false |
||
95 | </pre> |
||
96 | |||
97 | Create to Heroku App |
||
98 | |||
99 | <pre> |
||
100 | heroku apps:create -a APP_NAME |
||
101 | </pre> |
||
102 | |||
103 | Add, postgreaql addon's |
||
104 | |||
105 | <pre> |
||
106 | heroku addons:create heroku-postgresql |
||
107 | </pre> |
||
108 | |||
109 | Link to remote (heroku) |
||
110 | |||
111 | <pre> |
||
112 | heroku git:remote -a APP_NAME |
||
113 | </pre> |
||
114 | |||
115 | Deploy to Heroku these command |
||
116 | |||
117 | <pre> |
||
118 | git add -A |
||
119 | git commit -m “Redmine for Heroku deployment” |
||
120 | git push heroku 3.4-stable:master |
||
121 | </pre> |
||
122 | |||
123 | Finally, migrate & loding default data |
||
124 | |||
125 | <pre> |
||
126 | heroku run rake db:migrate |
||
127 | heroku run rake redmine:load_default_data |
||
128 | </pre> |