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:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
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 |
@@ -22,6 +22,7 | |||
|
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], |
@@ -13,6 +13,9 | |||
|
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]--> |
@@ -9,7 +9,7 | |||
|
9 | 9 | # |
|
10 | 10 | # It's strongly recommended to check this file into your version control system. |
|
11 | 11 | |
|
12 |
- ActiveRecord::Schema.define(:version => 1 |
|
|
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 |
@@ -23,6 +23,7 | |||
|
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| |
You need to be logged in to leave comments.
Login now