Programming Contest Platform
Get yourself a local copy of the repo.
git clone https://github.com/shivamMg/malvo
cd malvo
Docker can be used for both development and production. You're going to need Docker and Docker Compose.
- 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
}
- Create
data/conf/db.env
with the following:
POSTGRES_DB=malvo
POSTGRES_USER=malvo
POSTGRES_PASSWORD=your-psql-user-password
- Create
data/conf/app.env
with the following:
MALVO_ADMIN_PASSWORD=your-admin-team-password
- 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
- 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.
- Create a virtualenv instance and activate it.
virtualenv -p `which python3` venv
source venv/bin/activate
- Setup Postgres database. Before installing
psycopg2
package from requirements you might need to installlibpq-dev
andpython3-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
- Install dependencies.
pip install -r requirements.txt
bower install
-
Add a
secrets.json
file insidedata/conf
. Edit it as explained in Docker installation above, and make sure to changedb_host
tolocalhost
fromdb
. -
Migrate and create a superuser.
./manage.py migrate
./manage.py createsuperuser
- Run server.
./manage.py runserver
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 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
data/wait-for-it.sh
has been taken from (unmodified) vishnubob/wait-for-it.
Please refer to the LICENSE file.