japan.internet.com
japan.internet.com メンバーID
Twitter
Facebook
RSS

« 前のエントリー | 記事一覧 | 次のエントリー »

30min. iPhoneアプリリリース (2008年08月18日)

How do you like them apples?

遂に30min.のiPhoneアプリをリリース!

「30min. ランチ検索」という名前で、
ナビゲーションのジャンルからダウロードできる。
iTunesでのダウンロードはこちらから





iPhone 3Gの発売前から準備をしていたのだが、
諸々の手続き等に時間がかかってしまい、
やっとのことでリリースに漕ぎ着けた。

8月18日現在の状況だが、無料アプリのトップ50にランクイン中。
早いタイミングでリリースすることに注力して、
相当の苦労があっただけに、嬉しさも大きい。

肝心のアプリの内容はというと、
アプリを起動するだけでGPSから位置情報を取得して、
現在位置から近い順に店舗を探すことができるのと、
近隣の最新ブログ記事を読むことができるアプリだ。

Safariのレンダリングエンジンを使っているので、
ユーザーのブログページに飛んでブログの内容を読むことができる。

現在は東京、神奈川のみのデータのサービスだが、
サービスエリアを順次拡大していくので、
他のエリアの方々も期待して待っていて欲しい。


話は変わるが、先日、30min.に掲載させていただいている、
ハンバーガーストリートのY.Mさんがオフィスに来ていただいて、
雑誌「HAMBURGER STREET」の創刊準備号をいただきました。

残念ながら私が不在の時で直接お話はできなかったのだが、
普通にハンバーガーを紹介している雑誌とは一味違い、
全国のハンバーガー店店主へのインタビューを
メインに構成されているだけでなく、
自費出版とのことで、ハンバーガーへの情熱に頭が下がる思いだ。

書店での販売はせず、全国のハンバーガーショップ/アメリカンダイナー50店での
店頭販売になるとのこと。

詳しくはハンバーガーストリートのお知らせ記事へ。


Rails + PostGIS (2008年08月15日)


夏休みに入り、30min.の運営スタッフの作業が止まるので、
その間に新しいサーバーへのデータ移行を進めている。

フレームワークとしてRuby on Railsを使用していること以前書いたと思うが、
具体的にはmongrel_clusterを使用して開発環境、本番環境の2つのRailsを動作させ、
Apache2のバーチャルホストとProxy Balancerで、
開発環境用のドメインと本番環境用のドメインで別々のRailsに振り分けており、
データベースは、位置情報データを効率よく扱うため、
PostgreSQLとその拡張ソフトのPostGISを使用している。

個別の設定については色々なサイトで紹介されているが、
まとめて紹介されているページが見当たらなかったので紹介しておこう。
(OSはCentOS 5.2を使用)

まずはPostgreSQLのインストール。
# su -
# adduser postgres
# mkdir /usr/local/pgsql
# chown postgres.postgres /usr/local/pgsql
# su - postgres
$ cd /WORKDIR
$ tar xfvz postgresql-***.tar.gz
$ cd postgresql-***
$ ./configure
$ make
$ make install

PATHを通すために /etc/bashrc に次の設定を加える。

# postgres
PG=/usr/local/pgsql
PATH="$PATH":$PG/bin
export MANPATH="$MANPATH":$PG/man
export PGLIB=$PB/lib
export PGDATA=$PG/data

続いてデータベースの初期化
# su - postgres
$ initdb --encoding=UTF-8 --no-locale

起動スクリプトの設定。
# cp /WORKDIR/postgresql-***/contrib/start-scripts/linux /etc/rc.d/init.d/postgres
# chmod 755 /etc/rc.d/init.d/postgres
# chkconfig --add postgres

次にproj.4ライブラリのインストール。
# cd /WORKDIR
# tar xfvz proj-***.tar.gz
# cd proj-***
# ./configure
# make
# make install

/etc/ld.so.conf.d/以下にproj4.confを作成して次の一行を記載。
/usr/local/lib

ldconfigの実行。
# ldconfig

