Checkmate is a website constructed by teammate to organize puzzles during Mystery Hunt.
To start a server or to develop, you will need docker and docker-compose. On Ubuntu, you can install with sudo apt install docker.io docker-compose
.
After everything is set up, use the following to build the components and start the server.
You will need credentials in Discord and in Drive.
Drive:
- Create or select a project here.
- Enable the Drive API Instructions.
- Do the same for the Sheets API.
- Create a service account.
- Create a key and download the json to
credentials
. Rename or add the filename toSECRETS.yaml
. - Set up an OAuth 2 client application for Google.
- Use a "web" client type.
- Add users who should be able to give credentials to become the owner of puzzle sheets to the "Test users".
- Add the OAuth client id and secret to
SECRETS.yaml
.
Ensure the database is setup (choose a better password):
docker-compose build
mkdir frontend/node_modules
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
#docker-compose exec app /app/backend/manage.py makemigrations accounts checkmate structure
docker-compose exec app /app/backend/manage.py migrate
docker-compose exec app /app/backend/manage.py shell -c "from django.contrib.auth.models import User; User.objects.create_superuser('admin', password='admin')"
# or `docker-compose exec app /app/backend/manage.py createsuperuser --username admin --email ''` to prompt for password
docker-compose down
To run in dev
mode, run the following:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
Note that the checkmate-extension zip file is not created in dev mode but it exists (unzipped) in the repository. The build_extension
script for Firefox requires credentials for a Firefox developer account.
To run in prod
mode, run the following (replace docker-compose.prod.yml
with docker-compose.prod.localhost.yml
if running locally):
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
docker-compose exec app /app/build_static
# remove --sign if the current version of the firefox extension already exists
docker-compose exec app /app/build_extension --sign
docker-compose restart app
To test autocreating puzzles, use this command:
docker-compose exec -w /app/backend app celery -A checkmate call services.tasks.auto_create_new_puzzles
This will be a dry_run
by default and will print a task id. To check the result, use:
docker-compose exec -w /app/backend app celery -A checkmate result [TASK_ID]
or if there was an error:
docker-compose exec -w /app/backend app celery -A checkmate result --traceback [TASK_ID]
To migrate a postgres database between servers:
# on old server
docker-compose exec -u postgres postgres pg_dump postgres > dumpfile.dump
# on new server
docker-compose exec -T -u postgres postgres psql -U postgres < dumpfile.dump