Show More
Commit Description:
fig bugs in login report
Commit Description:
fig bugs in login report
File last commit:
Show/Diff file:
Action:
README.rdoc | 159 lines | 6.9 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
Update README.rdoc...
r727 Very important!!! All commands should be run from a normal user.
Update README.rdoc
r724 The detail of each step are provided as follows.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc...
r727 === 1. Install MySQL 5
Update README.rdoc
r724
Install MySQL server for the server.
Update README.rdoc...
r725 cafe@grader:~$ sudo apt install mysql-server
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc...
r727 Next, we will connect to mysql as root and set up the database. You can choose your DATABASENAME, USERNAME and PASSWORD as you wish.
Update README.rdoc
r724
Update README.rdoc...
r725 cafe@grader:~$ sudo mysql -u root
Update README.rdoc
r724
mysql> create database DATABASENAME;
Query OK, 1 row affected (0.00 sec)
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc...
r727 mysql> grant all privileges on DATABASENAME.* to USERNAME@localhost identified by 'PASSWORD';
Update README.rdoc
r724 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...
r727 === 2. 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...
r725 cafe@grader:~$ 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...
r725 cafe@grader:~$ sudo apt-add-repository -y ppa:rael-gc/rvm
cafe@grader:~$ sudo apt-get update
cafe@grader:~$ sudo apt-get install rvm
Jittat Fakcharoenphol
boots into rails 3
r318
update to 3.1.0, update rdoc
r821 We also need to add our user to the rvm group
sudo usermod -a -G rvm $USER
Jittat Fakcharoenphol
boots into rails 3
r318
update to 3.1.0, update rdoc
r821 This is very important.
1. You have to reboot since RVM change a lots of system.
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.
Update README.rdoc...
r725
update migration
r822 === 3. Install necessary package and nodejs
First, we install required package via apt.
cafe@grader:~$ sudo apt install libmysqlclient-dev default-jdk unzip php-cli apache2 dirmngr gnupg apache2-dev
Update README.rdoc
r724
update migration
r822 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*
cd ~
curl -sL https://deb.nodesource.com/setup_17.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install nodejs
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc...
r727 === 4. Install cafe-grader
Update README.rdoc
r724
First, ensure that RVM is installed correctly.
Update README.rdoc...
r725 cafe@grader:~$ rvm
If you get a result similar to this.
Command 'rvm' not found, but there are 21 similar ones.
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.
Update README.rdoc
r724
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...
r725 cafe@grader:~$ wget https://github.com/cafe-grader-team/cafe-grader-judge-scripts/raw/master/installer/install.sh
cafe@grader:~$ . ./install.sh
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc...
r725 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.
Update README.rdoc
r724
cafe@grader:~/cafe_grader/web$ rails s
Update README.rdoc...
r725 If Everything is OK, stop the WEBrick by Ctrl-C.
Update README.rdoc
r724 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...
r727 === 5. Deploy cafe-grader on Phusion passenger via apache
Update README.rdoc...
r725
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.
Update README.rdoc
r724
Update README.rdoc...
r725 The deploy is divided into two parts: Installing Passenger and deploying the app.
Jittat Fakcharoenphol
boots into rails 3
r318
Update README.rdoc...
r727 ==== 5.1. Installing Passenger as a mod for apache via PPA and enable it.
Update README.rdoc...
r725
cafe@grader:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
Update README.rdoc
r724 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
Update README.rdoc...
r727 ==== 5.2. 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...
r725 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.
Update README.rdoc
r724
<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
Update README.rdoc...
r725
Update README.rdoc
r726 Now it is done, you can login to the grader with user 'root' and password 'ioionrails'
Update README.rdoc
r724