Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Mar 21, 2020
2 parents fbb47eb + bfa2313 commit 4fd2c61
Show file tree
Hide file tree
Showing 124 changed files with 21,544 additions and 1,995 deletions.
15 changes: 15 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[run]
command_line =
manage.py test

source =
huntserver

omit =
*/tests/*
*/migrations/*

[paths]
source =
./huntserver
/code/huntserver
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker/
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 100
exclude = huntserver/migrations
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ db.sqlite3
setup.cfg
/cover/
.coverage
debug.log
debug.log
/docker/volumes/ssl-certs/
/docker/volumes/shib-certs/
/docker/volumes/redis_data/
/docker/volumes/logs/
*.env
45 changes: 26 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
language: python

python:
- 2.7
- 3.4
- 3.5
- 3.6

services:
- mysql
- docker

sudo: required

env:
- DJANGO=1.11.* DB=mysql

global:
- DB_NAME=puzzlehunt_db
- DB_USER=hunt
- DB_PASSWORD=test
- DJANGO_SECRET_KEY=test_secret_key
- DOCKER_COMPOSE_VERSION=1.23.2

before_install:
- export DJANGO_SETTINGS_MODULE="puzzlehunt_server.settings.travis_settings"
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin

install:
- pip install -q Django==$DJANGO
- pip install -r requirements.txt
- pip install coveralls
- pip freeze
- mkdir -p ./media/puzzles

before_script:
- mysql -e 'create database puzzlehunt_db;' -u root
- pip install coveralls flake8
- docker-compose build
- docker-compose up -d

script:
- python manage.py test
- docker-compose exec app coverage run
- docker-compose exec app coverage report
- flake8 huntserver

after_script:
- docker-compose stop
- docker-compose rm -f

after_success:
- cp .coverage .coverage.extra
- coverage combine
- coveralls
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.7

ENV PYTHONUNBUFFERED 1
ENV DJANGO_ENABLE_DEBUG False
ENV DJANGO_USE_SHIBBOLETH False
ENV DJANGO_SETTINGS_MODULE puzzlehunt_server.settings.env_settings

RUN mkdir /code
WORKDIR /code

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

COPY . .

EXPOSE 8000
CMD ["gunicorn", "--workers=5", "--bind=0.0.0.0:8000", "puzzlehunt_server.wsgi:application"]
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
[![Coverage Status](https://coveralls.io/repos/github/dlareau/puzzlehunt_server/badge.svg)](https://coveralls.io/github/dlareau/puzzlehunt_server)

# puzzlehunt_server
Server for Puzzlehunt CMU's bi-annual puzzlehunt. Includes basic features such as per-puzzle pages, automatic answer response, teams, customizable unlocking structure, and admin pages to manange submissions, teams, as well as hunt progress. It also includes automatic team creation from registration, privacy settings for hunts, cool charts, a built in chat, and automatic file fetching and hosting.
A server for running puzzlehunts. This project is mainly used by PuzzlehuntCMU to run their puzzlehunt, but is generic enough to be used for nearly any puzzlehunt. Includes basic features such as per-puzzle pages, automatic answer response, teams, customizable unlocking structure, and admin pages to manange submissions, teams, as well as hunt progress. It also includes automatic team creation from registration, privacy settings for hunts, cool charts, a built in chat, and automatic file fetching and hosting.

Documentation can be found at http://docs.puzzlehunt.club

While there is fairly large amount of configuration making this specific to Puzzlehunt CMU, if you are interested in getting this running elsewhere, let me know. I'd be happy to help anyone who wants to get this up and running for their needs.
If you are interested in getting this running elsewhere, let me (dlareau@cmu.edu) know. I'd be happy to help anyone who wants to get this up and running for their needs, and get help get you over any gaps in setup documentation.

Please submit issues for any bugs reports or feature requests.

### Super simple setup
If you just want to get started developing or want to stand up a simple test server and don't care about security, you can follow the following steps:
### Setup
This project now uses docker-compose as it's main form of setup. You can use the following steps to get a sample server up and going

1. Install [Virtualbox.](https://www.virtualbox.org/wiki/Downloads)
2. Install [Vagrant.](https://www.vagrantup.com/downloads.html)
3. Make a folder for the VM.
4. Clone this repository into that folder. (such that the folder you made now contains only one folder named "puzzlehunt_server")
5. Copy the Vagrantfile from the config folder within the puzzlehunt_server folder out into the folder that you made.
6. Run "vagrant up" from the folder you made and wait for it to complete.
7. You should now have the server running on a newly created VM, accessible via [http://localhost:8080](http://localhost:8080). The repository you cloned has been linked into the VM by vagrant, so any changes made to the repository on the host system should show up automatically. (A "vagrant reload" may be needed for some changes to take effect)
1. Install [docker/docker-compose.](https://docs.docker.com/compose/install/)
2. Clone this repository.
3. Make a copy of ```sample.env``` named ```.env``` (yes, it starts with a dot).
4. Edit the new ```.env``` file, filling in new values for the first block of uncommented lines. Other lines can be safely ignored as they only provide additional functionality.
5. Run ```docker-compose up``` (possibly prepending ```sudo``` if needed)
6. You should now have the server running on a newly created VM, accessible via [http://localhost](http://localhost). The repository you cloned has been linked into the VM by docker, so any changes made to the repository on the host system should show up automatically. (A ```docker-compose restart``` may be needed for some changes to take effect)
32 changes: 0 additions & 32 deletions config/Vagrantfile

This file was deleted.

61 changes: 61 additions & 0 deletions config/puzzlehunt_apache_ssl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# An apache configuration file meant to be paired with puzzlehunt_setup.sh
# Meant for quick developement. Does not do shibboleth or ssl.

Define hostname replacename

<VirtualHost *:80>
ServerName ${hostname}

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
Redirect / https://${hostname}/
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName ${hostname}

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

Alias /static /static
<Directory /static>
Require all granted
</Directory>

Alias /media /media
XSendFile On
XSendFilePath /media
<Directory /media>
Require all granted
</Directory>
<Directory /media/puzzles>
Require all denied
</Directory>

ProxyPass /static/ !
ProxyPass /media/ !

<IfModule mod_shib.c>
<Location /shib/>
AuthType Shibboleth
ShibRequireSession On
ShibApplicationId default
ShibExportAssertion On
require valid-user
</Location>

<Location /Shibboleth.sso>
Options +Indexes
SetHandler shib
</Location>

ProxyPass /Shibboleth.sso/ !
</IfModule>

ProxyPass / http://web:8000/
ProxyPreserveHost On

</VirtualHost>

</IfModule>
87 changes: 0 additions & 87 deletions config/puzzlehunt_cmu.conf

This file was deleted.

39 changes: 0 additions & 39 deletions config/puzzlehunt_generic.conf

This file was deleted.

0 comments on commit 4fd2c61

Please sign in to comment.