Description:
+task description git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@43 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r19:4d37e9a6cab5 - - 5 files changed: 84 inserted, 1 deleted

@@ -0,0 +1,69
1 + Steps
2 + =====
3 +
4 + 1. Set up mongrel_cluster
5 +
6 + follow: http://mongrel.rubyforge.org/docs/mongrel_cluster.html
7 +
8 + run it with user ioi:ioi
9 +
10 +
11 + 2. Set up Apache
12 +
13 + in general follow:
14 + http://mongrel.rubyforge.org/docs/apache.html
15 +
16 + 2.1 enable mods
17 +
18 + run:
19 + sudo a2enmod rewrite
20 + sudo a2enmod proxy
21 + sudo a2enmod proxy_balancer
22 + sudo a2enmod proxy_http
23 + sudo a2enmod deflate
24 + sudo a2enmod headers
25 +
26 + 2.2 edit virtual host at /etc/apache2/site-(available|enabled)
27 +
28 + added:
29 + ===========================================
30 + <directory "/home/ioi/web_grader/public/">
31 + Options FollowSymLinks
32 + AllowOverride None
33 + Order allow,deny
34 + Allow from all
35 + </directory>
36 +
37 + <proxy balancer://mongrel_cluster>
38 + BalancerMember http://127.0.0.1:8000
39 + BalancerMember http://127.0.0.1:8001
40 + BalancerMember http://127.0.0.1:8002
41 + BalancerMember http://127.0.0.1:8003
42 + BalancerMember http://127.0.0.1:8004
43 + Allow from localhost
44 + </proxy>
45 +
46 + # can't use proxypass because we want access to balancer-manager
47 + #ProxyPass / balancer://mongrel_cluster/
48 + #ProxyPassReverse / balancer://mongrel_cluster/
49 +
50 + <Location /balancer-manager>
51 + SetHandler balancer-manager
52 + </Location>
53 +
54 + RewriteEngine On
55 +
56 + # Uncomment for rewrite debugging
57 + RewriteLog "/var/log/apache2/ioi_rewrite.log"
58 + RewriteLogLevel 9
59 +
60 + # Rewrite to check for Rails cached page
61 + RewriteRule ^([^.]+)$ $1.html [QSA]
62 +
63 + # Redirect all non-static requests to cluster
64 + RewriteCond %{REQUEST_URI} !^/balancer-manager/(.*)$
65 + RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
66 + RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]
67 + ===========================================
68 +
69 +
@@ -0,0 +1,9
1 + class AddUrlToProblem < ActiveRecord::Migration
2 + def self.up
3 + add_column :problems, :url, :string
4 + end
5 +
6 + def self.down
7 + remove_column :problems, :url
8 + end
9 + end
@@ -13,24 +13,25
13 13 </div>
14 14
15 15 <hr/>
16 16
17 17 <p style="color: red"><%= flash[:notice] %></p>
18 18
19 19 <div class="problist">
20 20 <% i = 0 %>
21 21 <% @problems.each do |p| %>
22 22 <div class="problist-each">
23 23 <div class="probname">
24 24 <%= "#{i+1}: #{p.full_name} (#{p.name})" %>
25 + <%= link_to '[task description]', p.url if p.url!=nil %>
25 26 </div>
26 27 <div class="subinfo">
27 28 <%= format_submission(@prob_submissions[i][1],
28 29 @prob_submissions[i][0]) %>
29 30 </div>
30 31 </div>
31 32 <% i = i+1 %>
32 33 <% end %>
33 34 </div>
34 35
35 36 <br />
36 37 <hr />
@@ -4,16 +4,19
4 4 <p><label for="problem_name">Name</label><br/>
5 5 <%= text_field 'problem', 'name' %></p>
6 6
7 7 <p><label for="problem_full_name">Full name</label><br/>
8 8 <%= text_field 'problem', 'full_name' %></p>
9 9
10 10 <p><label for="problem_full_score">Full score</label><br/>
11 11 <%= text_field 'problem', 'full_score' %></p>
12 12
13 13 <p><label for="problem_date_added">Date added</label><br/>
14 14 <%= date_select 'problem', 'date_added' %></p>
15 15
16 + <p><label for="problem_url">URL</label><br/>
17 + <%= text_field 'problem', 'url' %></p>
18 +
16 19 <p><label for="problem_available">Available</label><br/>
17 20 <%= select("problem","available",[['True',true],['False',false]]) %></p>
18 21 <!--[eoform:problem]-->
19 22
@@ -1,37 +1,38
1 1 # This file is auto-generated from the current state of the database. Instead of editing this file,
2 2 # please use the migrations feature of ActiveRecord to incrementally modify your database, and
3 3 # then regenerate this schema definition.
4 4 #
5 5 # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6 6 # to create the application database on another system, you should be using db:schema:load, not running
7 7 # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8 8 # you'll amass, the slower it'll run and the greater likelihood for issues).
9 9 #
10 10 # It's strongly recommended to check this file into your version control system.
11 11
12 - ActiveRecord::Schema.define(:version => 12) do
12 + ActiveRecord::Schema.define(:version => 13) do
13 13
14 14 create_table "languages", :force => true do |t|
15 15 t.string "name", :limit => 10
16 16 t.string "pretty_name"
17 17 t.string "ext", :limit => 10
18 18 end
19 19
20 20 create_table "problems", :force => true do |t|
21 21 t.string "name", :limit => 30
22 22 t.string "full_name"
23 23 t.integer "full_score"
24 24 t.date "date_added"
25 25 t.boolean "available"
26 + t.string "url"
26 27 end
27 28
28 29 create_table "rights", :force => true do |t|
29 30 t.string "name"
30 31 t.string "controller"
31 32 t.string "action"
32 33 end
33 34
34 35 create_table "rights_roles", :id => false, :force => true do |t|
35 36 t.integer "right_id"
36 37 t.integer "role_id"
37 38 end
You need to be logged in to leave comments. Login now