MHTML
http://ja.wikipedia.org/wiki/MHTML
>MHTMLとは、MIME Encapsulation of Aggregate HTMLの略であり、Internet Explorer上で扱うことができるウェブページのアーカイブ形式である。通常は別々のファイルとして保存されるHTML文書とその他の画像などのデータを1つのファイルとしてアーカイブする事が可能である。使用される拡張子は、MHTおよびMHTMLである。
始めて知った・・・。
« 2007年04月27日 | メイン | 2007年05月02日 »
http://ja.wikipedia.org/wiki/MHTML
>MHTMLとは、MIME Encapsulation of Aggregate HTMLの略であり、Internet Explorer上で扱うことができるウェブページのアーカイブ形式である。通常は別々のファイルとして保存されるHTML文書とその他の画像などのデータを1つのファイルとしてアーカイブする事が可能である。使用される拡張子は、MHTおよびMHTMLである。
始めて知った・・・。
1.まず、rails をどのような環境で動かすか考える。
――――――――――――――――――――――――――――――――――――――――
DBはMySQLで決まり。
うーん。Webサーバーが問題だ。
Webサーバーを何にするか、
そのWebサーバーでどうやってrailsを動かすか調べないといけない。
railsを本番で動かすのって、
みんなどうやってるんだ?
apache?righttpd?Mongrel?
とりあえず、「rails apache」「rails Mongrel」「rails righttpd」「rails 本番環境」でググって見る。
「rails apache」でググったところ、くまくまーさんのエントリーで以下のようなものが!
http://wota.jp/ac/?date=20060605
これによると、
「Mongrel」が「速い上にWEBrick互換のオプションがある。Rails 濃い人は lighty から乗り換え中」
と書いてある。
Mongrelか?
2.Mongrelを調べる
――――――――――――――――――――――――――――――――――――――――
「Mongrel rails」でググって見る。
○MongrelでRailsを動かしてみる。
http://www.fraction.jp/log/archives/2006/09/1020
[root@emma ~]# gem install mongrel
○Nginx + Mongrel という選択肢
http://wota.jp/ac/?date=20060823
・・・色々見てみるが決定打なし...。
とりあえず、Mongrelでやってみるか...。
新サーバーの設置しなきゃ・・・。
3.CentOS5をダウンロード
――――――――――――――――――――――――――――――――――――――――
まず、CentOS5をダウンロード!
http://www.centos.org/
4.CDに焼く by burnatonce
――――――――――――――――――――――――――――――――――――――――
ダウンロードした6つのファイルをCDに焼きます。
5.CentOS5をインストール
――――――――――――――――――――――――――――――――――――――――
※CDを一番最初に起動するようにする
※ruby,mysqlにチェックを忘れずに!
いざ、サーバーにインストール!
5.rubyの確認
――――――――――――――――――――――――――――――――――――――――
ruby -v
6.checkinstallのinstall
――――――――――――――――――――――――――――――――――――――――
http://centos.oss.sc/fundamentals/checkinstall/
7.rubygemsのinstall
――――――――――――――――――――――――――――――――――――――――
http://centos.oss.sc/ruby/gems/
http://webrec.jp/blog/?tag=ruby
0.8.11 だと成功する...。
8.rails1.1.6のインストール
――――――――――――――――――――――――――――――――――――――――
gem install rails --version 1.1.6 --include-dependencies
9.rails確認
――――――――――――――――――――――――――――――――――――――――
rails -v
参考:
http://d.hatena.ne.jp/kabus/20070225
http://www.rubyonrails.org/
10.Mongrelのインストール
――――――――――――――――――――――――――――――――――――――――
gem install mongrel
>1 #1. mongrel 1.0.1 (ruby) を選択した。
Install required dependency daemons? [Yn] Y
>1 #1. fastthread 1.0 (ruby)
Install required dependency gem_plugin? [Yn] Y
参考:
http://www.fkino.net/hiki/?MongrelInstall (Linux)
http://rihi.cocolog-nifty.com/blog/2006/11/radrails_1327.html (Windows)
なんか、成功したっぽい。
11.Mongrelを起動してみる。
――――――――――――――――――――――――――――――――――――――――
[root@localhost ~]# mongrel_rails start
!!! Path to log file not valid: log/mongrel.log
mongrel::start reported an error. Use mongrel_rails mongrel::start -h to get help.
なんか、怒られた。何がいかんのんか...。
「Mongrel start」でググって見よう。
うーん。どうも、railsアプリのフォルダに移動して実行するらしい。
WEBrickに似てるのか?
とりあえず、railsアプリのある場所で起動してみる。
[root@localhost ~]# cd /srv/www/lighttpd/lr_portal/
[root@localhost lr_portal]# mongrel_rails start
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).
** Rails signals registered. HUP => reload (without restart). It might not work well.
** Mongrel available at 0.0.0.0:3000
** Use CTRL-C to stop.
む!さっきと反応が違うぞ!
http://10.20.138.111:3000
でアクセスしてみる。
おおおおぉ。railsのお馴染みの画面が表示された!
それにしても、righttpd のフォルダなんですが・・・。
まぁいいか...。
11.Mongrelでrailsの本番環境のDB(production)を使うにはどうすればいいのか。
――――――――――――――――――――――――――――――――――――――――
とりあえず、mysqlにログインしてみる。
[root@localhost ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
おおおおぉ。あっさりログイン。
server version: 5.0.22 か...まぁ、問題ないな...。
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
まぁ、DBがひとつもないのは、当たり前。
さっそくDB作るか。
・・・あ、そういえば。
railsには、本番用と開発用のサーバーがあったな。
いつも、開発用使ってるけど、本番用を使うにはどうするんだ?
そもそも、development から production にどうやって変更するんだ...。
railsの設定なんだろうな・・・。
ちょっとググって見よう。
「rails production 設定」
こんなの見つける。
http://rails.office.drecom.jp/hibi/archive/12
>P462を見る。
>各Webサーバによってproductionの指定が違うみたい。
>お手軽にWEBrickでやるとき。コマンドプロンプトで。
>
>C:\Program Files\ruby\rails_apps\your_app>set rails_env=production
>C:\Program Files\ruby\rails_apps\your_app>ruby script\server --environment=production
>
>としたらおっけー!
>へぇ、まじで!簡単だ。
>あ、もちろん、database.ymlでproductionのDBを設定しとくの忘れないでね。
うーむ。WEBrickでやるときか...。
「rails production mongrel」でググってみよう。
こんなの見つける。
http://d.hatena.ne.jp/catalina/20060922
> mongrel_rails start -d -p 3000 -e production
とりあえず、コンナ感じでよいと思うので、とりあえず次に進む。
12.DBを作成する
――――――――――――――――――――――――――――――――――――――――
これでよいのか...。とりあえず、DB作ろう。
あ、本番は、productionだけでいいのか。
# create database lr_portal_production default character set utf8;
12.DBへのアクセス権限設定
――――――――――――――――――――――――――――――――――――――――
次に、権限を設定。
grant all privileges on lr_portal_production.* to fukushige@localhost identified by 'fuku' with grant option;
13.アプリケーションをアップロード
――――――――――――――――――――――――――――――――――――――――
SSHで接続して、ローカルで作ったやつを無理やり
/srv/www/lighttpd/lr_portal/
に root でアップロードしてみる。
14.migrate
――――――――――――――――――――――――――――――――――――――――
データベースにテーブルを作成する。
[root@localhost lr_portal]# rake db:migrate
(in /srv/www/lighttpd/lr_portal)
rake aborted!
No such file or directory - /tmp/mysql.sock
(See full trace by running task with --trace)
むあ!なんか怒られた。
「No such file or directory - /tmp/mysql.sock」でググって見る。
http://cyclon.s11.xrea.com/mt/archives/2005/11/ruby_on_rails_m.html
↑こんなサイト見つける。
これによると、
>MySQL で接続のために生成している UNIX socket のファイルが /tmp/mysql.sock にないために発生しています。 MySQL は default でこのパスにファイルを生成しますが、設定によって変更されている場合があります。この場合、明示的に設定してあげる必要があります。
と書いてある。
解決方法まで書いてある。
>1. MySQL が UNIX socket をどこに生成しているかを確認
>mysqladmin variables | grep socket
>2. config/database.yml のデータベース設定の 1 つとして UNIX socket のパスを追記(データベース名やユーザー名と同様に記述すればよい)、以下 "/var/lib/mysql/mysql.sock" だった場合の例
>3.socket: /var/lib/mysql/mysql.sock
>4. WEBrick を再起動
とりあえず、やってみる。
まず、1
[root@localhost lr_portal]# mysqladmin variables | grep socket
| socket | /var/lib/mysql/mysql.sock
どうやら、 /var/lib/mysql/mysql.sock にあるらしい。
それで、2と3
/config/database.yml のproduction に socket: /var/lib/mysql/mysql.sock を追加した。
それで、再びアップロード。
ふたたびやってみる。
[root@localhost lr_portal]# rake db:migrate
(in /srv/www/lighttpd/lr_portal)
rake aborted!
No such file or directory - /tmp/mysql.sock
(See full trace by running task with --trace)
むああ!同じだ。
developmentにもやらないとダメなのか...?
いや、利用するのは production にしたいのだから...。
先に、mongrel を production モードで立ち上げないといけないのか?
とりあえず、やってみる。
[root@localhost lr_portal]# mongrel_rails stop
[root@localhost lr_portal]# mongrel_rails start -d -p 3000 -e production
これで、http://10.20.138.111:3000 を見てみると・・・。
あ!!ログイン画面登場!!!
なるほど!
DBに接続した!!
では、テーブルを作成する。
[root@localhost lr_portal]# rake db:migrate
[root@localhost lr_portal]# rake db:migrate
(in /srv/www/lighttpd/lr_portal)
rake aborted!
No such file or directory - /tmp/mysql.sock
(See full trace by running task with --trace)
[root@localhost lr_portal]#
ああああ!失敗・・・。
むー。
config/database.ymlの
development と test にも socket: /var/lib/mysql/mysql.sock を追加してみよう。
追加して・アップ。mongrel再起動。
[root@localhost lr_portal]# mongrel_rails stop
[root@localhost lr_portal]# mongrel_rails start -d -p 3000 -e production
でやってみる。
[root@localhost lr_portal]# rake db:migrate
(in /srv/www/lighttpd/lr_portal)
rake aborted!
Mysql::Error: Lost connection to MySQL server during query: SELECT version FROM schema_info
(See full trace by running task with --trace)
[root@localhost lr_portal]#
むあああー!なんか違うエラーでた。
なんか、 schema_info がなんちゃらと言っている...。
うーん。もしかして、 development みてるのか・・・。
とりあえず、development と test のDB作って、権限与えてみよう。
create database lr_portal_development default character set utf8;
create database lr_portal_test default character set utf8;
grant all privileges on lr_portal_development.* to fukushige@localhost identified by 'fuku' with grant option;
grant all privileges on lr_portal_test.* to fukushige@localhost identified by 'fuku' with grant option;
でやってみる。
[root@localhost lr_portal]# rake db:migrate
(in /srv/www/lighttpd/lr_portal)
rake aborted!
Mysql::Error: Lost connection to MySQL server during query: SELECT version FROM schema_info
(See full trace by running task with --trace)
むあああああー!同じエラー出た。
ちゃんとエラーメッセージ読もう。
どうも、SELECT version FROM schema_info にアクセスできないらしい。
当たり前である。ないし。
ああああ、ローカルでは前に、db:migrate しているから、バージョンを読もうとしているのか。
バージョン指定して、やってみるか。
[root@localhost lr_portal]# rake migrate VERSION=0
(in /srv/www/lighttpd/lr_portal)
rake aborted!
Mysql::Error: Lost connection to MySQL server during query: SELECT version FROM schema_info
(See full trace by running task with --trace)
むあああ!おなじだあぁl!
つーか。開発では、schema_info というテーブルはどうなっているんだ...?
と言うことで、ローカルのDBのdevelopmentのDBを見てみる。
mysql> use lr_portal_development
Database changed
mysql> select * from schema_info
-> ;
+---------+
| version |
+---------+
| 14 |
+---------+
1 row in set (0.02 sec)
うーむ。なるほど。
手で作ってみるか。
mysql> CREATE TABLE schema_info
-> (
-> version INT NOT NULL
-> );
Query OK, 0 rows affected (0.00 sec)
insert into schma_info (version) values (14);
mysql> select * from schema_info;
+---------+
| version |
+---------+
| 14 |
+---------+
1 row in set (0.00 sec)
これでやってみる。
[root@localhost lr_portal]# rake db:migrate
(in /srv/www/lighttpd/lr_portal)
rake aborted!
Mysql::Error: Lost connection to MySQL server during query: SELECT version FROM schema_info
(See full trace by running task with --trace)
[root@localhost lr_portal]# rake db:migrate VERSION=0
(in /srv/www/lighttpd/lr_portal)
rake aborted!
Mysql::Error: Lost connection to MySQL server during query: SELECT version FROM schema_info
(See full trace by running task with --trace)
[root@localhost lr_portal]#
むがあああぁ!変わらないし!
あ、production の方に作ってみよう。
mysql> use lr_portal_production
Database changed
mysql> CREATE TABLE schema_info ( version INT NOT NULL );
Query OK, 0 rows affected (0.00 sec)
mysql> insert into schema_info (version) values (14);
Query OK, 1 row affected (0.00 sec)
これでやってみる。
[root@localhost lr_portal]# rake db:migrate VERSION=0
(in /srv/www/lighttpd/lr_portal)
rake aborted!
Mysql::Error: Lost connection to MySQL server during query: SELECT version FROM schema_info
(See full trace by running task with --trace)
[root@localhost lr_portal]# rake db:migrate
(in /srv/www/lighttpd/lr_portal)
rake aborted!
Mysql::Error: Lost connection to MySQL server during query: SELECT version FROM schema_info
(See full trace by running task with --trace)
むおおおお。変わらん・・・。
なんなの・・・?
http://d.hatena.ne.jp/kabus/20061005
む、↑で見ると、権限の設定らしいぞ。
あれ?設定したのになぁ...。
もう一度見てみよう。
あ・・・
gem install mysql
やってないかも・・・。
[root@localhost lr_portal]# gem install mysql
Attempting local installation of 'mysql'
Local gem file not found: mysql*.gem
Attempting remote installation of 'mysql'
Select which gem to install for your platform (i386-linux)
1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. mysql 2.5.1 (ruby)
6. Cancel installation
> 3
Building native extensions. This could take a while...
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mlib
--without-mlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-zlib
--without-zlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-socketlib
--without-socketlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-nsllib
--without-nsllib
--with-mysqlclientlib
--without-mysqlclientlib
ERROR: While executing gem ... (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
ruby extconf.rb install mysql\nchecking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
[root@localhost lr_portal]#
うううん。
なんか、Error出てる...。
http://rubyist.g.hatena.ne.jp/pulscope/20070201
↑ここで書いてある方法をやったら、とりあえずインストールできた。
[root@localhost lr_portal]# sudo gem install mysql -- --with-mysql-lib=/usr/lib/mysql
Attempting local installation of 'mysql'
Local gem file not found: mysql*.gem
Attempting remote installation of 'mysql'
Select which gem to install for your platform (i386-linux)
1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. mysql 2.5.1 (ruby)
6. Cancel installation
> 3
Building native extensions. This could take a while...
mysql.c: In function ‘make_field_obj’:
mysql.c:185: 警告: unused variable ‘hash’
mysql.c: In function ‘stmt_execute’:
mysql.c:1316: 警告: unused variable ‘false’
mysql.c: In function ‘time_initialize’:
mysql.c:1703: 警告: control reaches end of non-void function
mysql.c: In function ‘stmt_execute’:
mysql.c:1365: 警告: ‘t.time_type’ is used uninitialized in this function
mysql.c:1378: 警告: ‘t.time_type’ is used uninitialized in this function
ruby extconf.rb install mysql -- --with-mysql-lib=/usr/lib/mysql
checking for mysql_query() in -lmysqlclient... yes
checking for mysql_ssl_set()... yes
checking for mysql.h... no
checking for mysql/mysql.h... yes
creating Makefile
make
gcc -I. -I. -I/usr/lib/ruby/1.8/i386-linux -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_MYSQL_H -I/usr/local/include -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -fPIC -c mysql.c
gcc -shared -L"/usr/lib/mysql" -L"/usr/local/lib" -L"/usr/lib" -o mysql.so mysql.o -lruby -lmysqlclient -lpthread -ldl -lcrypt -lm -lc
make install
mkdir -p /usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib
/usr/bin/install -c -m 0755 mysql.so /usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib
Successfully installed mysql-2.7
で、migrate やってみる。
[root@localhost lr_portal]# rake migrate
(in /srv/www/lighttpd/lr_portal)
rake aborted!
Mysql::Error: Lost connection to MySQL server during query: SELECT version FROM schema_info
(See full trace by running task with --trace)
ぐはーー。
エラー出る。
とりあえず、mongrel 再起動してみる。
[root@localhost lr_portal]# mongrel_rails stop
[root@localhost lr_portal]# mongrel_rails start -d -p 3000 -e production
[root@localhost lr_portal]# rake migrate
(in /srv/www/lighttpd/lr_portal)
rake aborted!
Mysql::Error: Lost connection to MySQL server during query: SELECT version FROM schema_info
(See full trace by running task with --trace)
あかん・・・。
そもそも、
Mysql::Error: Lost connection to MySQL server during query
の意味は、なんなんだ?
と言うことで、調べてみる。
「Mysql::Error: Lost connection to MySQL server during query」ググって見る。
http://d.hatena.ne.jp/coolstyle/comment?date=20061226
>ログ
>Mysql::Error: Lost connection to MySQL server during query
>Googleで調べた限りでは「gem install mysql」すれば良いらしいと書かれてあったので、DBサーバー側のDebianで必死にコマンドを打っていたのだけど一向に正常に動かない。
>何がいけないのか全くわからなかったのだが、原因はいたって単純だった。
>結局、「gem install mysql」しなければいけないのはサーバー側ではなく、クライアント側だったのである。
はぁ...クライアント側?
[root@localhost lr_portal]# rake db_schema_dump
(in /srv/www/lighttpd/lr_portal)
rake aborted!
Mysql::Error: Lost connection to MySQL server during query: SHOW TABLES
(See full trace by running task with --trace)
[root@localhost lr_portal]#
権限をもう一度、やってみる。
grant all privileges on *.* to fukushige@localhost identified by 'fuku' with grant option;
・・・あかん・・・。
http://rails.office.drecom.jp/q1w2e3r4/daily/200606/30
↑これ発見。
yum install mysql-devel
やってみる。インストール成功。
[root@localhost lr_portal]# rake migrate
(in /srv/www/lighttpd/lr_portal)
rake aborted!
Mysql::Error: Lost connection to MySQL server during query: SELECT version FROM schema_info
(See full trace by running task with --trace)
むーん。あかん。
config/database.yml
で
username: fukushige
password: fuku
を
username: root
password:
にしてみる。
[root@localhost lr_portal]# rake migrate
(in /srv/www/lighttpd/lr_portal)
あ、エラーが出ない。
どうも。権限らしい・・・。
[root@localhost lr_portal]# rake migrate VERSION=0
(in /srv/www/lighttpd/lr_portal)
== CreateReportsAuthentications: reverting ====================================
-- drop_table(:reports_authentications)
rake aborted!
Mysql::Error: #42S02Unknown table 'reports_authentications': DROP TABLE reports_authentications
(See full trace by running task with --trace)
むーー。今度は、なんだ・・・。
あー。なるほど。
lr_portal_development の schema_info を 0 にする。
use lr_portal_development
update schema_info set version=0;
コレで、
[root@localhost lr_portal]# rake migrate
(in /srv/www/lighttpd/lr_portal)
== CreateUnits: migrating =====================================================
-- create_table(:units)
-> 0.0110s
== CreateUnits: migrated (0.0116s) ============================================
== CreatePositions: migrating =================================================
-- create_table(:positions)
-> 0.0050s
== CreatePositions: migrated (0.0056s) ========================================
== CreateWorkForms: migrating =================================================
-- create_table(:work_forms)
-> 0.0044s
== CreateWorkForms: migrated (0.0049s) ========================================
== CreateUserAuthorizations: migrating ========================================
-- create_table(:user_authorizations)
-> 0.0142s
== CreateUserAuthorizations: migrated (0.0147s) ===============================
== CreateCompanyDirectories: migrating ========================================
-- create_table(:company_directories)
-> 0.0081s
== CreateCompanyDirectories: migrated (0.0087s) ===============================
== CreateUsers: migrating =====================================================
-- create_table(:Users)
-> 0.0047s
== CreateUsers: migrated (0.0053s) ============================================
== CreateChangeLogs: migrating ================================================
-- create_table(:change_logs)
-> 0.0051s
== CreateChangeLogs: migrated (0.0057s) =======================================
== CreateAuthentications: migrating ===========================================
-- create_table(:authentications)
-> 0.0264s
== CreateAuthentications: migrated (0.0270s) ==================================
== CreateAuthResponses: migrating =============================================
-- create_table(:auth_responses)
-> 0.0048s
== CreateAuthResponses: migrated (0.0054s) ====================================
== CreateReports: migrating ===================================================
-- create_table(:reports)
-> 0.0061s
== CreateReports: migrated (0.0067s) ==========================================
== CreateComments: migrating ==================================================
-- create_table(:comments)
-> 0.0051s
== CreateComments: migrated (0.0057s) =========================================
== CreateReportTypes: migrating ===============================================
-- create_table(:report_types)
-> 0.0045s
== CreateReportTypes: migrated (0.0051s) ======================================
== CreateReportsAuthentications: migrating ====================================
-- create_table(:reports_authentications)
-> 0.0043s
== CreateReportsAuthentications: migrated (0.0048s) ===========================
[root@localhost lr_portal]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 41 to server version: 5.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
おおおぉ。成功!
15.railsへのアクセス
――――――――――――――――――――――――――――――――――――――――
これで、
http://10.20.138.111:3000/account/su_login
にアクセスしてみる。
おおおおぉ。画面が表示される!
スーパーユーザでログイン!
※DBを見ない、ログインなので、ログインできるはず!!
で、やってみる。
Application error (Rails)
↑画面にコレが表示される・・・。
コレはいったい・・・。
あー。ファイルの権限の問題か・・・。
うーむ
app/controllers
app/helpers
app/models
app/views
のファイルをすべて 777 にしても表示されない・・・。
「Application error (Rails)」でググって見る。
http://pools.jp/2006/05/09/rails-webrick-application-error/
↑ここによると、
>これはWEBrickの起動時のカレントディレクトリが問題で、例えば、
> $rails demo
>でdemoアプリを作成した際には、
> $cd demo
>として作成したアプリのディレクトリに移動してから
> $ruby script/server
>としてWEBrickを起動すればApplication error (Rails)にはならず、実行環境が表示される。
>しょうもないエラーでした。
はぁ・・・でも、
/srv/www/lighttpd/lr_portal/
で mongrel 起動してるしなぁ・・・。
あ、、
[root@localhost lr_portal]# mongrel_rails stop
[root@localhost lr_portal]# mongrel_rails start
(前は、⇒# mongrel_rails start -d -p 3000 -e production だった)
これで、start したら、
Application error (Rails)
はでなくなったが・・・。
MissingSourceFile
no such file to load -- fastercsv
が出る。
gem install fastercsv
やると・・・。
[root@localhost lr_portal]# gem install fastercsv
Attempting local installation of 'fastercsv'
ERROR: Error installing gem fastercsv[.gem]: undefined method `include?' for nil:NilClass
うーむ・・・なんだろう。。
[root@localhost lr_portal]# cd /opt/
[root@localhost opt]# gem install fastercsv
Attempting local installation of 'fastercsv'
Local gem file not found: fastercsv*.gem
Attempting remote installation of 'fastercsv'
Updating Gem source index for: http://gems.rubyforge.org
Successfully installed fastercsv-1.2.0
Installing RDoc documentation for fastercsv-1.2.0...
場所変えたら、成功した・・・。なぜ・・・。
これで、
http://10.20.138.111:3000/ にアクセスすると!!
見れました!!!!
よし!!!
ちゃんと mysql とも連動してる!
16.課題点
――――――――――――――――――――――――――――――――――――――――
でも、以下の課題点がある。?
1.config/database.yml で利用している mysql のユーザーが root である。しかもパスワードなし。(ユーザー作って解決?)
2.development で動いている、production で動かさないとな。
とりあえず、これが解決できればいいカナと思う。
明日やろ。
2007年05月にブログ「プログラマ 福重 伸太朗 ~基本へ帰ろう~」に投稿されたすべてのエントリーです。過去のものから新しいものへ順番に並んでいます。
前のアーカイブは2007年04月27日です。
次のアーカイブは2007年05月02日です。