HowTo Install Redmine (> 25x) on Heroku » History » Version 1
Sandro Kolly, 2014-05-05 10:54
1 | 1 | Sandro Kolly | h1. HowTo Install Redmine (> 2.5.x) on Heroku |
---|---|---|---|
2 | |||
3 | Ok, after months of try-and-fail I was finally able to do it. |
||
4 | As it's my first Rails application i had no idea of how to do it, so I looked for different tutorials. Finally here my own: |
||
5 | |||
6 | It's a mix between these two: |
||
7 | * http://railsguides.net/2012/04/28/how-to-deploy-redmine-to-heroku/ |
||
8 | * http://tygertown.us/redmine-on-heroku/ |
||
9 | |||
10 | h2. Install Redmine |
||
11 | |||
12 | First i got the newest stable version of Redmine (2.5 at this time) |
||
13 | <pre> |
||
14 | git clone https://github.com/redmine/redmine.git -b 2.5-stable |
||
15 | </pre> |
||
16 | |||
17 | *Edit:* Navigate into your project with your terminal: |
||
18 | <pre> |
||
19 | cd redmine |
||
20 | </pre> |
||
21 | |||
22 | Then as everywhere, we have to remove those files from _.gitignore_ |
||
23 | <pre> |
||
24 | Gemfile.lock |
||
25 | Gemfile.local |
||
26 | public/plugin_assets |
||
27 | config/initializers/session_store.rb |
||
28 | config/initializers/secret_token.rb |
||
29 | config/configuration.yml |
||
30 | config/email.yml |
||
31 | </pre> |
||
32 | |||
33 | As I always had problems with the database, I just removed this whole block from the _Gemfile_ |
||
34 | <pre><code class="ruby"> |
||
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 | |||
39 | ... |
||
40 | |||
41 | else |
||
42 | warn("No adapter found in config/database.yml, please configure it first") |
||
43 | end |
||
44 | else |
||
45 | warn("Please configure your config/database.yml first") |
||
46 | end |
||
47 | </code></pre> |
||
48 | |||
49 | and added instead just this to the _Gemfile_ |
||
50 | <pre><code class="ruby"> |
||
51 | group :production do |
||
52 | # gems specifically for Heroku go here |
||
53 | gem "pg", ">= 0.11.0" |
||
54 | end |
||
55 | </code></pre> |
||
56 | |||
57 | Then finally install the gems. Don't get confused by log messages like "Please configure your config/database.yml first", heroku will do that for you |
||
58 | <pre> |
||
59 | bundle install |
||
60 | </pre> |
||
61 | |||
62 | Now get the secret token with |
||
63 | <pre> |
||
64 | bundle exec rake generate_secret_token |
||
65 | </pre> |
||
66 | |||
67 | Next, you create a app at heroku (we're supposing you are already registered at heroku and all that it brings with it) |
||
68 | <pre> |
||
69 | heroku create NAME_FOR_YOUR_APP |
||
70 | </pre> |
||
71 | |||
72 | To avoid aborting when deploying to heroku, we have to do the following two steps: |
||
73 | * In _config/environment.rb_ we have to remove (or comment) line 10, where it says |
||
74 | <pre><code class="ruby"> |
||
75 | exit 1 |
||
76 | </code></pre> |
||
77 | |||
78 | * In _config/application.rb_ we have to add an additional line between line 13 and line 14 and add this: _config.assets.initialize_on_precompile = false_ and it should look like this |
||
79 | <pre><code class="ruby"> |
||
80 | ... |
||
81 | 12: module RedmineApp |
||
82 | 13: class Application < Rails::Application |
||
83 | 14: config.assets.initialize_on_precompile = false |
||
84 | 15: # Settings in config/environments/* take precedence over those specified here. |
||
85 | ... |
||
86 | </code></pre> |
||
87 | |||
88 | Now we are finally ready to commit our changes |
||
89 | <pre> |
||
90 | git add -A |
||
91 | git commit -m “preparing for heroku” |
||
92 | git push heroku 2.5-stable:master |
||
93 | </pre> |
||
94 | |||
95 | Now just get the database ready and chose the default language, when you are asked |
||
96 | <pre> |
||
97 | heroku run rake db:migrate |
||
98 | heroku run rake redmine:load_default_data |
||
99 | </pre> |
||
100 | |||
101 | There you go, open your redmine and log in with your credentials |
||
102 | <pre> |
||
103 | heroku open |
||
104 | </pre> |
||
105 | Your username is *admin* and your password is *admin* as well. |
||
106 | |||
107 | h2. Configure E-Mail |
||
108 | |||
109 | First you have to add the *Sendgrid* add-on to heroku |
||
110 | <pre> |
||
111 | heroku addons:add sendgrid:starter |
||
112 | </pre> |
||
113 | This is just a free-200-mails-per-day version (-> see "Add-On-Description":https://addons.heroku.com/sendgrid ) |
||
114 | |||
115 | Then you do create the following file for the email configurations: _config/configuration.yml_ |
||
116 | In this file you only have the following content (adjust Username and Password to yours, you can find them at the add-on page when accessing through your heroku app) |
||
117 | <pre><code class="ruby"> |
||
118 | production: |
||
119 | delivery_method: :smtp |
||
120 | smtp_settings: |
||
121 | address: "smtp.sendgrid.net" |
||
122 | port: 25 |
||
123 | authentication: :plain |
||
124 | domain: "heroku.com" |
||
125 | user_name: "SENDGRID_USERNAME" |
||
126 | password: "SENDGRID_PASSWORD" |
||
127 | </code></pre> |
||
128 | |||
129 | Once again, commit and push your changes |
||
130 | |||
131 | <pre> |
||
132 | git add -A |
||
133 | git commit -m “adding email configurations” |
||
134 | git push heroku 2.5-stable:master |
||
135 | </pre> |
||
136 | |||
137 | There you go, enjoy! |
||
138 | |||
139 | I know this is not the cleanest way at some steps, but it works and I hope to help others as well ;) |