操作
如何在 Heroku 上安装 Redmine (3.x.x)¶
参考以下文章- 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
首先,git 克隆至 Redmine 稳定源代码
git clone https://github.com/redmine/redmine.git -b 3.4-stable
并移动至 Redmine 项目目录
cd redmine
编辑 .gitignroe 文件,并移除以下行
Gemfile.lock Gemfile.local public/plugin_assets config/initializers/session_store.rb config/initializers/secret_token.rb config/configuration.yml config/email.yml
编辑 Gemfile,移除或注释此块
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
并添加此块
group :production do
gem 'pg', '~> 0.20'
end
安装 Gem,捆绑安装
bundle install
使用此命令获取密钥令牌
rake generate_secret_token
在 config/environment.rb 中编辑为“exit 1”(移除或注释)
exit 1
在 config/application.rb 中添加到此行
config.assets.initialize_on_precompile = false
创建 Heroku 应用程序
heroku apps:create -a APP_NAME
添加 Postgreaql 外接程序
heroku addons:create heroku-postgresql
链接至远程(heroku)
heroku git:remote -a APP_NAME
使用以下命令部署至 Heroku
git add -A git commit -m “Redmine for Heroku deployment” git push heroku 3.4-stable:master
最后,迁移并加载默认数据
heroku run rake db:migrate heroku run rake redmine:load_default_data
6 年多以前由 Toshi MARUYAMA 更新于 2018-01-18 · 3 次修订