Skip to content

Commit

Permalink
(no-ticket) Added better documentation for oioioi-easy-install and
Browse files Browse the repository at this point in the history
docker integration.

Change-Id: Ia10c84d4aef494102b3e714c44b0df66baae6367
  • Loading branch information
arturpragacz committed Jun 23, 2020
1 parent e4dc9b9 commit 0797c1f
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 16 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
/.github
/extra/
/test*
!/test_report.css
/*.rst
/rst/
57 changes: 51 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,41 @@ main component — the web interface.
Installation
------------

Easy Installer
~~~~~~~~~~~~~~~~~~~~~~~~~

You can easily install and run oioioi out of the box with oioioi_easy_installer.
Just download the oioioi_easy_installer archive, unpack it and run::

./oioioi.sh install

to install oioioi. Then you can run::

./oioioi.sh start
./oioioi.sh stop

to start and stop oioioi.

Make sure to change default superuser password. To do that:
1. Login to the superuser with default credentials (username:admin, password:admin).
2. Click username ("admin") in upper-right corner of the webpage.
3. Click "Change password".
4. Fill and submit password change form.

You can also update your oioioi instance by typing::

./oioioi.sh update

Docker (for deployment)
~~~~~~~~~~~~~~~~~~~~~~~

Additionally, there are available docker files to create images containing our services. We do not recommend this method of running OIOIOI. Please inspect Docker files and startup scripts before using in production.
The easy installer method above uses Docker under the hood. Additionally, you can manually use docker files to create images containing our services.

To run the infrastructure simply::

"OIOIOI_CONFIGDIR=<config directory>" "OIOIOI_VERSION=<oioioi_version>" docker-compose up

Make sure to change default superuser password. To do that:
1. Login to the superuser with default credentials (username:admin, password:admin)
2. Click username ("admin") in upper-right corner of the webpage.
3. Click "Change password"
4. Fill and submit password change form
Make sure to change default superuser password, same as in the automatic method.

To start additional number of workers::

Expand All @@ -31,6 +52,30 @@ as described `in Docker docs`_.

.. _in Docker docs: https://docs.docker.com/compose/reference/up/

Docker (for development)
~~~~~~~~~~~~~~~~~~~~~~~

First prepare the image with::

OIOIOI_UID=$(id -u) docker-compose -f docker-compose-dev.yml -f extra/docker/docker-compose-dev-noserver.yml build

Then you can start oioioi with::

OIOIOI_UID=$(id -u) docker-compose -f docker-compose-dev.yml -f extra/docker/docker-compose-dev-noserver.yml up
OIOIOI_UID=$(id -u) docker-compose -f docker-compose-dev.yml -f extra/docker/docker-compose-dev-noserver.yml exec web python manage.py runserver

to start the infrastructure in the development mode. Current dirrectory with the source code will be bound to /sio2/oioioi/ inside the running container.

oioioi web interface will be available at localhost:8000, and the user admin with password admin will be created.

Additionally you can bind config files and logs folder to the host::

id=$(docker create oioioi-dev) #Create oioioi container
docker cp $id:/sio2/deployment deployment #Copy initial deployment folder from oioioi contanier
docker rm -v $id #Remove unneeded container

Remember to also uncomment the appropriate volume binding in the web service description in the docker-compose-dev.yml.

Manual installation
~~~~~~~~~~~~~~~~~~~

Expand Down
8 changes: 4 additions & 4 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
stop_grace_period: 1m
web:
image: sio2project/oioioi-dev
command: ["/sio2/oioioi/oioioi_init.sh"]
command: ["/sio2/oioioi/selenium_init.sh"]
build:
context: .
dockerfile: Dockerfile
Expand All @@ -23,8 +23,8 @@ services:
ports:
- "8000:8000"
volumes:
- $PWD:/sio2/oioioi
- $PWD/deployment:/sio2/deployment
- .:/sio2/oioioi
# - ./deployment:/sio2/deployment
stop_grace_period: 3m
depends_on:
- db
Expand All @@ -33,7 +33,7 @@ services:
image: sio2project/oioioi-dev
command: ["/sio2/oioioi/worker_init.sh"]
volumes:
- $PWD:/sio2/oioioi
- .:/sio2/oioioi
stop_grace_period: 1m
cap_add:
- ALL
Expand Down
7 changes: 7 additions & 0 deletions extra/docker/docker-compose-dev-noserver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '2.4'
# https://github.com/docker/cli/issues/1293
services:
web:
volumes:
- ./extra/sample-configs/basic_settings_noserver.py:/sio2/deployment/basic_settings.py

2 changes: 2 additions & 0 deletions extra/sample-configs/basic_settings_noserver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SERVER = None
DEBUG = True
8 changes: 2 additions & 6 deletions oioioi/deployment/settings.py.template
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,8 @@ SEND_USER_ACTIVATION_EMAIL = False
#
# Some features may depend on this setting, e.g. the "portals" app requires
# that either the "neutral" or the "contest_if_possible" option is picked.
#
# The default setting is "contest_if_possible".
# To access the contest mode setting you also have to uncomment
# the following import line.
#from oioioi.contests.current_contest import ContestMode
#CONTEST_MODE =
from oioioi.contests.current_contest import ContestMode
CONTEST_MODE = ContestMode.neutral

# RabbitMQ server URL for distributed workers.
#
Expand Down
1 change: 1 addition & 0 deletions oioioi/deployment/supervisord.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ stderr_logfile={{ PROJECT_DIR }}/logs/uwsgi-err.log

[program:django-http]
command={{ PYTHON }} {{ PROJECT_DIR }}//manage.py runserver 0.0.0.0:8000
stopasgroup=true
stdout_logfile={{ PROJECT_DIR }}/logs/runserver.log
stderr_logfile={{ PROJECT_DIR }}/logs/runserver-err.log
{% if settings.SERVER != 'django' %}exclude=true{% endif %}
Expand Down

0 comments on commit 0797c1f

Please sign in to comment.