2008-03-28
■ Windows XP SP2 に ActivePerl, Plagger, Fastladder (OpenFL), MySQL をインストールした

新しくノートPCを購入したので, 折角だからと頑張ってみたよ.
ActivePerl, Plagger
d:id:charsbar さんのPPMリポジトリ (http://ppm.tcool.org/) から Plagger 0.7.17 を入手するために, http://downloads.activestate.com/ActivePerl/Windows/5.8/ から ActivePerl 5.8.8.817 (ActivePerl-5.8.8.817-MSWin32-x86-257965.msi) をダウンロードしてインストール.
インストール後にPPMを起動し, 下記の通りプロンプトから入力.
ppm> rep add tcool http://ppm.tcool.org/server/ppmserver.cgi?urn:PPMServer Repositories: [1] ActiveState Package Repository [2] tcool ppm> rep off 1 Repositories: [1] tcool [ ] ActiveState Package Repository ppm> install Plagger (中略... 途中の質問にはすべてデフォルト回答.) Successfully installed Plagger version 0.7.17 in ActivePerl 5.8.8.817. ppm> quit
OpenFL
http://fastladder.org/ja/ から最新版 (私の場合, fastladder-0.0.2-win32.exe) をダウンロードしてインストール.
MySQL
http://dev.mysql.com/downloads/ から5.0 (私の場合, mysql-essential-5.0.51a-win32.msi) をダウンロードしてインストール.
インストール後の設定は, DBエンジンにInnoDBを, 文字コードにutf8を使用する部分だけ間違えなければ大丈夫だと思う.
OpenFLの設定
fastladder\config\database.yml.mysql を fastladder\config\database.yml にリネーム. 内容は下記のように.
production: adapter: mysql encoding: utf8 database: fastladder_production username: root password: ********** socket: /var/run/mysqld/mysqld.sock
データベースの作成
今回はプロンプトからやってみた. GUI Tools を使っても良さそう.
...\fastladder>mysqladmin -u root -p create fastladder_production Enter password: ********** ...\fastladder>
テーブルの作成
fastladder\migrate.bat を実行するだけでOKなんて楽だね...って, エラーが出て中断されたよ.
...\fastladder>migrate Creating database...don't close this window. Please run "start -> programs -> Fastladder -> Upgrade Database" if you have aborted. (中略...) == 2 CreateFeeds: migrating =================================================== -- create_table(:feeds) rake aborted! Mysql::Error: #42000BLOB/TEXT column 'description' can't have a default value: C REATE TABLE `feeds` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `feed link` varchar(255) NOT NULL, `link` varchar(255) NOT NULL, `title` text NOT NULL , `description` text DEFAULT '' NOT NULL, `subscribers_count` int(11) DEFAULT 0 NOT NULL, `image` varchar(255) DEFAULT NULL, `icon` varchar(255) DEFAULT NULL, ` modified_on` datetime DEFAULT NULL, `created_on` datetime NOT NULL, `updated_on` datetime NOT NULL) ENGINE=InnoDB (See full trace by running task with --trace) ...\fastladder>
「BLOB/TEXT型の列はデフォルト値を持てない」とのこと. fastladder-discuss-ja に同様の報告と対処法があったので, それを参考にファイル内容を書き換える.
fastladder\db\migrate\002_create_feeds.rb
上記エラーの原因を修正.
before:
t.text :description, :default => "", :null => false
after:
t.text :description, :null => false
fastladder\db\migrate\006_create_items.rb
こちらもそのままだと同様のエラーが出るようなので修正.
before:
t.text :title, :default => "", :null => false
after:
t.text :title, :null => false
修正後, 再び fastladder\migrate.bat を実行し, 無事終了.
OpenFLサーバの起動
...\fastladder>server ...\fastladder>ruby-win32\bin\ruby script\server -e production => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with production environment... ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. INT => stop (no restart). ** Mongrel 1.1.2 available at 0.0.0.0:3000 ** Use CTRL-C to stop.
プロンプトは放置プレイ.
OpenFLアカウントの作成
http://localhost:3000/ から. 作成したアカウントの member_id なるものは 1 になるらしい.
Store::Fastladderの入手
svn co http://svn.bulknews.net/repos/plagger/branches/fastladder-crawler/plagger/
Store::Fastladder 他を適切なディレクトリへ移動.
さらに依存モジュールをPPMからインストール (私の場合, DBIx::Class::Schema::Loader と DateTime::Format::MySQL がなくて怒られたので, 両者を ppm install した).
動作テスト
テスト用のYAMLを以下に.
plugins: - module: Subscription::Config config: feed: - url: http://plagger.g.hatena.ne.jp/SweetPotato/ - module: Store::Fastladder config: connect_info: - dbi:mysql:fastladder_production - root - ********** - on_connect_do: - SET NAMES utf8 member_id: 1
あとはいつものように plagger -c test.yaml と.
動作しましたか? 動作しましたか. やりましたね.
後で気づいたんだけど, RubyのMySQLライブラリをインストールする必要があったようなので gem install mysql した.
あと, 未読エントリが10件しか表示されかったのでこちらを読んで解決した.
参考
- PlaggerをWindowsにインストールするときの注意点 - Charsbar::Note
- ppm.tcool.org: Notes on perl / ppm versions
- shunirr.org - OpenFLのクローラにPlagger::Plugin::Store::Fastladder使ってみた:
- unknownplace.org - 2008/02/09 - OpenFL + Plagger::Plugin::Store::Fastladderも実戦投入した!
- migrationがMySQLではエラーになる。 - fastladder-discuss-ja | Google グループ
- 2008年2 月の記事:3 件 - walrusさんのVoxブログ
- fastladderインストール(4) - PC日記