blog.takuyan.com

Ruby & Javascript & Hack

RubyonRails製CMSの「Radiant」導入メモ

f:id:kattton:20100211153734g:image
radiant/radiant · GitHub

なんかCMS使いたいと思っていた。
巷ではWordPressが流行ってるようだけど、
根が天邪鬼なのでrubyCMSである、RadiantCMSを導入してみた。

だって、Ruby on Railsも使ってるみたいだしね。

前提条件

導入手順確認

githubで導入手順を確認する。

Home · radiant/radiant Wiki · GitHub

で、今回、OSはUbuntuだから、Ubuntu用のインストール手順を確認する。
なお、インストール手順が公開されているのは以下のOSだけぽい。
現時点ではWindowsの説明はなし。まあ、どうでもよいが。

導入する

Installing on Ubuntu · radiant/radiant Wiki · GitHub

上記みながらそのままコピペ。

sudo aptitude install ruby-dev libopenssl-ruby rubygems
sudo aptitude install libsqlite3-dev
sudo gem install rails radiant
sudo gem install sqlite3-ruby
export PATH=$PATH:/var/lib/gems/1.8/gems/radiant-0.8.1/bin

実行はもちろん自己責任で。
あと、こっちも参考に。

Installation · radiant/radiant Wiki · GitHub

で、ここからはgithubには、これといったドキュメントがなかった。
なので、似たようなドキュメントでしのぐ。

Home · radiant/radiant Wiki · GitHub
Download

radiant --database mysql WebsiteName

そうすると、WebsiteNameというプロジェクトが作成された。


次に、おもむろにINSTALLを確認。

== Installation and Setup

Once you have extracted the files into the directory where you would like to
install Radiant:


1. Create the MySQL/PostgreSQL/SQLite/SQL Server/DB2 databases for your Web
site. You only need to create the "production" database, but you may also
want to create the "development" and "test" databases if you are developing
extensions or running tests.


2. Edit config/database.yml to taste. There are example files available for
various databases in the config directory.


3. Run the database bootstrap rake task:


% rake production db:bootstrap


(If you would like bootstrap your development database run `rake
development db:bootstrap`.)


If you get the error "no such file to load -- spec/rake/spectask" please
install Rspec (gem install rspec).


4. Start it like a normal Rails application. To test execute:


% script/server -e production


And open your Web browser on port 3000 (http://localhost:3000). The
administrative interface is available at /admin/. By default the bootstrap
rake task creates a user called "admin" with a password of "radiant".


When using Radiant on a production system you may also need to set permissions
on the public and cache directories so that your Web server can access those
directories with the user that it runs under.


Once you've installed Radiant on your own Web site, be sure to add your name
and Web site to the list of radiant users:


http://wiki.github.com/radiant/radiant/radiant-users

ということなので、

  1. 本番用DBをMySQLで用意した。
  2. database.ymlを編集した。
  3. rake production db:bootstrap を実行した。

そんなにうまく行くわけがなかった。
ここで30分位つまづいた。

rake aborted!
can't activate rack (~> 1.0.0, runtime) for [], already activated rack-1.1.0 for ["radiant-0.8.1"]

これは、rackのversionを1.0.0までにしろとかそういうことですか?
で、すでにrackは1.1.0が入っていたので、ダメと。そういうことのようです。
なので、特に気にせずrackの上位バージョン共をuninstallした。

sudo gem1.8 uninstall rack --version=1.1.0
sudo gem1.8 uninstall rack --version=1.0.1
rake production db:bootstrap

すると、順調に動き出しました。
あらかたDBの作成がおわったところでユーザなどを設定して終了。
一応、ログも残す。

reate the admin user (press enter for defaults).
Name (Administrator): hogehoge
Username (admin): fugafuga
Password (radiant):

Initializing configuration.........OK

Select a database template:
1. Empty
2. Roasters (a coffee-themed blog / brochure)
3. Simple Blog
4. Styled Blog
[1-4]: 4

Creating Snippets....OK
Creating Pages....OK
Creating Layouts....OK
Creating Page parts....OK

Finished.

Passengerで動かす

(2010/02/13 修正)
昔、以下のサイトにお世話になりました。
Apache上でRuby on Railsアプリケーションを動かす/Passenger(mod_rails for Apache)の利用 | Redmine.JP

.htaccessは、特に何も記述する必要はないとのこと(id:nunaさんより)。


あと、apache再起動のために必要なtmpディレクトリがなかったので、作った。
でその先にrestart.txtを作ってアクセスしたら、radiantCMSが動いてました。

mkdir tmp
touch tmp/restart.txt


ということで完了。
ちゃんと使うなら、本を買ったほうが良さそう。

入門 Radiant CMS

入門 Radiant CMS