Description:
Update README.rdoc
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r726:438ea3c69fc9 - - 1 file changed: 1 inserted, 1 deleted

@@ -7,139 +7,139
7 3. Install necessary package for the system
7 3. Install necessary package for the system
8 4. Install cafe-grader from github
8 4. Install cafe-grader from github
9 5. Deploy cafe-grader on apache with Phusion Passenger
9 5. Deploy cafe-grader on apache with Phusion Passenger
10
10
11 The detail of each step are provided as follows.
11 The detail of each step are provided as follows.
12
12
13 === Install MySQL 5
13 === Install MySQL 5
14
14
15 Install MySQL server for the server.
15 Install MySQL server for the server.
16
16
17 cafe@grader:~$ sudo apt install mysql-server
17 cafe@grader:~$ sudo apt install mysql-server
18
18
19 Next, we will connect to mysql as root and set up the database. You can choose your DATABASENAME, USERNAME and PASSWORD.
19 Next, we will connect to mysql as root and set up the database. You can choose your DATABASENAME, USERNAME and PASSWORD.
20
20
21 cafe@grader:~$ sudo mysql -u root
21 cafe@grader:~$ sudo mysql -u root
22
22
23 mysql> create database DATABASENAME;
23 mysql> create database DATABASENAME;
24 Query OK, 1 row affected (0.00 sec)
24 Query OK, 1 row affected (0.00 sec)
25
25
26 mysql> grant all privileges on grader.* to USERNAME@localhost identified by 'PASSWORD';
26 mysql> grant all privileges on grader.* to USERNAME@localhost identified by 'PASSWORD';
27 Query OK, 0 rows affected, 1 warning (0.00 sec)
27 Query OK, 0 rows affected, 1 warning (0.00 sec)
28
28
29 mysql> flush privileges;
29 mysql> flush privileges;
30 Query OK, 0 rows affected (0.00 sec)
30 Query OK, 0 rows affected (0.00 sec)
31
31
32 === Install RVM
32 === Install RVM
33
33
34 Since Ubuntu has dedicated package for RVM we will use that. Just follow instruction given in https://github.com/rvm/ubuntu_rvm. For your convenience, the step are reproduced here.
34 Since Ubuntu has dedicated package for RVM we will use that. Just follow instruction given in https://github.com/rvm/ubuntu_rvm. For your convenience, the step are reproduced here.
35
35
36 First, we install necessary package for installing RVM.
36 First, we install necessary package for installing RVM.
37
37
38 cafe@grader:~$ sudo apt install software-properties-common
38 cafe@grader:~$ sudo apt install software-properties-common
39
39
40 Second, we add the custom PPA, update the system and install RVM.
40 Second, we add the custom PPA, update the system and install RVM.
41
41
42 cafe@grader:~$ sudo apt-add-repository -y ppa:rael-gc/rvm
42 cafe@grader:~$ sudo apt-add-repository -y ppa:rael-gc/rvm
43 cafe@grader:~$ sudo apt-get update
43 cafe@grader:~$ sudo apt-get update
44 cafe@grader:~$ sudo apt-get install rvm
44 cafe@grader:~$ sudo apt-get install rvm
45
45
46 This is very important. You have to logout and login again since RVM change a lots of system.
46 This is very important. You have to logout and login again since RVM change a lots of system.
47
47
48 If you are using GUI version of Ubuntu, be sure to have Gnome Terminal (or any other terminal you are using) perform login every time. This can be done by mark the check box "Run command as a login shell" in Gnome terminal or by adding --login to bash.
48 If you are using GUI version of Ubuntu, be sure to have Gnome Terminal (or any other terminal you are using) perform login every time. This can be done by mark the check box "Run command as a login shell" in Gnome terminal or by adding --login to bash.
49
49
50 === Install necessary package
50 === Install necessary package
51
51
52 cafe@grader:~$ sudo apt install libmysqlclient-dev default-jdk unzip nodejs php7.2-cli apache2 dirmngr gnupg apache2-dev
52 cafe@grader:~$ sudo apt install libmysqlclient-dev default-jdk unzip nodejs php7.2-cli apache2 dirmngr gnupg apache2-dev
53
53
54 curl build-essential
54 curl build-essential
55
55
56 === Install cafe-grader
56 === Install cafe-grader
57
57
58 First, ensure that RVM is installed correctly.
58 First, ensure that RVM is installed correctly.
59
59
60 cafe@grader:~$ rvm
60 cafe@grader:~$ rvm
61
61
62 If you get a result similar to this.
62 If you get a result similar to this.
63
63
64 Command 'rvm' not found, but there are 21 similar ones.
64 Command 'rvm' not found, but there are 21 similar ones.
65
65
66 It is very likely that you have not re-login or you are using bash without --login. Please do so and re-read the installation of RVM on Ubuntu https://github.com/rvm/ubuntu_rvm again.
66 It is very likely that you have not re-login or you are using bash without --login. Please do so and re-read the installation of RVM on Ubuntu https://github.com/rvm/ubuntu_rvm again.
67
67
68 Next, we will let the install script do the work of installing cafe-grader. Please prepare the DATABASENAME, USERNAME and PASSWORD as the script will ask for that. Make sure that you run the script from the home directory of the user.
68 Next, we will let the install script do the work of installing cafe-grader. Please prepare the DATABASENAME, USERNAME and PASSWORD as the script will ask for that. Make sure that you run the script from the home directory of the user.
69
69
70 cafe@grader:~$ wget https://github.com/cafe-grader-team/cafe-grader-judge-scripts/raw/master/installer/install.sh
70 cafe@grader:~$ wget https://github.com/cafe-grader-team/cafe-grader-judge-scripts/raw/master/installer/install.sh
71 cafe@grader:~$ . ./install.sh
71 cafe@grader:~$ . ./install.sh
72
72
73 After installation is finished, grader is ready to run in development mode via WEBrick. We will try that by the following command which will start a grader accessible via http://localhost:3000/. You can try logging in to the system and verify that it is actually work.
73 After installation is finished, grader is ready to run in development mode via WEBrick. We will try that by the following command which will start a grader accessible via http://localhost:3000/. You can try logging in to the system and verify that it is actually work.
74
74
75 cafe@grader:~/cafe_grader/web$ rails s
75 cafe@grader:~/cafe_grader/web$ rails s
76
76
77 If Everything is OK, stop the WEBrick by Ctrl-C.
77 If Everything is OK, stop the WEBrick by Ctrl-C.
78
78
79 We are almost done. The last step is to set up apache and Phusion so that cafe-grader is served by apache.
79 We are almost done. The last step is to set up apache and Phusion so that cafe-grader is served by apache.
80
80
81 === Deploy cafe-grader on Phusion passenger via apache
81 === Deploy cafe-grader on Phusion passenger via apache
82
82
83 This will install a Passenger mod for apache. You can start by visiting https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/install_passenger_main.html and fllow through the guide. We have reproduce the step here for Ubuntu 18.04. For other version, please select the appropriate one on the previous link.
83 This will install a Passenger mod for apache. You can start by visiting https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/install_passenger_main.html and fllow through the guide. We have reproduce the step here for Ubuntu 18.04. For other version, please select the appropriate one on the previous link.
84
84
85 The deploy is divided into two parts: Installing Passenger and deploying the app.
85 The deploy is divided into two parts: Installing Passenger and deploying the app.
86
86
87 1. Installing Passenger as a mod for apache via PPA and enable it.
87 1. Installing Passenger as a mod for apache via PPA and enable it.
88
88
89 cafe@grader:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
89 cafe@grader:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
90 cafe@grader:~$ sudo apt-get install -y apt-transport-https ca-certificates
90 cafe@grader:~$ sudo apt-get install -y apt-transport-https ca-certificates
91 cafe@grader:~$ sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list'
91 cafe@grader:~$ sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list'
92 cafe@grader:~$ sudo apt-get update
92 cafe@grader:~$ sudo apt-get update
93 cafe@grader:~$ sudo apt-get install -y libapache2-mod-passenger
93 cafe@grader:~$ sudo apt-get install -y libapache2-mod-passenger
94 cafe@grader:~$ sudo a2enmod passenger
94 cafe@grader:~$ sudo a2enmod passenger
95
95
96
96
97 cafe@grader:~$ sudo apache2ctl restart
97 cafe@grader:~$ sudo apache2ctl restart
98
98
99 Finally, we should check that passenger is installed correctly. Run the following command and fix anything as suggested by the command.
99 Finally, we should check that passenger is installed correctly. Run the following command and fix anything as suggested by the command.
100
100
101 cafe@grader:~$ sudo /usr/bin/passenger-config validate-install
101 cafe@grader:~$ sudo /usr/bin/passenger-config validate-install
102
102
103 - Deploying the app. First, we determine the exact location of our ruby that is installed via RVM.
103 + 2. Deploying the app. First, we determine the exact location of our ruby that is installed via RVM.
104
104
105 cafe@grader:~$ passenger-config about ruby-command
105 cafe@grader:~$ passenger-config about ruby-command
106 passenger-config was invoked through the following Ruby interpreter:
106 passenger-config was invoked through the following Ruby interpreter:
107 Command: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
107 Command: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
108 Version: ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]
108 Version: ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]
109 To use in Apache: PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
109 To use in Apache: PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
110 To use in Nginx : passenger_ruby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
110 To use in Nginx : passenger_ruby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
111 To use with Standalone: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby /usr/bin/passenger start
111 To use with Standalone: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby /usr/bin/passenger start
112
112
113 Then, take note of the path after "Command". For this guide, it is /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
113 Then, take note of the path after "Command". For this guide, it is /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
114
114
115 Assuming that cafe-grader is installed at /home/cafe/cafe_grader, we will edit the Apache's site config file /etc/apache2/site-enabled/000-default.conf as follow.
115 Assuming that cafe-grader is installed at /home/cafe/cafe_grader, we will edit the Apache's site config file /etc/apache2/site-enabled/000-default.conf as follow.
116
116
117 <VirtualHost *:80>
117 <VirtualHost *:80>
118 #ServerName www.example.com
118 #ServerName www.example.com
119
119
120 ServerAdmin webmaster@localhost
120 ServerAdmin webmaster@localhost
121 # dont forget to change the document root
121 # dont forget to change the document root
122 DocumentRoot /home/cafe/cafe_grader/web/public
122 DocumentRoot /home/cafe/cafe_grader/web/public
123
123
124 ErrorLog ${APACHE_LOG_DIR}/error.log
124 ErrorLog ${APACHE_LOG_DIR}/error.log
125 CustomLog ${APACHE_LOG_DIR}/access.log combined
125 CustomLog ${APACHE_LOG_DIR}/access.log combined
126
126
127 # add Passenger
127 # add Passenger
128 PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
128 PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
129
129
130 # our cafe-grader app
130 # our cafe-grader app
131 <Directory /home/cafe/cafe_grader/web/public>
131 <Directory /home/cafe/cafe_grader/web/public>
132 Allow from all
132 Allow from all
133 Options -MultiViews
133 Options -MultiViews
134 Require all granted
134 Require all granted
135 </Directory>
135 </Directory>
136 </VirtualHost>
136 </VirtualHost>
137
137
138
138
139 Be noted that we make 3 modifications: 1) change DocumentRoot, 2) add PassengerRuby option and add 3) Directory directive
139 Be noted that we make 3 modifications: 1) change DocumentRoot, 2) add PassengerRuby option and add 3) Directory directive
140 As the last step, we restart apache again and the site is ready to be used.
140 As the last step, we restart apache again and the site is ready to be used.
141
141
142 cafe@grader:~$ sudo apache2ctl restart
142 cafe@grader:~$ sudo apache2ctl restart
143
143
144 Now it is done, you can login to the grader with user 'root' and password 'ioionrails'
144 Now it is done, you can login to the grader with user 'root' and password 'ioionrails'
145
145
You need to be logged in to leave comments. Login now