Show More
Commit Description:
Update README.rdoc
Commit Description:
Update README.rdoc
File last commit:
Show/Diff file:
Action:
README.rdoc | 134 lines | 5.4 KiB | text/plain | TextLexer |
Update README.rdoc
r724 == Installation
Installing cafe-grader can be done in the following steps.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 1. Set up database. We need MySQL 5 database name, username and password.
2. Install RVM. cafe-grader runs on Ruby on Rails and the best way to install it is to use RVM.
3. Install necessary package for the system
4. Install cafe-grader from github
5. Deploy cafe-grader on apache with Phusion Passenger
The detail of each step are provided as follows.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 === Install MySQL 5
Install MySQL server for the server.
$ sudo apt install mysql-server
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 Next, we will connect to mysql as root and set up the database. You can choose your DATABASENAME, USERNAME and PASSWORD.
sudo mysql -u root
mysql> create database DATABASENAME;
Query OK, 1 row affected (0.00 sec)
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 mysql> grant all privileges on grader.* to USERNAME@localhost identified by 'PASSWORD';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 === Install RVM
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 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.
First, we install necessary package for installing RVM.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 $ sudo apt install software-properties-common
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 Second, we add the custom PPA, update the system and install RVM.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 $ sudo apt-add-repository -y ppa:rael-gc/rvm
$ sudo apt-get update
$ sudo apt-get install rvm
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 This is very important. You have to logout and login again since RVM change a lots of system.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 === Install necessary package
$ sudo apt install libmysql-dev default-jdk unzip nodejs php7.2-cli apache2 dirmngr gnupg apache2-dev
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 curl build-essential
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 === Install cafe-grader
First, ensure that RVM is installed correctly.
If instead of this you get the following error, it is very likely that you have not use bash --login.
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.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 cafe@grader:~$ wget https://github.com/cafe-grader-team/cafe-grader-judge-scripts/raw/master/installer/install-ubuntu-18.04.sh
cafe@grader:~$ . ./install-ubuntu-18.04.sh
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 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 should try logging in to the system and verify that it is actually work.
cafe@grader:~/cafe_grader/web$ rails s
We are almost done. The last step is to set up apache and Phusion so that cafe-grader is served by apache.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 === Deploy cafe-grader on Phusion passenger via apache
Basically, we will follow the instructions given in https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/bionic/install_passenger.html, which devided into two parts: Installing Passenger and deploying the app.
Installing Passenger as a mod for apache and enable it.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 cafe@grader:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
cafe@grader:~$ sudo apt-get install -y apt-transport-https ca-certificates
cafe@grader:~$ sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list'
cafe@grader:~$ sudo apt-get update
cafe@grader:~$ sudo apt-get install -y libapache2-mod-passenger
cafe@grader:~$ sudo a2enmod passenger
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724
cafe@grader:~$ sudo apache2ctl restart
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 Finally, we should check that passenger is installed correctly. Run the following command and fix anything as suggested by the command.
cafe@grader:~$ sudo /usr/bin/passenger-config validate-install
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 Deploying the app. First, we determine the exact location of our ruby that is installed via RVM.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 cafe@grader:~$ passenger-config about ruby-command
passenger-config was invoked through the following Ruby interpreter:
Command: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
Version: ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]
To use in Apache: PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
To use in Nginx : passenger_ruby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
To use with Standalone: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby /usr/bin/passenger start
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 Then, take note of the path after "Command". For this guide, it is /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 Assuming that cafe-grader is installed at /home/cafe/cafe_grader, we will edit the site config file of the apache as follow.
<VirtualHost *:80>
#ServerName www.example.com
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 ServerAdmin webmaster@localhost
# dont forget to change the document root
DocumentRoot /home/cafe/cafe_grader/web/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 # add Passenger
PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 # our cafe-grader app
<Directory /home/cafe/cafe_grader/web/public>
Allow from all
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 Be noted that we make 3 modifications: 1) change DocumentRoot, 2) add PassengerRuby option and add 3) Directory directive
As the last step, we restart apache again and the site is ready to be used.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc
r724 cafe@grader:~$ sudo apache2ctl restart