mindtouch deki wiki のバージョンアップメモ
1.8.? から 1.9.0b にアップしました。

変更点盛り沢山で、そのまま設定したんじゃあ動かない。

結構てこずった

参考(でも情報足らず)のページ

バックアップ

実は自分は元の deki-hayes
を丸ごとコピーしてのけておいたので、バックアップファイルは抜けがあるかもしれません。
どのファイル作るのにどのファイルを元にしたやら…

まず添付ファイルや添付画像のバックアップ

mkdir ~/deki_backup
cd /var/www/deki-hayes/
tar cvzpf ~/deki_backup/attachments.tar.gz attachments

設定のバックアップ

cp LocalSettings.php AdminSettings.php ~/deki_backup
cp ./bin/mindtouch.host.sh ~/deki_backup
cp ./config/mindtouch.deki.startup.xml ~/deki_backup

もし、Windows
で操作しているのであれば次のファイルをバックアップ

cp mindtouch.host.bat ~/deki_backup

MySQL のデータをバックアップ

mysqldump -u<user> -p<pass> <dbname> > ~/deki_backup/wikidb.sql

他のホストで DB を動かしているのであれば

mysqldump -h <remote host> -u<user> -p<pass> <dbname> > ~/deki_backup/wikidb.sql

新しいパッケージのインストール

1.9.0a からは Redhat や Debian でパッケージ化されているようです。(upgradeには未対応なので注意)
パッケージを利用する場合は、それらの手順に従ってください。
ここでは、ソースを入手して展開する方法を説明します。

ソースの入手

ソース入手先はこちら

圧縮ファイルを適当なディレクトリで伸張します。

cd ~
tar zxvf Deki_Wiki_1.9.0_Itasca_source.tar.gz
cd Deki_Wiki_1.9.0_Itasca_source

webフォルダを Apache のディレクトリにコピーします。(Fedora では /var/www)

