努力したWiki

推敲の足りないメモ書き多数

ユーザ用ツール

サイト用ツール


Action disabled: media
documents:other:other-013

Redmine 0.8.4.stableから 0.9.3へのアップグレード

2010年03月14日 04時39分58秒

これはなに?

Redmine 0.8.4.stableから0.9.3へアップグレードする手順のメモ。正確性の保証は無い。

railsのアップグレード

まずは railsのアップグレード。

redmine# gem update rails
Updating installed gems
Updating rails
Successfully installed activesupport-2.3.5
Successfully installed activerecord-2.3.5
Successfully installed rack-1.0.1
Successfully installed actionpack-2.3.5
Successfully installed actionmailer-2.3.5
Successfully installed activeresource-2.3.5
Successfully installed rails-2.3.5
Gems updated: activesupport, activerecord, rack, actionpack, actionmailer, activeresource, rails
Installing ri documentation for activesupport-2.3.5...
Installing ri documentation for activerecord-2.3.5...
Installing ri documentation for rack-1.0.1...
Installing ri documentation for actionpack-2.3.5...
Installing ri documentation for actionmailer-2.3.5...
Installing ri documentation for activeresource-2.3.5...
Installing ri documentation for rails-2.3.5...
Installing RDoc documentation for activesupport-2.3.5...
Installing RDoc documentation for activerecord-2.3.5...
Installing RDoc documentation for rack-1.0.1...
Installing RDoc documentation for actionpack-2.3.5...
Installing RDoc documentation for actionmailer-2.3.5...
Installing RDoc documentation for activeresource-2.3.5...
Installing RDoc documentation for rails-2.3.5...
redmine#

多分成功。

redmine 0.9.3 を取得

http://rubyforge.org/frs/?group_id=1850 からどうぞ。

redmine# fetch http://rubyforge.org/frs/download.php/69449/redmine-0.9.3.tar.gz
redmine-0.9.3.tar.gz                          100% of 4480 kB  166 kBps 00m00s
redmine# tar xvfz redmine-0.9.3.tar.gz
  -- 中略 --
x redmine-0.9.3/test/functional/projects_controller_test.rb
x redmine-0.9.3/test/functional/issues_controller_test.rb
x redmine-0.9.3/test/functional/users_controller_test.rb
x redmine-0.9.3/test/functional/sys_controller_test.rb
redmine# ll
total 4518
drwxr-xr-x  11 radiant  custom      512  8  9  2009 radiant
drwxr-xr-x   9 redmine  custom      512  6 23  2009 redmine
drwxr-xr-x  15 1000     1000        512  2 28 19:28 redmine-0.9.3
-rw-r--r--   1 root     wheel   4587740  2 28 19:32 redmine-0.9.3.tar.gz
redmine#

アップグレード作業

http://redmine.jp/guide/RedmineUpgrade を読んでアップグレードしませう。

config/database.yml 設定

データベースへの接続定義。

redmine# diff -c redmine/config/database.yml redmine-0.9.3/config/database.yml.example
*** redmine/config/database.yml 2009-06-07 14:51:25.000000000 +0900
--- redmine-0.9.3/config/database.yml.example   2010-02-28 19:28:08.000000000 +0900
***************
*** 6,25 ****
  # And be sure to use new-style password hashing:
  #   http://dev.mysql.com/doc/refman/5.0/en/old-client.html

- #production:
- #  adapter: mysql
- #  database: redmine
- #  host: localhost
- #  username: root
- #  password:
- #  encoding: utf8
-
  production:
!   adapter: xxxxx
!   database: xxxxx
!   host: xxx.xxx.xxx.xxx
!   username: xxx
!   password: "xxx"
    encoding: utf8

  development:
--- 6,17 ----
  # And be sure to use new-style password hashing:
  #   http://dev.mysql.com/doc/refman/5.0/en/old-client.html

  production:
!   adapter: mysql
!   database: redmine
!   host: localhost
!   username: root
!   password:
    encoding: utf8

  development:
***************
*** 47,55 ****

  test_sqlite3:
    adapter: sqlite3
!   dbfile: db/test.db
!
! demo:
!   adapter: sqlite3
!   dbfile: db/demo.db
!
--- 39,42 ----

  test_sqlite3:
    adapter: sqlite3
!   database: db/test.db
redmine# cp redmine/config/database.yml redmine-0.9.3/config/
redmine#

差分的にまるっとコピーでよいかなこれなら。

config/email.yml の設定

メール配信の設定。

redmine# diff -c redmine/config/email.yml redmine-0.9.3/config/email.yml.example
*** redmine/config/email.yml    2009-06-07 14:54:55.000000000 +0900
--- redmine-0.9.3/config/email.yml.example      2010-02-28 19:28:08.000000000 +0900
***************
*** 1,14 ****
! # Outgoing email settings

  production:
    delivery_method: :smtp
    smtp_settings:
