Description:
added more instructions on creating mysal data
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r89:32f1f89c92d7 - - 1 file changed: 15 inserted, 0 deleted

@@ -1,126 +1,141
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo "This script will install and configure Cafe grader."
3 echo "This script will install and configure Cafe grader."
4
4
5 echo "Installing required apt"
5 echo "Installing required apt"
6
6
7 sudo apt-get update
7 sudo apt-get update
8 sudo apt-get install mysql-server mysql-client ruby1.8 ruby1.8-dev rdoc1.8 \
8 sudo apt-get install mysql-server mysql-client ruby1.8 ruby1.8-dev rdoc1.8 \
9 g++ gcc libmysql-ruby1.8 irb apache2 libmysqlclient15-dev build-essential \
9 g++ gcc libmysql-ruby1.8 irb apache2 libmysqlclient15-dev build-essential \
10 git-core rubygems rake openssl libopenssl-ruby
10 git-core rubygems rake openssl libopenssl-ruby
11
11
12 echo "Installing rails"
12 echo "Installing rails"
13
13
14 sudo gem install rails --no-ri --no-rdoc
14 sudo gem install rails --no-ri --no-rdoc
15 sudo gem install rack -v=1.0.1 --no-ri --no-rdoc
15 sudo gem install rack -v=1.0.1 --no-ri --no-rdoc
16
16
17 echo "Fetching Cafe Grader from Git repositories"
17 echo "Fetching Cafe Grader from Git repositories"
18
18
19 echo "Fetching web interface"
19 echo "Fetching web interface"
20
20
21 mkdir cafe_grader
21 mkdir cafe_grader
22 cd cafe_grader
22 cd cafe_grader
23 git clone http://git.gitorious.org/cafe-grader/cafe-grader-web.git web
23 git clone http://git.gitorious.org/cafe-grader/cafe-grader-web.git web
24
24
25 echo "Configuring rails app"
25 echo "Configuring rails app"
26
26
27 cp web/config/environment.rb.SAMPLE web/config/environment.rb
27 cp web/config/environment.rb.SAMPLE web/config/environment.rb
28
28
29 echo "At this point we will need MySQL user and database."
29 echo "At this point we will need MySQL user and database."
30 echo "Have you created MySQL user and database for Cafe grader? (Y/N) "
30 echo "Have you created MySQL user and database for Cafe grader? (Y/N) "
31 read ch
31 read ch
32
32
33 if [ "$ch" = "n" -o "$ch" = "N" ]
33 if [ "$ch" = "n" -o "$ch" = "N" ]
34 then
34 then
35 echo "Please open another terminal and create the user and database for Cafe grader."
35 echo "Please open another terminal and create the user and database for Cafe grader."
36 echo "Don't forget to grant access to that database for the user."
36 echo "Don't forget to grant access to that database for the user."
37 echo "Please have username, password, and database name ready before continue."
37 echo "Please have username, password, and database name ready before continue."
38 + echo
39 + echo "The following are instructions:"
40 + echo "1. Run mysql:"
41 + echo
42 + echo " mysql -u root -p"
43 + echo
44 + echo " if you have just installed mysql, the root password is the one that you have just entered"
45 + echo "2. Create a new database, a new user, and grant access to grader database:"
46 + echo
47 + echo " create user 'USERNAME'@'localhost' identified by 'PASSWORD';"
48 + echo " create database DATABASENEME;"
49 + echo " grant all on DATABASENAME.* to 'USERNAME'@'localhost';"
50 + echo
51 + echo " Replace USERNAME, PASSWORD, and DATABASENAME accordingly."
52 + echo
38 echo "Hit enter when ready..."
53 echo "Hit enter when ready..."
39 read dummy
54 read dummy
40 fi
55 fi
41
56
42 CAFE_PATH=`pwd`
57 CAFE_PATH=`pwd`
43
58
44 cd web
59 cd web
45
60
46 echo "Please provide grader database:"
61 echo "Please provide grader database:"
47 read database
62 read database
48
63
49 echo "Please provide grader username:"
64 echo "Please provide grader username:"
50 read username
65 read username
51
66
52 echo "Please provide $username password:"
67 echo "Please provide $username password:"
53 read password
68 read password
54
69
55 echo "development:" > config/database.yml
70 echo "development:" > config/database.yml
56 echo " adapter: mysql" >> config/database.yml
71 echo " adapter: mysql" >> config/database.yml
57 echo " database: $database" >> config/database.yml
72 echo " database: $database" >> config/database.yml
58 echo " username: $username" >> config/database.yml
73 echo " username: $username" >> config/database.yml
59 echo " password: $password" >> config/database.yml
74 echo " password: $password" >> config/database.yml
60 echo " host: localhost" >> config/database.yml
75 echo " host: localhost" >> config/database.yml
61 echo "" >> config/database.yml
76 echo "" >> config/database.yml
62 echo "production:" >> config/database.yml
77 echo "production:" >> config/database.yml
63 echo " adapter: mysql" >> config/database.yml
78 echo " adapter: mysql" >> config/database.yml
64 echo " database: $database" >> config/database.yml
79 echo " database: $database" >> config/database.yml
65 echo " username: $username" >> config/database.yml
80 echo " username: $username" >> config/database.yml
66 echo " password: $password" >> config/database.yml
81 echo " password: $password" >> config/database.yml
67 echo " host: localhost" >> config/database.yml
82 echo " host: localhost" >> config/database.yml
68
83
69 echo "Object.instance_eval{remove_const :GRADER_ROOT_DIR}" >> config/environment.rb
84 echo "Object.instance_eval{remove_const :GRADER_ROOT_DIR}" >> config/environment.rb
70 echo "Object.instance_eval{remove_const :GRADING_RESULT_DIR}" >> config/environment.rb
85 echo "Object.instance_eval{remove_const :GRADING_RESULT_DIR}" >> config/environment.rb
71 echo "GRADER_ROOT_DIR = '$CAFE_PATH/judge'" >> config/environment.rb
86 echo "GRADER_ROOT_DIR = '$CAFE_PATH/judge'" >> config/environment.rb
72 echo "GRADING_RESULT_DIR = '$CAFE_PATH/judge/result'" >> config/environment.rb
87 echo "GRADING_RESULT_DIR = '$CAFE_PATH/judge/result'" >> config/environment.rb
73
88
74 echo "Installing required gems"
89 echo "Installing required gems"
75
90
76 sudo rake gems:install
91 sudo rake gems:install
77 # to remove log file owned by root
92 # to remove log file owned by root
78 sudo rm log/*
93 sudo rm log/*
79 sudo rmdir log
94 sudo rmdir log
80
95
81 echo "Running rake tasks to initialize database"
96 echo "Running rake tasks to initialize database"
82
97
83 rake db:migrate
98 rake db:migrate
84 rake db:seed
99 rake db:seed
85
100
86 echo "Intalling web interface complete..."
101 echo "Intalling web interface complete..."
87 echo
102 echo
88 echo "Fetching grader"
103 echo "Fetching grader"
89
104
90 cd ..
105 cd ..
91
106
92 mkdir judge
107 mkdir judge
93 cd judge
108 cd judge
94 git clone http://git.gitorious.org/cafe-grader/cafe-grader-judge-scripts.git scripts
109 git clone http://git.gitorious.org/cafe-grader/cafe-grader-judge-scripts.git scripts
95 mkdir raw
110 mkdir raw
96 mkdir ev-exam
111 mkdir ev-exam
97 mkdir ev
112 mkdir ev
98 mkdir result
113 mkdir result
99 mkdir log
114 mkdir log
100
115
101 echo "Configuring grader"
116 echo "Configuring grader"
102
117
103 cp scripts/config/env_exam.rb.SAMPLE scripts/config/env_exam.rb
118 cp scripts/config/env_exam.rb.SAMPLE scripts/config/env_exam.rb
104 cp scripts/config/env_grading.rb.SAMPLE scripts/config/env_grading.rb
119 cp scripts/config/env_grading.rb.SAMPLE scripts/config/env_grading.rb
105
120
106 # create new environment.rb file
121 # create new environment.rb file
107 echo "RAILS_ROOT = '$CAFE_PATH/web'" > scripts/config/environment.rb
122 echo "RAILS_ROOT = '$CAFE_PATH/web'" > scripts/config/environment.rb
108 echo "GRADER_ROOT = '$CAFE_PATH/judge/scripts'" >> scripts/config/environment.rb
123 echo "GRADER_ROOT = '$CAFE_PATH/judge/scripts'" >> scripts/config/environment.rb
109 echo "require File.join(File.dirname(__FILE__),'../lib/boot')" >> scripts/config/environment.rb
124 echo "require File.join(File.dirname(__FILE__),'../lib/boot')" >> scripts/config/environment.rb
110 echo "require File.dirname(__FILE__) + \"/env_#{GRADER_ENV}.rb\"" >> scripts/config/environment.rb
125 echo "require File.dirname(__FILE__) + \"/env_#{GRADER_ENV}.rb\"" >> scripts/config/environment.rb
111
126
112 cd ..
127 cd ..
113
128
114 echo "Installing web server mongrel"
129 echo "Installing web server mongrel"
115
130
116 sudo gem install mongrel --no-ri --no-rdoc
131 sudo gem install mongrel --no-ri --no-rdoc
117
132
118 echo "Now you are ready to run cafe grader...."
133 echo "Now you are ready to run cafe grader...."
119 echo
134 echo
120 echo "Try:"
135 echo "Try:"
121 echo " cd web"
136 echo " cd web"
122 echo " ./script/server"
137 echo " ./script/server"
123 echo
138 echo
124 echo "and access web at http://localhost:3000/"
139 echo "and access web at http://localhost:3000/"
125
140
126
141
You need to be logged in to leave comments. Login now