PHPベースのサーバーサイドRSSリーダー

#contents

**Google Reader [#mcd068ee]
『[[「Google Reader」終了 7月1日に ユーザー減少で - ITmedia ニュース:http://www.itmedia.co.jp/news/articles/1303/14/news035.html]]』にあるように、Google Readerの後継を探すことになった。

代替サービスはどれも Google Reader とは程遠い操作性で期待できない。
Thunderbird に RSS 購読機能があるので、購読リストを移してみたがいまひとつ操作性が良くないし、
いろんな端末で使えないのが弱点だった。

その点 Tiny-Tiny-RSS は Google Reader からの乗り換えに最適なようだ。
ただしVPS等のサーバーを持っている必用があるのが難点だ。

『[[mboinet/ttrss-mobile · GitHub:https://github.com/mboinet/ttrss-mobile]]』を使うと
スマートフォンなどからアクセスできるようになる。

**インストール手順 [#if05a749]
Sakura VPS 1Gプランに Debian 6.0 で apache2 + php5 を入れた環境を想定

***ソースコード [#f76492e0]
ソースコードは wget https://github.com/gothfox/Tiny-Tiny-RSS/archive/1.7.9.tar.gz のように
してダウンロードできる。
 
gitの勉強を兼ねてローカルにリポジトリを作成して取り出してみる。
 $ cd ~/src
 $ mkdir tt-rss
 $ cd tt-rss
 $ git clone https://github.com/gothfox/Tiny-Tiny-RSS.git
 $ cd Tiny-Tiny-RSS
 $ git checkout 1.7.9

emacs に magit を入れた状態なら ~/src/tt-rss/Tiny-Tiny-RSS のフォルダを dired で開いて
+ESC-x magit-status
+b キーを押す
+Switch to: ここで ? を押すとタグの一覧 (git tag) が得られる
+この時点での最終リリース版 1.7.9 に切り替える [2013/5/14]

自分用に config.php-dist から config.php を作成して、httpサーバーのフォルダに配置するまでを
gitを使って扱いたいのだが、まだ手順がよくわからない。

***aptitude [#q5adac97]
+apache2 libapache2-mod-php5 php5-cli が無い場合はインストール
+mysql-server php5-mysql php5-xmlrpc php5-curl が無い場合はインストール
++mysql-serverのrootのパスワードは設定しておく

***データベース [#x84451c7]
+mysql server の root パスワードを使って ttrssdb を作成
 $ mysqladmin -u root -p create ttrssdb
+ttrssuser のパスワードを決めて(examplepassと仮定)アクセス権を設定
 $ mysql -u root -p -e "GRANT ALL PRIVILEGES ON ttrssdb.* TO ttrssuser@'localhost' IDENTIFIED BY 'examplepass'"
 $ mysql -u root -p -e "FLUSH PRIVILEGES"
+ttrssuser のパスワードを使って ttrssdb に初期データを入れる
 $ cd ~/src/tt-rss/Tiny-Tiny-RSS
 $ mysql -u ttrssuser -D ttrssdb -p < schema/ttrss_schema_mysql.sql

***config.php [#n4ea06a4]
+config.php-dist ファイルを config.php にコピーしてから編集
 define('DB_TYPE', "mysql");
 define('DB_HOST', "localhost");
 define('DB_USER', "ttrssuser");
 define('DB_NAME', "ttrssdb");
 define('DB_PASS', "examplepass");
 define('SELF_URL_PATH', 'http://localhost/tt-rss/');
+TT-TSSのユーザー管理は使わずに Apache の Basic認証でユーザー管理をすることにする
 define('SINGLE_USER_MODE', true);

***Deploy(配置) [#g4ea36ec]
 $ cd ~/src/tt-rss
 $ rsync -av --exclude=.git Tiny-Tiny-RSS/ /home/otsuka/root_html/tt-rss/
 $ cd ~/root_html
 $ sudo chown -R www-data.www-data tt-rss

***apache2の設定 [#te3c5ad9]
+localhostからのアクセスは許可、それ以外は Basic認証
+/etc/apache2/conf.d/tt-rss.conf ファイルを以下の内容で作成
 # apache /etc/apache2/conf.d
 # tt-rss.conf
 
 Alias /tt-rss/ /home/otsuka/root_html/tt-rss/
 
 <Directory /home/otsuka/root_html/tt-rss>
     AuthType Basic
     AuthName "TT-RSS"
     AuthUserFile /home/otsuka/share/htpasswd/htpasswd-tt-rss
     AuthGroupFile /dev/null
     require valid-user
 
     order deny,allow
     deny from all
     allow from localhost
 
     Satisfy Any
 
     DirectoryIndex index.php
 </Directory>
 
 Alias /ttrm/ /home/otsuka/root_html/ttrm/
 
 <Directory /home/otsuka/root_html/ttrm>
     AuthType Basic
     AuthName "TT-RSS"
     AuthUserFile /home/otsuka/share/htpasswd/htpasswd-tt-rss
     AuthGroupFile /dev/null
     require valid-user
 
     order deny,allow
     deny from all
     allow from localhost
 
     Satisfy Any
 </Directory>
+Basic認証のパスワードファイルの作成
 $ cd ~/share/htpasswd
 $ htpasswd -c htpasswd-tt-rss user
 New password: (パスワードを設定)
 Re-type password: (パスワードを設定)
+sudo /etc/init.d/apache2 reload

***ブラウザから設定 [#xd914354]
+http://localhost/tt-rss/ を開く
+右上の[操作][Preference]を開き、ユーザー admin のパスワードを適当なものに変更
+[Preference]で Time Zone を Asia/Tokyo に変更
+購読リストを「[[Google データエクスポート:https://www.google.com/takeout/?pli=1#custom:reader]]」もしくは、
他のRSSリーダーからエクスポートするなどして OMPLファイルで用意し [Preference][OMPL] から読み込ませる
+ttrss-mobile のために APIアクセスを有効にする
 Enable API access
 Allows external clients to access this account through the API

***ttrss-mobile [#xaed0805]
+[[ttrss-mobile/dist at master · mboinet/ttrss-mobile · GitHub:https://github.com/mboinet/ttrss-mobile/tree/master/dist]] から最新版の .tar.bz2 ファイルをもらってくる
 $ cd ~/src
 $ mkdir ttrss-mobile
 $ cd ttrss-mobile
 $ wget https://github.com/mboinet/ttrss-mobile/blob/master/dist/ttrss-mobile-1.0.tar.bz2
+ファイルを展開する
 $ cd ~/root_html
 $ mkdir ttrm
 $ cd ttrm
 $ tar xavf ~/src/ttrss-mobile/ttrss-mobile-1.0.tar.bz2
+scriptsディレクトリにある conf.js-dist を conf.js としてコピーし、必要があれば apiPath: "/tt-rss/" の値を変更する(ここでは内容の変更は必要ない)
+スマートフォンから http://www.uraroba.com/ttrm/ でアクセスできる。
+スマートフォンから http://www.example.com/ttrm/ でアクセスできる。

***cron [#td92be75]
定期的に Feedを更新するためには cron の設定が必要。
7時から23時の 12分と42分に更新を行う。

 $ cat tt-rss
 # cron-jobs for TT-RSS
 #
 MAILTO=root
 12,42 7-23 * * *    www-data /usr/bin/php /home/otsuka/root_html/tt-rss/update.php --feeds --quiet
 $ sudo cp tt-rss /etc/cron.d/

-[[UpdatingFeeds - Tiny Tiny RSS:http://tt-rss.org/redmine/projects/tt-rss/wiki/UpdatingFeeds]]

**課題 [#q6cd15fe]
+ttrss-mobile でカテゴリ(フォルダー)内のコンテンツを出す方法が分からない (できない?)
+フィードの購読状況等を手早くバックアップしておきたいが、データベースのダンプまでは必要ない
--OPMLで公開するためのURLが発行されるのでこれをwget等で保存したかったのだが、Single User Modeでは動作しないのかもしれない

**履歴 [#h063d58b]
-[2013/5/19 0:18] SIMPLE_UPDATE_MODEをやめて、/etc/cron.d で30分ごとに update.php を回すことにした
-[2013/5/20 9:00] 負荷対策のため、Wikipedia 更新情報などの頻度の高いFeedを外した

**リンク [#z69a31a3]
-[[Tiny Tiny RSS:http://tt-rss.org/]]
-[[gothfox/Tiny-Tiny-RSS · GitHub:https://github.com/gothfox/Tiny-Tiny-RSS]]
-[[さくら VPS に Tiny Tiny RSS を導入 | 澍法雨:http://ryogan.org/blog/2013/03/24/%E3%81%95%E3%81%8F%E3%82%89-vps-%E3%81%AB-tiny-tiny-rss-%E3%82%92%E5%B0%8E%E5%85%A5/]]
-[[クラウド停止に困らない“プチ”サーバー構築、「Raspberry Pi」でサーバー型RSSリーダー:ITpro:http://itpro.nikkeibp.co.jp/article/COLUMN/20130423/473081/]]

トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS