ผลต่างระหว่างรุ่นของ "Installing Grader Web Interface"

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
แถว 1: แถว 1:
: ''Go backt to [[ฐานความรู้]]''
+
: ''Return to [[ฐานความรู้]]''
  
 
=== Install HAML ===
 
=== Install HAML ===

รุ่นแก้ไขเมื่อ 11:35, 16 มีนาคม 2551

Return to ฐานความรู้

Install HAML

The grader makes use of HAML. So you need to install it first.

gem install haml --no-ri

Check out the Grader Web Interface

First, make a directory that will contain all the grader files. In my case, I make a directory called "grader" inside my home directory.

mkdir ~/grader

Inside the directory, you check out the web interface.

svn co http://theory.cpe.ku.ac.th/grader/web/tags/0.1 ~/grader/web

Set up the Database

cd ~/grader/web/config
cp database.yml.SAMPLE database.yml

Then, edit database.yml so that it reflects the database setting of your machine.

Note: In Ubuntu, the database socket is not located at /tmp/mysql.sock as it is in other distributions. You need to add one extra line in database.yml to tell rails this:

 adapter: mysql
 socket: /var/run/mysqld/mysqld.sock
 database: ioi
 username: ioi
 password: whateverpassword
 host: localhost

Next, you do the migration:

cd ~/grader/web
rake db:migrate

Check your MySQL to see if the tables actually appear.

Test the Grader for the First Time

Then, run the server

ruby script/server

Go check http://localhost:3000. You can login as root and the password is ioionrails. You should change the password immediately and logout.

Set Up Mongrel Cluster

Have mongrel create a config file for you:

mongrel_rails cluster::config -e production -p 5000 -a 127.0.0.1 -N 2 -c ~/grader/web

The config file is located at ~/grader/web/config/mongrel_cluster.yml. It should look like this:

--- 
cwd: /home/ioi/grader/web
log_file: log/mongrel.log
port: "5000"
environment: production
address: 127.0.0.1
pid_file: tmp/pids/mongrel.pid
servers: 2

Next, start the server.

cd /~grader/web
mongrel_rails cluster::start

See if it works by checking out http://localhost:5000/.