Skip to content

hbatyrkhan/mycms

 
 

Repository files navigation

MyCMS

Ubuntu Python Django Celery

System for programming contests

  • Solutions run in a sandbox based on isolate
  • Problems are uploaded from Polygon through its integrated API

Installation

1. Download the repository

Note that since we are using isolate submodule you should add --recursive option to the regular cloning command

git clone --recursive https://github.com/Krauchman/mycms.git

Or, if you have already cloned the repository, just download the submodules by running

git submodule update --init

2. Install the dependencies

2.1. Python packages

To install python packages with pip:

pip3 install -r requirements.txt

It is recommended to use a virtual environment, since we are using specific versions of python packages.

2.2. RabbitMQ for Celery

We are using RabbitMQ as a task broker for Celery.

First, update your system:

sudo apt-get update
sudo apt-get upgrade

To install RabbitMQ on newer versions of Ubuntu (16.04, 18.04), run

apt-get install -y erlang
apt-get install rabbitmq-server

Next, enable and start rabbitmq-server:

systemctl enable rabbitmq-server
systemctl start rabbitmq-server

Check the status to make sure everything works

systemctl status rabbitmq-server

3. Configure Django Channels

We are using Channels for constant communication with the server.

To start a Redis server on port 6379, run the following command:

sudo docker run -p 6379:6379 -d redis:2.8

4. Configure isolate

4.1. Build isolate binary

To build the isolate submodule run the following command from inside its directory

make isolate

4.2. Configure environment

Run the following command to check some system settings

isolate-check-environment --execute

If --execute is not specified, the recommended actions are written to stdout as an executable shell script, otherwise, using --execute will attempt to make changes to make the system behave more deterministically. The changes performed by --execute persist only until a reboot. To persist across reboots, the standard output from this script should be added to /etc/rc.local or some other script that is run on each boot.


5. Migrate

Finally, do not forget to migrate

python3 manage.py migrate

Starting the development (!) server

To start the django development server

python3 manage.py runserver

You should also start a celery worker as a root (to be changed later) to run solutions and generate output for tests

sudo su
celery -A mycms worker -l info

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 83.2%
  • C++ 13.0%
  • JavaScript 2.7%
  • HTML 1.1%