!     address: xxxx.xxxx.xxxx
!     port: xxx
!     domain: xxxxx.xxxx.xxxx.xx
      authentication: :login
!     user_name: xxxxxxxx
!     password: xxxxxxxx

  development:
    delivery_method: :smtp
--- 1,80 ----
! # = Outgoing email settings
! #
! # Each environment has it's own configuration options.  If you are only
! # running in production, only the production block needs to be configured.
! #
! # == Common configurations
! #
! # === Sendmail command
! #
! # production:
! #   delivery_method: :sendmail
! #
! # === Simple SMTP server at localhost
! #
! # production:
! #   delivery_method: :smtp
! #   smtp_settings:
! #     address: "localhost"
! #     port: 25
! #
! # === SMTP server at example.com using LOGIN authentication and checking HELO for foo.com
! #
! # production:
! #   delivery_method: :smtp
! #   smtp_settings:
! #     address: "example.com"
! #     port: 25
! #     authentication: :login
! #     domain: 'foo.com'
! #     user_name: 'myaccount'
! #     password: 'password'
! #
! # === SMTP server at example.com using PLAIN authentication
! #
! # production:
! #   delivery_method: :smtp
! #   smtp_settings:
! #     address: "example.com"
! #     port: 25
! #     authentication: :plain
! #     domain: 'example.com'
! #     user_name: 'myaccount'
! #     password: 'password'
! #
! # === SMTP server at using TLS (GMail)
! #
! # This requires some additional configuration.  See the article at:
! # http://redmineblog.com/articles/setup-redmine-to-send-email-using-gmail/
! #
! # production:
! #   delivery_method: :smtp
! #   smtp_settings:
! #     tls: true
! #     address: "smtp.gmail.com"
! #     port: 587
! #     domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps
! #     authentication: :plain
! #     user_name: "your_email@gmail.com"
! #     password: "your_password"
! #
! #
! # == More configuration options
! #
! # See the "Configuration options" at the following website for a list of the
! # full options allowed:
! #
! # http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer

  production:
    delivery_method: :smtp
    smtp_settings:
!     address: smtp.example.net
!     port: 25
!     domain: example.net
      authentication: :login
!     user_name: "redmine@example.net"
!     password: "redmine"

  development:
    delivery_method: :smtp
***************
*** 17,21 ****
      port: 25
      domain: example.net
      authentication: :login
!     user_name: redmine@example.net
!     password: redmine
--- 83,87 ----
      port: 25
      domain: example.net
      authentication: :login
!     user_name: "redmine@example.net"
!     password: "redmine"
redmine#
redmine# cp redmine-0.9.3/config/email.yml.example redmine-0.9.3/config/email.yml
redmine# vi redmine-0.9.3/config/email.yml

こっちはコピーして書き直しした方がよさげだ。
そうそう、http://blog.redmine.jp/articles/redmine-0_9-async-smtp/ な話があるので興味があればそちらの設定でもいいかもしれない。

マイグレーション rake db:migrate RAILS_ENV="production"

redmine# mv redmine redmine.old
redmine# mv redmine-0.9.3 redmine
redmine# cd redmine
redmine# rake db:migrate RAILS_ENV="production"
(in /usr/home/redmine/redmine)
rake aborted!
A key is required to write a cookie containing the session data. Use config.action_controller.session = { :key => "_myapp_session", :secret => "some secret phrase" } in config/environment.rb

(See full trace by running task with --trace)
redmine#

きたきた。エラーでございます。
じつはこれ、解決の仕方がちゃんと記載されています。
http://redmine.jp/tech_note/install/ の セッション暗号化用鍵の生成 がそれ。

redmine# rake config/initializers/session_store.rb
(in /usr/home/redmine/redmine)
redmine# 

これが出来たらもう一度。

redmine# rake db:migrate RAILS_ENV="production"
(in /usr/home/redmine/redmine)

   -- 中略 --

==  AddIndexesToIssueStatus: migrating ========================================
-- add_index(:issue_statuses, :position)
   -> 0.0023s
-- add_index(:issue_statuses, :is_closed)
   -> 0.0021s
-- add_index(:issue_statuses, :is_default)
   -> 0.0018s
==  AddIndexesToIssueStatus: migrated (0.0065s) ===============================

==  RemoveEnumerationsOpt: migrating ==========================================
-- remove_column(:enumerations, :opt)
   -> 0.0010s
==  RemoveEnumerationsOpt: migrated (0.0012s) =================================

==  ChangeWikiContentsTextLimit: migrating ====================================
==  ChangeWikiContentsTextLimit: migrated (0.0000s) ===========================

==  AddIndexOnChangesetsScmid: migrating ======================================
-- add_index(:changesets, [:repository_id, :scmid], {:name=>:changesets_repos_scmid})
   -> 0.0024s
