Skip to content

Commit cba8dbb

Browse files
authored
Setup celery before setting up database (VNOI-Admin#2)
- Setup celery before setting up database - Added useful notes and docker hub link to tiervnoj
1 parent ed88cbf commit cba8dbb

2 files changed

Lines changed: 25 additions & 16 deletions

File tree

docs/judge/setting_up_a_judge.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ may give you more control at the expense of more administrative complexity.
3838

3939
### With Docker
4040

41+
#### Pre-built
42+
4143
We maintain Docker images with all runtimes we support in the
4244
[runtimes-docker](https://github.com/DMOJ/runtimes-docker) project.
4345

@@ -49,6 +51,9 @@ and tested every week to contain the latest runtime versions.
4951

5052
?> VNOJ uses a custom tier, `tiervnoj`, which contains all the runtimes in Tier 1
5153
and some additional ones. You can find the list of supported runtimes [here](https://oj.vnoi.info/runtimes).
54+
The Docker image is maintained at [vnoj/judge-tiervnoj](https://hub.docker.com/r/vnoj/judge-tiervnoj).
55+
56+
#### From source
5257

5358
The session below build a `judge-tiervnoj`:
5459

@@ -62,6 +67,10 @@ The session below spawns a `tiervnoj` judge image in the same server as the site
6267
**It expects problems to be placed on the host under `/mnt/problems`, and judge-specific
6368
configuration to be in `/mnt/problems/judge.yml`.**
6469

70+
?> For first time developers: Both the judge and site can share a common problems folder,
71+
which is specified at `DMOJ_PROBLEM_DATA_ROOT` in `settings.py` for the site and as below
72+
for the judge.
73+
6574
Your `judge.yml` file should look something like below:
6675

6776
```yaml

docs/site/installation.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
```shell-session
66
$ apt update
7-
$ apt install git gcc g++ make python3-dev python3-pip libxml2-dev libxslt1-dev zlib1g-dev gettext curl redis-server
7+
$ apt install git gcc g++ make python3-dev python3-pip python3-venv libxml2-dev libxslt1-dev zlib1g-dev gettext curl redis-server pkg-config
88
$ curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
99
$ apt install nodejs
1010
```
@@ -61,7 +61,7 @@ Install Node.js packages:
6161
(vnojsite) $ npm install
6262
```
6363

64-
You will now need to configure `dmoj/local_settings.py`. You should make a copy of [this sample settings file](https://github.com/DMOJ/docs/blob/master/sample_files/local_settings.py) and read through it, making changes as necessary. Most importantly, you will want to update MariaDB credentials.
64+
You will now need to configure `dmoj/local_settings.py`. You should make a copy of [this sample settings file](https://github.com/VNOI-Admin/vnoj-docs/blob/master/sample_files/local_settings.py) and read through it, making changes as necessary. Most importantly, you will want to update MariaDB credentials.
6565

6666
?> Leave debug mode on for now; we'll disable it later after we've verified that the site works. <br> <br>
6767
Generally, it's recommended that you add your settings in `dmoj/local_settings.py` rather than modifying `dmoj/settings.py` directly. `settings.py` will automatically read `local_settings.py` and load it, so write your configuration there.
@@ -87,6 +87,20 @@ You will also need to generate internationalization files.
8787
(vnojsite) $ ./manage.py compilejsi18n
8888
```
8989

90+
## Setting up Celery
91+
92+
The VNOJ uses Celery workers to perform most of its heavy lifting, such as batch rescoring submissions. We will use Redis as its broker, though note that other brokers that Celery supports will work as well.
93+
94+
Start up the Redis server, which is needed by the Celery workers.
95+
96+
```shell-session
97+
$ service redis-server start
98+
```
99+
100+
Configure `local_settings.py` by uncommenting `CELERY_BROKER_URL` and `CELERY_RESULT_BACKEND`. By default, Redis listens on localhost port 6379, which is reflected in `local_settings.py`. You will need to update the addresses if you changed Redis's settings.
101+
102+
We will test that Celery works soon.
103+
90104
## Setting up database tables
91105

92106
We must generate the schema for the database, since it is currently empty.
@@ -112,20 +126,6 @@ You should create an admin account with which to log in initially.
112126
(vnojsite) $ ./manage.py createsuperuser
113127
```
114128

115-
## Setting up Celery
116-
117-
The VNOJ uses Celery workers to perform most of its heavy lifting, such as batch rescoring submissions. We will use Redis as its broker, though note that other brokers that Celery supports will work as well.
118-
119-
Start up the Redis server, which is needed by the Celery workers.
120-
121-
```shell-session
122-
$ service redis-server start
123-
```
124-
125-
Configure `local_settings.py` by uncommenting `CELERY_BROKER_URL` and `CELERY_RESULT_BACKEND`. By default, Redis listens on localhost port 6379, which is reflected in `local_settings.py`. You will need to update the addresses if you changed Redis's settings.
126-
127-
We will test that Celery works soon.
128-
129129
## Running the server
130130

131131
Now, you should verify that everything is going according to plan.

0 commit comments

Comments
 (0)