mkdir -p /var/www/dekiwiki
cp -r web/* /var/www/dekiwiki/.
chown -r apache:apache /var/www/dekiwiki

設定

ハマったのがこの設定。
CP の Dekiwiki では、Apache で 8081 ポート、Dekiエンジンに 8082 ポートを使用しています。標準の設定では Apache で 80 ポート、Dekiエンジンで 8081 ポートの使用となっているので、そのあたりの変更方法も参考にしてください。
バージョンアップ方法を説明したページでは足りないファイルがあったり、新規インストールでは上書きされたりするので、各所の情報を統合した結果必要なファイルは以下のとおり。

/etc/httpd (Apache コンフィグ)
/var/www/dekiwiki (インストールディレクトリ)
/etc (システム・service関係)

Apache 設定

基本的にヴァージョンアップであれば設定できていると思われますが、mod_redirect、mod_proxy を ON にします。
Redirect のルールが変更になっています。
~/Deki_Wiki_1.9.0b_Itasca_source/config/deki-apache.conf を編集します。
変更した箇所を赤字、以前のバージョンから変更になっている箇所を緑字で表わしています。

<VirtualHost *:8081>
	ServerName dekiwiki

	ErrorLog /var/log/apache2/error.log
	CustomLog /var/log/apache2/access.log common

	DocumentRoot "/var/www/dekiwiki"

	RewriteEngine On
	RewriteCond %{REQUEST_URI} ^/$
	RewriteRule ^/$ /index.php?title= [L,NE]

	RewriteCond %{REQUEST_URI} ^/@gui/[^.]+$
	RewriteRule ^/@gui/(.*)$ /proxy.php?path=$1 [L,QSA,NE] 

	RewriteCond %{REQUEST_URI} !^/(@api|editor|skins|config|@gui)/
	RewriteCond %{REQUEST_URI} !^/index\.php
	RewriteCond %{REQUEST_URI} !^/favicon\.ico$
	RewriteCond %{REQUEST_URI} !^/robots\.txt$
	RewriteCond %{QUERY_STRING} ^$ [OR] %{REQUEST_URI} ^/Special:Search
	RewriteRule ^/(.*)$ /index.php?title=$1 [L,QSA,NE]

	# deki-api uses encoded slashes in query parameters so AllowEncodedSlashes must be On
	AllowEncodedSlashes On   

	# mod_proxy rules
	ProxyPass /@api http://localhost:8082 retry=1
	ProxyPassReverse /@api http://localhost:8082
	SetEnv force-proxy-request-1.0 1
	SetEnv proxy-nokeepalive 1

</VirtualHost>

Dekiwiki設定

バックアップしておいた ~/deki_back/LocalSettings.php、~/deki_back/AdminSettings.php を使います。

cp ~/deki_back/LocalSettings.php ~/deki_back/AdminSettings.php /var/www/dekiwiki/.

LocalSettings.php です。
必須設定項目として、新たに $wgDreamServer を追加する必要があります。
これを追加しないと、Apache -> Dekiエンジンのリダイレクトが動きません。

<?php
# This file was automatically generated by the Deki Wiki installer.
# If you make manual changes, please keep track in case you need to
# recreate them later.
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.

$IP = "/var/www/dekiwiki";

ini_set( "include_path", ".:/var/www/dekiwiki:/var/www/dekiwiki/includes:/var/www/dekiwiki/languages" );
require_once( "includes/DefaultSettings.php" );

$wgSitename         = "Deki Wiki";

$wgEmergencyContact = "wwwadmin@example.com";
$wgPasswordSender = "wwwadmin@example.com";

$wgDBserver         = "mysql.server";
$wgDBname           = "dbname";
$wgDBuser           = "user";
$wgDBpassword       = "password";

$wgDreamServer	= "http://localhost:8082";
$wgDekiApiKey		= "32chars string";

?>

起動スクリプト

起動スクリプト関連も変わっているので注意が必要です。
まずは /etc/init.d/dekiwiki スクリプト。
以前は dekihost と言う名前の起動スクリプトだったのですが、dekiwiki と言う名前で作り変えられています。ソースの config フォルダに新しいファイルがあるので、コピーします。

cp ~/Deki_Wiki_1.9.0b_Itasca_source/config/dekiwiki-init.redhat /etc/init.d/dekiwiki

service 関連の設定を変更します。

chkconfig --del dekihost
chkconfig -add dekiwiki

/etc/dekiwiki/mindtouch.host.conf
このファイルは新規に追加されたファイルで、どこにも説明がないよう(新規インストールしたら作られる?)なので以下をコピペして編集してください。
BIN_DIR, APIKEY, HTTP_PORT のあたりを変更します。

# MindTouch Deki Wiki host configuration file

# The full path to your mono executable
MONO="/usr/bin/mono"

# The location of your wiki's bin directory
BIN_DIR="/var/www/dekiwiki/bin"

# The ApiKey for the dream host
APIKEY="32chars string"

PATH_PREFIX="@api"

# Port the API listens on
HTTP_PORT="8082"

# hostname to listen on
IP="localhost"

# location of the mindtouch.host.exe assembly
HOST_EXE="$BIN_DIR/mindtouch.host.exe"

# path to the Deki Wiki configuration xml file
SCRIPT="/etc/dekiwiki/mindtouch.deki.startup.xml"

# don't require a tty (non-interactive mode)
NOTTY="notty"

# The numbe of threads to reserve for internal use
CONNECT_LIMIT="-5" 

# directory to store dekiwiki log files
LOGDIR="/var/log/dekiwiki"

# location of the dekiwiki API log file
LOGFILE="$LOGDIR/deki-api.log"

/etc/dekiwiki/mindtouch.deki.startup.xml は、mono アプリの設定ファイルです。
マルチwiki対応したっぽいので、このファイルも config section が階層化されているなどの変更があります。
バックアップしておいた ~/deki_back/mindtouch.deki.startup.xml を見ながら、新しいファイルの雛形を編集します。

cp /var/www/dekiwiki/config/mindtouch.deki.startup.xml.in /etc/dekiwiki/mindtouch.deki.startup.xml

%API-KEY% のように書かれている箇所を全部書き換えます。エディタの置換機能を使うなどして置き換えしてください。
(ご参考)

<script>
  <!-- register Deki services -->
  <action verb="POST" path="/host/load?name=mindtouch.deki" />
  <action verb="POST" path="/host/load?name=mindtouch.deki.services" />
  <action verb="POST" path="/host/load?name=mindtouch.indexservice" /> 

  <!-- start Deki services -->
  <action verb="POST" path="/host/services">
    <config>

      <!-- Service startup -->
      <!-- deki: relative path for deki-api service. I.e., http://host/deki -->
      <!-- sid: the serviceid points to a class that represents the service for startup-->
      <path>deki</path>
      <sid>http://services.mindtouch.com/deki/draft/2006/11/dekiwiki</sid>

      <!-- Global settings -->
      <!-- deki-path: full path to dekiwiki php (pointed to by web server) -->
      <!-- apikey: apikey used to access privileged features of deki-api -->
      <!-- imagemagick-ignore-list: comma separated list of file extensions to bypass image preview -->
      <!-- imagemagick-convert-path: full path to imagemagick convert (used to generate image previews) -->
      <!-- imagemagick-identify-path: full path to imagemagick identify (used to determine image dimensions) -->
      <!-- deki-resources-path: path to deki-wiki resources directory containing txt files with localized strings.
              Resource files are searched in the order "resources.custom.txt" -> "resources-[language]-[culture].txt" -> "resources-[language].txt" -> "resources.txt"
              where [language] and [culture] are standard two letter abbreviations such as en-us -->
      <!-- dblogging-conn-string: DB connection string for detailed logging of deki-api requests/responses. Comment out to disable this logging -->
      <deki-path>/var/www/dekiwiki</deki-path>

      <!-- Global apikey valid for all wiki instances -->
      <apikey>32chars string</apikey>

      <imagemagick-ignore-list>ico</imagemagick-ignore-list>
      <imagemagick-convert-path>/usr/bin/convert</imagemagick-convert-path>
      <imagemagick-identify-path>/usr/bin/identify</imagemagick-identify-path>
      <html2ps-path></html2ps-path>
      <ps2pdf-path>/usr/bin/ps2pdf</ps2pdf-path>
      <!-- <deki-resources-path>/var/www/mks-wiki/resources</deki-resources-path> -->

      <wikis>

        <globalconfig>
          <!-- optional overrides for all instances -->
        </globalconfig>

        <config id="default">
          <!-- Per instance settings -->
          <!-- host: hostname for the wiki. Use * for all hosts. Multiple <host> entries may be used per site.-->
          <!-- db-server: hostname/ip of database for this instance-->

          <!-- db-port: db port (default 3306 for mysql)-->
          <!-- db-catalog: catalog or database name for this instance -->
          <!-- db-user: db account to use. Ensure full access to the catalog and rights to exec stored procs.-->
          <!-- db-password: password for db account-->
          <!-- db-options: other connection string settings. Ensure db connection pooling is enabled and that the connection supports utf8 encoding-->

          <host>*</host>

          <db-server>localhost</db-server>
          <db-port>3306</db-port>
          <db-catalog></db-catalog>
          <db-user></db-user>
          <db-password hidden="true"></db-password>
          <db-options>pooling=true; Connection Timeout=5; Connection Lifetime=30; Protocol=socket; Min Pool Size=2; Max Pool Size=50; Connection Reset=false;character set=utf8;ProcedureCacheSize=25;Use Procedure Bodies=true;</db-options>

        </config>

      </wikis>

      <!-- filter-path: file extension and the location of an executable to convert that file extension to plain text.  -->
      <!--              Note: the executable MUST read from stdin and write to stdout -->

      <indexer>
        <path.store>/usr/local/var/luceneindex</path.store>
        <filter-path extension="doc">/var/www/dekiwiki/bin/filters/wvText</filter-path>
        <filter-path extension="pdf">/var/www/dekiwiki/bin/filters/pdf2text</filter-path>
        <filter-path extension="xhtml">/var/www/dekiwiki/filters/html2text</filter-path>
        <filter-path extension="html">/var/www/dekiwiki/bin/filters/html2text</filter-path>
        <filter-path extension="htm">/var/www/dekiwiki/bin/filters/html2text</filter-path>
        <filter-path extension="docx">/var/www/dekiwiki/bin/filters/docx2txt</filter-path>
        <filter-path extension="odt">/var/www/dekiwiki/bin/filters/odt2txt</filter-path>
        <filter-path extension="odp">/var/www/dekiwiki/bin/filters/odp2txt</filter-path>
        <filter-path extension="ppt">/var/www/dekiwiki/bin/filters/ppt2txt</filter-path>
        <filter-path extension="pptx">/var/www/dekiwiki/bin/filters/pptx2txt</filter-path>
        <filter-path extension="xls">/var/www/dekiwiki/bin/filters/xls2txt</filter-path>
        <filter-path extension="pl"></filter-path>
        <filter-path extension="c"></filter-path>
        <filter-path extension="h"></filter-path>
        <filter-path extension="inc"></filter-path>
        <filter-path extension="php"></filter-path>
        <filter-path extension="cs"></filter-path>
        <filter-path extension="txt"></filter-path>
        <filter-path extension="csv"></filter-path>
        <filter-path extension="xml"></filter-path>
        <filter-path extension="xsl"></filter-path>
        <filter-path extension="xslt"></filter-path>
      </indexer>

      </config>
  </action>
</script>

サービスの起動

ここまで設定が終了すれば、サービスを起動してみて動作を確認します。

/etc/init.d/dekiwiki start

もし、うまくいかないようであれば Installation FAQ の Debugging Pathway がデバッグの参考になるでしょう。

Posted by suisui, filed under OSS. Date: 5月 7, 2008, 2:05 pm | No Comments »

Leave a Comment

Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.