==  AddIndexOnChangesetsScmid: migrated (0.0025s) =============================

redmine# 

無事終了。

添付ファイル群のコピー

redmine# cp -R redmine.old/files/ redmine/files/
redmine#

passenger更新とhttpd.conf書き換え

早速アクセスしてみると…あれ動いていねぇ。そういやpassenger 使ってたっけかな。

redmine# gem install passenger
Building native extensions.  This could take a while...
Successfully installed passenger-2.2.11
1 gem installed
Installing ri documentation for passenger-2.2.11...
Installing RDoc documentation for passenger-2.2.11...
redmine#
redmine# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v2.2.11.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.

--------------------------------------------

Checking for required software...

 * GNU C++ compiler... found at /usr/bin/g++
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 * RubyGems... found
 * Rake... found at /usr/local/bin/rake
 * rack... found
 * Apache 2... found at /usr/local/sbin/httpd
 * Apache 2 development headers... found at /usr/local/sbin/apxs
 * Apache Portable Runtime (APR) development headers... found at /usr/local/bin/apr-1-config
 * Apache Portable Runtime Utility (APU) development headers... found at /usr/local/bin/apu-1-config

--------------------------------------------
Compiling and installing Apache 2 module...
cd /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11
/usr/local/bin/ruby18 -S /usr/local/bin/rake clean apache2
# /usr/local/bin/ruby18 -S /usr/local/bin/rake clean apache2
(in /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11)
rm -rf ext/apache2/libboost_oxt.a ext/apache2/libboost_oxt
rm -rf ext/apache2/libpassenger_common.a ext/apache2/ApplicationPoolServerExecutable ext/apache2/libpassenger_common
rm -rf ext/apache2/Configuration.o ext/apache2/Bucket.o ext/apache2/Hooks.o ext/apache2/mod_passenger.o ext/apache2/mod_passenger.so
rm -rf ext/nginx/libboost_oxt.a ext/nginx/libboost_oxt
rm -rf ext/nginx/libpassenger_common.a ext/nginx/libpassenger_common
rm -rf ext/nginx/HelperServer
rm -rf test/libboost_oxt.a test/libboost_oxt
rm -rf test/libpassenger_common.a test/ApplicationPoolServerExecutable test/libpassenger_common
rm -rf test/oxt/oxt_test_main test/oxt/*.o test/CxxTests test/*.o
rm -r pkg
cd ext/phusion_passenger && make clean
rm -f ext/phusion_passenger/Makefile
mkdir -p ext/apache2/libpassenger_common
g++ -Iext -Iext/common -fPIC -I/usr/local/include/apr-1 -I/usr/local/include/apr-1 -I/usr/local/include -pipe -I/usr/include -DLDAP_DEPRECATED -fno-strict-aliasing -I/usr/local/include/apache22 -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/apache2/libpassenger_common/Utils.o -c ext/common/Utils.cpp
g++ -Iext -Iext/common -fPIC -I/usr/local/include/apr-1 -I/usr/local/include/apr-1 -I/usr/local/include -pipe -I/usr/include -DLDAP_DEPRECATED -fno-strict-aliasing -I/usr/local/include/apache22 -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/apache2/libpassenger_common/Logging.o -c ext/common/Logging.cpp
g++ -Iext -Iext/common -fPIC -I/usr/local/include/apr-1 -I/usr/local/include/apr-1 -I/usr/local/include -pipe -I/usr/include -DLDAP_DEPRECATED -fno-strict-aliasing -I/usr/local/include/apache22 -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/apache2/libpassenger_common/SystemTime.o -c ext/common/SystemTime.cpp

  -- 中略 --

cd ext/phusion_passenger && make
cc -I. -I/usr/local/lib/ruby/1.8/amd64-freebsd8 -I/usr/local/lib/ruby/1.8/amd64-freebsd8 -I.   -fPIC -O2 -pipe -fno-strict-aliasing  -fPIC  -c native_support.c
cc -shared -o native_support.so native_support.o -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L.  -rdynamic -Wl,-soname,native_support.so   -Wl,-R -Wl,/usr/local/lib -L/usr/local/lib -lruby18

--------------------------------------------
The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
   PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11
   PassengerRuby /usr/local/bin/ruby18

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!

Press ENTER to continue.


--------------------------------------------
Deploying a Ruby on Rails application: an example

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:

   <VirtualHost *:80>
      ServerName www.yourhost.com
      DocumentRoot /somewhere/public    # <-- be sure to point to 'public'!
      <Directory /somewhere/public>
         AllowOverride all              # <-- relax Apache security settings
         Options -MultiViews            # <-- MultiViews must be turned off
      </Directory>
   </VirtualHost>

And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

  /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
redmine#

httpd.conf 書き換えして apache 再起動して…動きました。

documents/other/other-013.txt · 最終更新: 2023/04/14 02:32 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki