LoginSignup
7
6

More than 5 years have passed since last update.

【Mac】開発環境にRedmineをインストールして動かす

Last updated at Posted at 2016-03-08

Redmineのプラグインを作りたいので、開発基盤としてのRedmineをローカルにインストール、セットアップを実施。GitHubミラーをfolkして利用しました。ちなみに、対象バージョンは3.0.0、Rubyは2.2.0です。

$ git clone https://github.com/yminowa/redmine redmine_dev
$ cd redmine_dev
$ git checkout -b 3.0-stable remotes/origin/3.0-stable
$ bundle install

database.ymlの設定をします。

cp database.yml.example database.yml
database.yml
...
development:
  adapter: mysql2
  database: redmine_development
  host: localhost
  username: root
  password: root
  encoding: utf8
...

その後DBの作成。

$ bundle exec rake db:create
$ bundle exec rake db:migrate

ここまでで起動しようとすると、以下のエラーが出ました。

$ bundle exec rails s
[2015-03-05 16:52:00] ERROR RuntimeError: Missing `secret_token` and `secret_key_base` for 'development' environment, set these values in `config/secrets.yml`
        /Users/yuichi/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/application.rb:520:in `validate_secret_key_config!'
        /Users/yuichi/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/application.rb:246:in `env_config'
        /Users/yuichi/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/engine.rb:514:in `call'
        /Users/yuichi/.rvm/gems/ruby-2.2.0/gems/railties-4.2.0/lib/rails/application.rb:164:in `call'
        /Users/yuichi/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/lock.rb:17:in `call'
        /Users/yuichi/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/content_length.rb:15:in `call'
        /Users/yuichi/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/handler/webrick.rb:89:in `service'
        /Users/yuichi/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
        /Users/yuichi/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
        /Users/yuichi/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'

どうやらRails4.1からの変更のようだ。開発環境なのでdisableにする方法もありそうだけど。とりあえずgenerateしてsecrets.ymlに記述する(本番運用のやつとかくれぐれも公開してはいけない)。

$ touch [RAILS_ROOT]/config/secrets.yml
$ bundle exec rake secret RAILS_ENV=development
83f2e8aad08ebb94e71d8b3d788391b34b6865773e68a6857e1c0c1eb9ff40f479977a9df4e37458d35ef1c003ed7d2ebb21c67cf38125ce1fcf2d976b58b604
secrets.yml
development:
  secret_key_base: 83f2e8aad08ebb94e71d8b3d788391b34b6865773e68a6857e1c0c1eb9ff40f479977a9df4e37458d35ef1c003ed7d2ebb21c67cf38125ce1fcf2d976b58b604

ここまでやって、

$ bundle exec rail s

で起動できました。ちなみに、初期のユーザはユーザ名、パスワードともにadminでログインできるようです。

Redmine.jpg

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6