-
Notifications
You must be signed in to change notification settings - Fork 164
Creating Your OpenBench Instance
I would highly recommend forking AndyGrant/OpenBench before proceeding with any additional steps. There are many reasons for this, and I'll lay them out now to convince you to go to the trouble to fork.
-
The biggest reason is you'll be acquiring local changes to your openbench instance. This is because there is a file, called
Config/config.json
. You'll need to add your engine to this file, and perhaps you'll want to change additional settings. You'll also need to edit your secret key inOpenSite/settings.py
, which will be another local change. -
Secondly, in
Config/config.json
, you configure the ref (branch, tag, or commit), and the repo which your workers will use. If you rely on my repo, then when I push a change toAndyGrant/OpenBench
which increments the version ( ie, breaks something and thus needs a new version ), then your server will also break. Your server won't be fixed until you pull the latest. This is because your workers will be pulling a newer version than the server expects. -
Thirdly, OpenBench provides a standard set of rules to be interoperable with any UCI engine. Some people are lazy, and opt to modify OpenBench to match their engine, instead of the other way around. A proper fork might allow you to handle rebasing upstream commits still.
The following instructions assume some typical Linux version. They should work just as well on Windows, given small modifications. In this example, I am using miniconda to manage the python versions. The OpenBench server requires at least python3.9, and the client requires at least python3.6. The specific versions of packages defined in requirements.txt
are not entirely critical.
$ git clone https://github.com/<Your Fork>/OpenBench
$ cd OpenBench
# Install requirements via pip, using a python3.10 venv
$ conda create --name py-ob python=3.10 -y
$ conda activate py-ob
$ pip3 install -r requirements.txt
# Creates the database, and an initial migration
$ python3 manage.py makemigrations OpenBench
$ python3 manage.py migrate
# Creates the superuser. This is is for dealing with the Admin pages, not for general use.
$ python3 manage.py createsuperuser
# Run the server and check it out at http://localhost:8000/
$ python3 manage.py runserver
Next, you need to create an OpenBench account. To do this, go the the registration page. The account you create here will be the account you use to interact with OpenBench. After you've created the account, you'll need to set the permissions for the account, by logging into the Admin panel, using the superuser credentials. You'll click on the "Users" text, click on the account you just created, and check the Staff status
and Superuser status
fields before saving.
Next, we'll enable this OpenBench account, by using the django-shell. This provides an introduction into how to interact with the database from the command line. The same can be achieved by clicking on the "Profiles" text on the home page of the Admin panel. The instructions below will set the enabled, and the approver fields. The enabled flag allows your account to meaningfully interact with the website. The approver field grants you the ability to approve tests from other users, as well as manage the Networks on the website.
$ python3 manage.py shell
>>>
>>> from OpenBench.models import Profile
>>> p = Profile.objects.get(user__username='Andrew')
>>> p.enabled = p.approver = True
>>> p.save()