jahentao / voj

Cross-platform online judge system based on Spring MVC framework and ActiveMQ.

Home Page:https://verwandlung.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Verwandlung Online Judge

Version: 0.1.0

Build Status Build status Coverage Status

Official Website | Tech Support | Change Log


Introduction

Cross-platform online judge system based on Spring MVC Framework.

The application used following open-source projects:

The Origin of Verwandlung

In 2011, the LinkedIn Inc. published a message queue product called Kafka. It's implemented in Scala and open-sourced.

In 2012, Alibaba Inc. published a message queue product called MetaQ, which is based on Kafka. It's implemented in Java.

MetaQ stands for Metamorphosis, which is a famous literature written by the author Franz Kafka.

As the message queue is one of the important components in the application, so I named the application Verwandlung, which is the German name of Metamorphosis.

Architecture

The application contains two modules:

  • Web Application
  • Cross-Platform Judger

As you see, the Online Judge System can contain multiple judgers. The judgers communicate with the web application via message queue.


Getting Started

System Requirements

Hardware Requirements

  • CPU: 2.0 GHz or faster 32-bit (x86) or 64-bit (x64) processor

For Web Application (including Database and Message Queue):

  • RAM: 2.0 GB RAM on Windows, 1.0 GB RAM on Linux.

For Judger:

  • RAM: 1.0 GB RAM on Windows, 512 MB RAM on Linux.

Software Requirements

For Web Application (including Database and Message Queue):

  • Operating System: Windows, Linux or Mac
  • Database: MySQL 5.5+ or MariaDB 5.5+
  • Java Runtime: JRE 1.8+ or JDK 1.8+
  • Message Queue: ActiveMQ 5.11+
  • Web Server: Tomcat 8.5+

For Judger:

  • Operating System: Windows or Linux
  • Java Runtime: JRE 1.8+ or JDK 1.8+

Installation

Binary Releases

  • Web Application: 0.1.0
  • Judger (Windows, 64 Bit): 0.1.0
  • Judger (Linux, 64 Bit): 0.1.0

Source Releases

NOTE:

  • Maven 3+ and GCC 4.8+ with POSIX thread model is required.
  • Make sure add the Maven and GCC to the PATH.

After extracting the source, run these commands from a terminal:

For Web Application:

cd web
mvn package -DskipTests

The terminal will return message as following:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.168 s
[INFO] Finished at: 2015-11-26T13:20:09+08:00
[INFO] Final Memory: 24M/210M
[INFO] ------------------------------------------------------------------------

And you'll get a package named voj.web.war in the target folder.

For Judger:

Windows:

cd %JAVA_HOME%\include\win32
copy jawt_md.h  ..
copy jni_md.h  ..

cd judger
mvn package -DskipTests

Linux:

cd $JAVA_HOME/include/linux
cp jawt_md.h jni_md.h ..

cd SOURCE_CODE_PATH/judger
mvn package -DskipTests

The terminal will return message as following:

[INFO] Executing tasks

jni:
     [echo] Generating JNI headers
     [exec] Cannot find type 'org.springframework.beans.factory.annotation.Value' ...
     [exec] Cannot find type 'org.springframework.beans.factory.annotation.Value' ...
     [exec] mkdir -p target/cpp
     [exec] g++ -c -std=c++11 -Wall -fPIC -I ... -o target/cpp/Judger.Core.Runner.o
[INFO] Executed tasks
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.432 s
[INFO] Finished at: 2015-11-26T13:22:46+08:00
[INFO] Final Memory: 81M/513M
[INFO] ------------------------------------------------------------------------

And you'll get a package named voj.judger.jar in the target folder.

Configuration

Setup the ActiveMQ

To reduce the memory of ActiveMQ, you can edit activemq.xml in ACTIVEMQ_HOME\conf.

Please find following content in this file, and change it to proper values that suitable for your servers.

<systemUsage>
    <systemUsage>
        <memoryUsage>
            <!-- Change this value -->
            <memoryUsage limit="128 mb" />
        </memoryUsage>
        <storeUsage>
            <!-- Change this value -->
            <storeUsage limit="4 gb"/>
        </storeUsage>
        <tempUsage>
            <!-- Change this value -->
            <tempUsage limit="4 gb"/>
        </tempUsage>
    </systemUsage>
</systemUsage>

Setup the Web Application

Create a database in MySQL, import voj.sql.

Edit the values in /WEB-INF/classes/voj.properties of the file voj.web.war.

You can open it with archive manager software such as WinRAR.

After then, you can copy this file voj.web.war to TOMCAT_HOME/webapps.

IMPORTANT: For Windows users, please edit server.xml of your Tomcat configuration:

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1"
    redirectPort="8443" useBodyEncodingForURI="true">
</Connector>

Setup the Judger

Edit the values in /voj.properties of the file voj.judger.jar.

You can run the judger using following command:

javaw -jar voj.judger.jar

Important:

If you are using Linux, please run following commands using root:

# Shutdown and Kill process is not allowed for non-root user
chmod 700 /sbin/init
chmod 700 /sbin/poweroff
chmod 700 /usr/bin/pkill

Contribution

We're glad that you want to improve this project.

  • We NEED TRANSLATORS for multi-language support(English and Chinese have supported).
  • You can report bugs here.
  • You can also create a pull request if you can fix the bug.
  • If you want to add features to the project, please tell us in the issues page before developing.

Thanks for your corporation.

License

This project is open sourced under GNU GPL v3.

About

Cross-platform online judge system based on Spring MVC framework and ActiveMQ.

https://verwandlung.org

License:GNU General Public License v3.0


Languages

Language:Java 91.0%Language:CSS 6.4%Language:C++ 2.2%Language:FreeMarker 0.2%Language:JavaScript 0.1%Language:Makefile 0.1%