GEOSのインストール。
# cd /WORKDIR
# tar xfvj geos-***.tar.bz2
# cd geos-***
# ./configure
# make
# make install

/etc/ld.so.conf.d/以下にgeos.confを作成して次の一行を記載。
/usr/local/bin

ldconfigの実行。
# ldconfig

PostGISのインストール。
# su - postgres
$ cd /WORKDIR
$ tar xfvz postgis-***.tar.gz
$ cd postgis-***
$ ./configure
$ make
$ make install

PostgreSQLを起動して設定を追加する。
# /etc/rc.d/init.d/postgres start
# su - postgres
$ createlang plpgsql template1
$ psql -d template1 -f /usr/local/pgsql/share/lwpostgis.sql
$ psql -d template1 -f /usr/local/pgsql/share/spatial_ref_sys.sql

ここまででデータベース関連の設定は完了だ。
続いてWebサーバー関連の設定。

Apache2のインストール。
# cd /WORKDIR
# tar xfvz httpd-***.tar.gz
# cd httpd-***/srclib/apr
# ./configure
# make
# make install
# cd ../apr-util
# ./configure --with-apr=/usr/local/apr
# make
# make install
# cd ../../
# ./configure --enable-so --enable-ssl --enable-rewrite --enable-proxy --enable-proxy-balancer
# make
# make install

起動スクリプトの設定。
# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/apache

/etc/rc.d/init.d/apacheの最初にchkconfig用の設定を追加。
# chkconfig: 2345 99 01
# description: Apache2

chkconfigの実行。
# chkconfig --add apache

続いてrubyのインストール。
# cd /WORKDIR
# tar xfvz ruby-***.tar.gz
# cd ruby-***
# ./configure
# make
# make install

念の為/usr/binでもPATHが通るようにしておく。
# ln -s /usr/local/bin/ruby /usr/bin/ruby

RubyGemsのインストール。
# cd /WORKDIR
# tar xfvz rubygems-***.tar.gz
# cd rubygems-***
# ruby setup.rb

Rails、gettext(日本語のメール送信用に)、mongrel、mongrel_clusterのインストール。
# gem install rails --remote --include-dependencies
# gem install gettext --remote --include-dependencies
# gem install mongrel --remote --include-dependencies
# gem install mongrel_cluster --remote --include-dependencies

Postgres用のアダプタをインストール。
# gem install postgres-pr --remote --include-dependencies

位置情報を扱うためのGeoRubyのインストール。
# gem install GeoRuby --remote --include-dependencies

SpatialAdapterをインストールするのにSubversionが必要なので、
まずはSubversionをインストール。
# cd /WORKDIR
# tar xfvz subversion-***.tar.gz
# cd subversion-***
# ./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr
# make
# make install

/usr/local/apache2/conf/httpd.confにSubversionの設定が追加されるので、
必要ない場合はコメントアウト。
#LoadModule dav_svn_module     modules/mod_dav_svn.so
#LoadModule authz_svn_module   modules/mod_authz_svn.so

Railsの設定。開発環境を/APPROOT/devとし、本番環境を/APPROOT/productとし、
Apache2、mongrelのユーザーをwwwとした場合。

まずはmongrel_clusterの自動起動の設定。
# cp /usr/local/lib/ruby/gems/***/gems/mongrel_cluster-***/resources/mongrel_cluster \
/etc/rc.d/init.d/mongrel_cluster # chmod 755 /etc/rc.d/init.d/mongrel_cluster

/etc/rc.d/init.d/mongrel_clusterを修正。
まずはchkconfigの設定を追加。
#chkconfig: 2345 85 15

ユーザー名を設定。
USER=www

/usr/local/binだとPATHが通らない可能性があるので、
PATHのチェックを外す。
# which mongrel_cluster_ctl >/dev/null || exit 0

同様の理由でmongrel_cluster_ctlの箇所を変更。
/usr/local/bin/mongrel_cluster_ctl

chkconfigを実行。
# chkconfig --add mongrel_cluster

