-
Notifications
You must be signed in to change notification settings - Fork 81
Manual Setup Guide
Note: This method is no longer recommended as using docker simplifies the setup and maintenance process a lot.
This guide explains how to set up Aurora on Ubuntu. For Arch Linux, steps are similar. Aurora comprises 3 parts, each of which can be installed on different machines (Judge and WebUI can also be replicated on many boxes for load balancing), but this guide explains how to do it on a single machine. The 3 parts are Database, Judge and Web UI.
STEP 1: LAMP Setup (Prerequisite)
Aurora's Web UI runs on PHP and database on MySQL, both are part of the lamp stack. So we need to install a lamp server. To install lamp server run following commandsudo apt-get install lamp-server^
During installation, you will be prompted to set MySQL's root user password.
Installing PHPMyAdmin will come in handy for database management. (You can also opt for any other such software, such as adminer, but the guide references PHPMyAdmin in install steps). To install PHPMyAdmin run
sudo apt-get install phpmyadmin
During installation, you will be prompted for server type (choose apache2) and MySQL's root user password.
STEP 2: Database Setup
Now we can proceed to the installation of the Database. It is recommended to create a separate user for aurora. To create a user, login to phpmyadmin. Go to the Users page and click on add new user. Give any username and password. For host you can choose Local if you are installing all components on the same machine, otherwise, you will need to set host configuration according to locations of Judge and Web UI boxes.
Also, select 'Grant all privileges on wildcard name (username_%)' in the 'Database for user' section. This is required as a ranking system of Aurora requires some administrative privileges.
Logout and login with the newly created user. Open and copy contents of aurora_main.sql file, found in the DB folder of Aurora repository. Go to the SQL tab in PHPMyAdmin. Paste and run the commands.
This will create a DB named 'aurora_main' and tables inside this database. If you want to give some other name to the database then change line #22 and #23 of SQL file accordingly. Now, the database setup is complete.
STEP 3: Judge Setup
There are scripts to setup judge and compilers, inside a sandbox (chroot jail) for both ubuntu and arch Linux, found in Judge folder of the repository. You need to run it as the root user. To run the script in ubuntu, simply go to judge folder and runsudo ./ubuntu_setup.sh
Similarly, for Arch Linux, run arch_setup.sh.
For Ubuntu users script will ask for
- Architecture of the system: Enter 1 for a 32-bit system and 2 for a 64-bit system.
- Suite name: This is the version name for ubuntu. It is recommended to use trusty (16.04) as it is an LTS version. But you can enter any other suite name later than Xenial Xerus (16.04).
- Target path: Full path of the location where you want to set up the judge. Eg. /home/username/judge
- Mirror URL: Url for Ubuntu repo. By default it takes 'http://archive.ubuntu.com/ubuntu/' but you can give any other URL.
- Judge Script Location: By default it takes the URL of Github's repo. But you are free to use the link to any other repo, in case you are using a forked version of Aurora.
For Arch Linux user, the script will ask for only target path and Judge Script Location.
During installation, you might be prompted several times for confirmation to install some components (like compilers) by the system. Confirm them to proceed. At completion, you will see following output. Note that you have to update a few variables in the installed judge.py according to your setup. The log also prints the command which will let you do this. In the above case, it is 'sudo nano /home/administrator/pushkar/judge/home/judge/judge.py'.
After updating the printed variables, the setup for the judge is complete. You can use command sudo startjudge
to start the judge. In case, you encountered some error, you can contact me but make sure you dump all the logs generated during installation in a text file and attach the same in the mail.
STEP 4: Web UI Setup
Copy files inside the Web Interface folder to any folder inside /var/www/ to host it. Or configure apache to host the directory where Web Interface folder is located.Aurora's web interface requires URL rewrite functionality. If you are shown 404 error for various pages then most probably it is disabled. To enable it in ubuntu run
sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
in Arch Linux uncomment following line in httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
You also need to enable the following extensions for PHP. In Ubuntu, both of them are already enabled. For Arch Linux just uncomment the lines in php.ini.
extension=openssl.so
extension=pdo_mysql.so
To set a limit of maximum file size that can be uploaded you need to change following in php.ini according to your preference.
post_max_size = 20M
upload_max_filesize = 20M
STEP 5: Initial Configuration
After all server configuration and database are in place, it is time to edit config.php You need to edit the following line in config.php
define("SITE_URL", "http://" . $_SERVER['HTTP_HOST'] . "/aurora"); // path to directory
define("SQL_USER", "aurora"); // Database username
define("SQL_PASS", "aurora"); // Database password
define("SQL_DB", "aurora_main"); // Database name
define("SQL_HOST", "127.0.0.1"); // Database host
define("SQL_PORT", "3306"); // Database port
The first line specifies the path of the directory. Delete . "/aurora"
in case it is the root of the webserver otherwise update it accordingly. Other options are for MySQL Database settings.
If you have successfully completed the setup, then you should be able to login using UserID : judge Password : aurora
STEP 6: Connecting Judge and Web UI
By default, Aurora is configured to look for the judge on 127.0.0.1:8723. If you installed aurora on one system and didn't change host and port configuration in judge.py, then it should automatically connect otherwise you should go to Admin > Judge Settings and update socket settings to point to judge.Optional: Load Balancing using multiple systems.
Aurora is designed to scale easily to load offered by a school/university on just one system. But in case your load is far more, you can replicate judge and web ui on different systems. For Web UI you can point your domain to multiple boxes where Web UI is installed.For Judge, however, you will need distributer.py present in the judge folder. It is a simple python script that distributes load to different judges installed. All you need to do is edit line #8 and #47 of distributer.py. Line #8 contains a list of tuples of host and port of various judges. And line #47 is the host and port of distributer. Finally, go Admin > Judge Settings on Web UI and update sockets settings to point to distributer.py.