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

r861:b967d2a3a85c - - 1 file changed: 1 inserted, 1 deleted

@@ -1,160 +1,160
1 1 == Installation
2 2
3 3 Installing cafe-grader can be done in the following steps.
4 4
5 5 1. Set up database. We need MySQL 5 database name, username and password.
6 6 2. Install RVM. cafe-grader runs on Ruby on Rails and the best way to install it is to use RVM.
7 7 3. Install necessary package for the system
8 8 4. Install cafe-grader from github
9 9 5. Deploy cafe-grader on apache with Phusion Passenger
10 10
11 11 Very important!!! All commands should be run from a normal user.
12 12
13 13 The detail of each step are provided as follows.
14 14
15 15 === 1. Install MySQL 5
16 16
17 17 Install MySQL server for the server.
18 18
19 19 cafe@grader:~$ sudo apt install mysql-server
20 20
21 21 Next, we will connect to mysql as root and set up the database. You can choose your DATABASENAME, USERNAME and PASSWORD as you wish.
22 22
23 23 cafe@grader:~$ sudo mysql -u root
24 24
25 25 mysql> create database DATABASENAME;
26 26 Query OK, 1 row affected (0.00 sec)
27 27
28 28 mysql> create user USERNAME@localhost identified by 'PASSWORD';
29 29 Query OK, 0 rows affected, 1 warning (0.00 sec)
30 30
31 31 mysql> grant all privileges on DATABASENAME.* to USERNAME@localhost;
32 32 Query OK, 0 rows affected, 1 warning (0.00 sec)
33 33
34 34 mysql> flush privileges;
35 35 Query OK, 0 rows affected (0.00 sec)
36 36
37 37 === 2. Install RVM
38 38
39 39 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.
40 40
41 41 First, we install necessary package for installing RVM.
42 42
43 43 cafe@grader:~$ sudo apt install software-properties-common
44 44
45 45 Second, we add the custom PPA, update the system and install RVM.
46 46
47 47 cafe@grader:~$ sudo apt-add-repository -y ppa:rael-gc/rvm
48 48 cafe@grader:~$ sudo apt-get update
49 49 cafe@grader:~$ sudo apt-get install rvm
50 50
51 51 We also need to add our user to the rvm group
52 52
53 53 sudo usermod -a -G rvm $USER
54 54
55 55 This is very important.
56 56 1. You have to reboot since RVM change a lots of system.
57 57 2. 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.
58 58
59 59 === 3. Install necessary package and nodejs
60 60
61 61
62 62 First, we install required package via apt.
63 63
64 - cafe@grader:~$ sudo apt install git libmysqlclient-dev default-jdk unzip php-cli apache2 dirmngr gnupg apache2-dev
64 + cafe@grader:~$ sudo apt install git libmysqlclient-dev default-jdk unzip php-cli apache2 apache2-dev
65 65
66 66 Next, we need nodejs. Depends on your ubuntu version, the step to install correct version of nodejs differs.
67 67
68 68 ==== 3.1 Install nodejs on Ubuntu 18.04
69 69
70 70 Since nodejs that comes with ubuntu 18.04 is very outdated, we need to install it manually. This follow the method outlined in https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04 under *Installing Node.js with Apt Using a NodeSource PPA*
71 71
72 72 cd ~
73 73 curl -sL https://deb.nodesource.com/setup_17.x -o nodesource_setup.sh
74 74 sudo bash nodesource_setup.sh
75 75 sudo apt install nodejs
76 76
77 77 ==== 3.2 Install nodejs on Ubuntu 20.04 or newer
78 78
79 79 cafe@grader:~$ sudo apt install nodejs
80 80
81 81 === 4. Install cafe-grader
82 82
83 83 First, ensure that RVM is installed correctly.
84 84
85 85 cafe@grader:~$ rvm
86 86
87 87 If you get a result similar to this.
88 88
89 89 Command 'rvm' not found, but there are 21 similar ones.
90 90
91 91 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.
92 92
93 93 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.
94 94
95 95 cafe@grader:~$ wget https://github.com/cafe-grader-team/cafe-grader-judge-scripts/raw/master/installer/install.sh
96 96 cafe@grader:~$ . ./install.sh
97 97
98 98 After installation is finished, grader is ready to run in development mode via Puma. 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.
99 99
100 100 cafe@grader:~/cafe_grader/web$ rails s
101 101
102 102 If Everything is OK, stop the Puma by Ctrl-C.
103 103
104 104 We are almost done. The last step is to set up apache and Phusion so that cafe-grader is served by apache.
105 105
106 106 === 5. Deploy cafe-grader on Phusion passenger via apache
107 107
108 108 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.
109 109
110 110 The deploy is divided into two parts: Installing Passenger and deploying the app.
111 111
112 112 ==== 5.1. Installing Passenger as a mod for apache via PPA and enable it.
113 113
114 114 cafe@grader:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
115 115 cafe@grader:~$ sudo apt-get install -y apt-transport-https ca-certificates
116 116 cafe@grader:~$ sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list'
117 117 cafe@grader:~$ sudo apt-get update
118 118 cafe@grader:~$ sudo apt-get install -y libapache2-mod-passenger
119 119 cafe@grader:~$ sudo a2enmod passenger
120 120
121 121
122 122 cafe@grader:~$ sudo apache2ctl restart
123 123
124 124 Finally, we should check that passenger is installed correctly. Run the following command and fix anything as suggested by the command.
125 125
126 126 cafe@grader:~$ sudo /usr/bin/passenger-config validate-install
127 127
128 128 ==== 5.2. Deploying the app. First, we determine the exact location of our ruby that is installed via RVM.
129 129
130 130 cafe@grader:~$ passenger-config about ruby-command
131 131 passenger-config was invoked through the following Ruby interpreter:
132 132 Command: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
133 133 Version: ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]
134 134 To use in Apache: PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
135 135 To use in Nginx : passenger_ruby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
136 136 To use with Standalone: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby /usr/bin/passenger start
137 137
138 138 Then, take note of the path after "Command". For this guide, it is /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
139 139
140 140 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.
141 141
142 142 <VirtualHost *:80>
143 143 #ServerName www.example.com
144 144
145 145 ServerAdmin webmaster@localhost
146 146 # dont forget to change the document root
147 147 DocumentRoot /home/cafe/cafe_grader/web/public
148 148
149 149 ErrorLog ${APACHE_LOG_DIR}/error.log
150 150 CustomLog ${APACHE_LOG_DIR}/access.log combined
151 151
152 152 # add Passenger
153 153 PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
154 154
155 155 # our cafe-grader app
156 156 <Directory /home/cafe/cafe_grader/web/public>
157 157 Allow from all
158 158 Options -MultiViews
159 159 Require all granted
160 160 </Directory>
You need to be logged in to leave comments. Login now