Programming contest platform
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
coding
data
malvo
mcqs
scores
teams
.bowerrc
.gitignore
Dockerfile
LICENSE
Procfile
README.md
app.json
bower.json
docker-compose.dev.yml
docker-compose.prod.yml
docker-compose.yml
docker-entrypoint.sh
manage.py
package.json
requirements.txt
runtime.txt

README.md

malvo

Programming Contest Platform

Table of contents

Installation

Get yourself a local copy of the repo.

git clone https://github.com/shivamMg/malvo
cd malvo

Docker

Docker can be used for both development and production. You're going to need Docker and Docker Compose.

  1. Create data/conf/secrets.json file. It should contain the following (for example):
{
  "secret_key": "some-secret-key",
  "db_name": "malvo",
  "db_user": "malvo",
  "db_host": "db",
  "db_password": "your-psql-user-password",
  "allowed_hosts": [
    "127.0.0.1",
    "localhost"
  ],
  "mcqs_duration": 60,
  "coding_duration": 180
}
  1. Create data/conf/db.env with the following:
POSTGRES_DB=malvo
POSTGRES_USER=malvo
POSTGRES_PASSWORD=your-psql-user-password
  1. Create data/conf/app.env with the following:
MALVO_ADMIN_PASSWORD=your-admin-team-password
  1. For Local development run:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up

Or, for Production deployment run:

docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
  1. Server should be running at localhost:8000. Logs for Nginx, Gunicorn and Postgres will be collected in data/logs/. data/db will contain Postgres DB data.

Simple Installation

Local Development

  1. Create a virtualenv instance and activate it.
virtualenv -p `which python3` venv
source venv/bin/activate
  1. Setup Postgres database. Before installing psycopg2 package from requirements you might need to install libpq-dev and python3-dev.
sudo apt-get install libpq-dev python3-dev
# Install postgres server and client if you haven't already
sudo apt-get install postgresql-9.4 postgresql-client-9.4

Create a postgres user and database.

sudo -i -u postgres
createuser -P -s malvo
createdb malvo
  1. Install dependencies.
pip install -r requirements.txt
bower install
  1. Add a secrets.json file inside data/conf. Edit it as explained in Docker installation above, and make sure to change db_host to localhost from db.

  2. Migrate and create a superuser.

./manage.py migrate
./manage.py createsuperuser
  1. Run server.
./manage.py runserver

Production Deployment

Collect all the static files inside data/static_root:

./manage.py collectstatic

You can serve them through a proxy server.

Start application through gunicorn.

gunicorn malvo.wsgi:application --name malvo --bind 0.0.0.0:8000 --workers 3

Heroku

heroku create
heroku buildpacks:set heroku/python
heroku buildpacks:add --index 1 heroku/nodejs
heroku config:set MALVO_PLATFORM='heroku'
git push heroku master
heroku run python manage.py migrate

Screenshots

Credits

data/wait-for-it.sh has been taken from (unmodified) vishnubob/wait-for-it.

License

Please refer to the LICENSE file.