HerokuにRedmineをデプロイしてみました。
作業記録です。
任意のディレクトリで
$ git clone git@github.com:redmine/redmine.git
$ cd redmine
$ cp config/database.yml.example config/database.yml
$ rm config/database.yml.example
.gitignore
/.project
/.loadpath
/.powrc
/.rvmrc
/config/additional_environment.rb
/config/database.yml
/config/secrets.yml
/coverage
/db/*.db
/db/*.sqlite3
/db/schema.rb
/files/*
/lib/redmine/scm/adapters/mercurial/redminehelper.pyc
/lib/redmine/scm/adapters/mercurial/redminehelper.pyo
/log/*.log*
/log/mongrel_debug
/plugins/*
!/plugins/README
/public/dispatch.*
/public/themes/*
!/public/themes/alternate
!/public/themes/classic
!/public/themes/README
/tmp/*
/tmp/cache/*
/tmp/pdf/*
/tmp/sessions/*
/tmp/sockets/*
/tmp/test/*
/tmp/thumbnails/*
/vendor/cache
*.rbc
/.bundle
gemifile
source 'https://rubygems.org'
if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.5.0')
abort "Redmine requires Bundler 1.5.0 or higher (you're using #{Bundler::VERSION}).\nPlease update with 'gem update bundler'."
end
gem "rails", "4.2.6"
gem "jquery-rails", "~> 3.1.4"
gem "coderay", "~> 1.1.1"
gem "builder", ">= 3.0.4"
gem "request_store", "1.0.5"
gem "mime-types", (RUBY_VERSION >= "2.0" ? "~> 3.0" : "~> 2.99")
gem "protected_attributes"
gem "actionpack-action_caching"
gem "actionpack-xml_parser"
gem "roadie-rails"
gem "mimemagic"
# Request at least nokogiri 1.6.7.2 because of security advisories
gem "nokogiri", ">= 1.6.7.2"
# Request at least rails-html-sanitizer 1.0.3 because of security advisories
gem "rails-html-sanitizer", ">= 1.0.3"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin, :jruby]
gem "rbpdf", "~> 1.19.0"
# Optional gem for LDAP authentication
group :ldap do
gem "net-ldap", "~> 0.12.0"
end
# Optional gem for OpenID authentication
group :openid do
gem "ruby-openid", "~> 2.3.0", :require => "openid"
gem "rack-openid"
end
platforms :mri, :mingw, :x64_mingw do
# Optional gem for exporting the gantt to a PNG file, not supported with jruby
group :rmagick do
gem "rmagick", ">= 2.14.0"
end
# Optional Markdown support, not for JRuby
group :markdown do
gem "redcarpet", "~> 3.3.2"
end
end
platforms :jruby do
# jruby-openssl is bundled with JRuby 1.7.0
gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0'
gem "activerecord-jdbc-adapter", "~> 1.3.2"
end
# Include database gems for the adapters found in the database
# configuration file
require 'erb'
require 'yaml'
group :production do
gem "pg", ">= 0.11.0", :platforms => [:mri, :mingw, :x64_mingw]
gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby
gem 'rails_12factor'
end
# 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.3.11", :platforms => [:mri, :mingw, :x64_mingw]
# gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
# when 'mysql'
# gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
# when /postgresql/
# gem "pg", "~> 0.18.1", :platforms => [:mri, :mingw, :x64_mingw]
# gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby
# when /sqlite3/
# gem "sqlite3", :platforms => [:mri, :mingw, :x64_mingw]
# gem "jdbc-sqlite3", ">= 3.8.10.1", :platforms => :jruby
# gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
# when /sqlserver/
# gem "tiny_tds", "~> 0.6.2", :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 :development do
gem "rdoc", ">= 2.4.2"
gem "yard"
end
group :test do
gem "minitest"
gem "rails-dom-testing"
gem "mocha"
gem "simplecov", "~> 0.9.1", :require => false
# For running UI tests
gem "capybara"
gem "selenium-webdriver"
end
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
if File.exists?(local_gemfile)
eval_gemfile local_gemfile
end
# Load plugins' Gemfiles
Dir.glob File.expand_path("../plugins/*/{Gemfile,PluginGemfile}", __FILE__) do |file|
eval_gemfile file
end
$ bundle install
config/database.yml
# Default setup is given for MySQL with ruby1.9.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).
# production:
# adapter: mysql2
# database: redmine
# host: localhost
# username: root
# password: ""
# encoding: utf8
development:
adapter: mysql2
database: redmine_development
host: localhost
username: root
password: ""
encoding: utf8
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
database: redmine_test
host: localhost
username: root
password: ""
encoding: utf8
# PostgreSQL configuration example
production:
adapter: postgresql
host: 127.0.0.1
database: redmine
# SQLite3 configuration example
#production:
# adapter: sqlite3
# database: db/redmine.sqlite3
# SQL Server configuration example
#production:
# adapter: sqlserver
# database: redmine
# host: localhost
# username: jenkins
# password: jenkins
config/application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
module RedmineApp
class Application < Rails::Application
config.assets.initialize_on_precompile = false
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W(#{config.root}/lib)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
config.active_record.store_full_sti_class = true
config.active_record.default_timezone = :local
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
I18n.enforce_available_locales = true
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable the asset pipeline
config.assets.enabled = false
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.action_mailer.perform_deliveries = false
# Do not include all helpers
config.action_controller.include_all_helpers = false
# Do not supress errors in after_rollback and after_commit callbacks
config.active_record.raise_in_transactional_callbacks = true
# XML parameter parser removed from core in Rails 4.0
# and extracted to actionpack-xml_parser gem
config.middleware.insert_after ActionDispatch::ParamsParser, ActionDispatch::XmlParamsParser
# Sets the Content-Length header on responses with fixed-length bodies
config.middleware.use Rack::ContentLength
# Verify validity of user sessions
config.redmine_verify_sessions = true
# Specific cache for search results, the default file store cache is not
# a good option as it could grow fast. A memory store (32MB max) is used
# as the default. If you're running multiple server processes, it's
# recommended to switch to a shared cache store (eg. mem_cache_store).
# See http://guides.rubyonrails.org/caching_with_rails.html#cache-stores
# for more options (same options as config.cache_store).
config.redmine_search_cache_store = :memory_store
# Configure log level here so that additional environment file
# can change it (environments/ENV.rb would take precedence over it)
config.log_level = Rails.env.production? ? :info : :debug
config.session_store :cookie_store,
:key => '_redmine_session',
:path => config.relative_url_root || '/'
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
end
end
end
config/enviroments/production.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests.
config.cache_classes = true
config.assets.compile = true
# config.serve_static_assets = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable delivery errors
config.action_mailer.raise_delivery_errors = false
# No email in production log
config.action_mailer.logger = nil
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
end
$ heroku create
$ git add .
$ git commit -am 'herokuデプロイ設定'
$ git push heroku master
$ heroku addons:create heroku-postgresql
$ heroku run rake db:migrate
$ heroku run rake redmine:load_default_data # jaを入力
$ heroku open
ID admin
pass admin
で管理者でログインできる。
メール設定
gmail設定の場合
default:
# Outgoing emails configuration
# See the examples below and the Rails guide for more configuration options:
# http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
email_delivery:
delivery_method: :smtp
smtp_settings:
address: "smtp.gmail.com"
port: 587
authentication: :plain
domain: 'smtp.gmail.com'
user_name: '自分のgmailアドレス'
password: 'アプリパスワード'