設定ファイル用のディレクトリを作成。
# mkdir /etc/mongrel_cluster
# mkdir /var/run/mongrel_cluster
# chown www.www /var/run/mongrel_cluster

Railsの環境を構築。
# su - www
$ mkdir /APPROOT/dev
$ cd /APPROOT/dev
$ rails rails
$ mongrel_rails cluster::configure -p 3000 -a 127.0.0.1 -e development \
-l /APPROOT/dev/rails/log/mongrel.log \
-c /APPROOT/dev/rails -r /APPROOT/dev/rails \
-P /var/run/mongrel_cluster/mongrel.pid -N 1 --user www --group www $ mkdir /APPROOT/product $ cd /APPROOT/product $ rails rails $ mongrel_rails cluster::configure -p 3001 -a 127.0.0.1 -e production \
-l /APPROOT/product/rails/log/mongrel.log \
-c /APPROOT/product/rails -r /APPROOT/product/rails \
-P /var/run/mongrel_cluster/mongrel.pid -N 1 --user www --group www

/APPROOT/dev/rails/config/mongrel_cluster_yml
/APPROOT/product/rails/config/mongrel_cluster_ymlにdocrootの行がある場合は削除しておく。

Apache2のDocumentRoot用に空のディレクトリを作っておく。
$ mkdir /APPROOT/dev/htdocs
$ mkdir /APPROOT/product/htdocs

mongrel_clusterの設定ディレクトリにmongrel_cluster_ymlへのシンボリックリンクを設定。
$ su -
# ln -s /APPROOT/dev/rails/config/mongrel_cluster_yml /etc/mongrel_cluster/dev.yml
# ln -s /APPROOT/product/rails/config/mongrel_cluster_yml /etc/mongrel_cluster/product.yml

Apache2の設定ファイルの編集。
/usr/local/apache2/conf/httpd.confの変更。

まずは実行ユーザーの変更。
User www
Group www

httpd-vhosts.confを読み込むようにする。
Include conf/extra/httpd-vhosts.conf

その他、ServerNameなど必要に応じて変更しておく。

/usr/local/apache2/conf/extra/httpd-vhosts.confに設定を追加。
NameVirtualHost *

<VirtualHost *>
    ServerAdmin webmaster@DOMAINNAME.jp
    DocumentRoot /APPROOT/product/htdocs
    ServerName www.DOMAINNAME.jp
    ErrorLog "|/usr/local/apache2/bin/rotatelogs \
/usr/local/apache2/logs/error_log.%Y%m%d 86400 540" CustomLog "|/usr/local/apache2/bin/rotatelogs \
/usr/local/apache2/logs/access_log.%Y%m%d 86400 540" combined <IfModule mod_proxy.c> <Proxy *> Order deny,allow deny from all # 開発環境を閲覧できるIPアドレス allow from 192.168.0.0/24 </Proxy> ProxyRequests Off ProxyPreserveHost On ProxyPass / http://localhost:3001/ ProxyPassReverse / http://127.0.0.1:3001/ </IfModule> SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1 </VirtualHost> <VirtualHost *> ServerAdmin webmaster@DOMAINNAME.jp DocumentRoot /APPROOT/dev/htdocs ServerName development.DOMAINNAME.jp ErrorLog "|/usr/local/apache2/bin/rotatelogs \
/usr/local/apache2/logs/development-error_log.%Y%m%d 86400 540" CustomLog "|/usr/local/apache2/bin/rotatelogs \
/usr/local/apache2/logs/development-access_log.%Y%m%d 86400 540" combined <IfModule mod_proxy.c> <Proxy *> Order allow,deny allow from all </Proxy> ProxyRequests Off ProxyPreserveHost On ProxyPass / http://localhost:3000/ ProxyPassReverse / http://127.0.0.1:3000/ </IfModule> SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1 </VirtualHost>

これでWebサーバー関連の設定も完了だ。


注目のトピックス
Copyright 2012 internet.com K.K. (Japan) All Rights Reserved.