GithubHelp home page GithubHelp logo

tjumyk / submit Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 3.99 MB

Submissions system with automatic testing pipeline

JavaScript 0.17% TypeScript 28.13% HTML 22.97% CSS 0.10% Python 44.80% Less 3.83%

submit's Introduction

Submission System

Requirements

  1. nodejs
  2. postgresql
  3. rabbitmq
  4. redis
  5. msmtp-mta (for sending e-mails, also need to setup an smtp provider in /etc/msmtprc, e.g. Setup Aliyun DirectMail)
  6. auth system (other oauth providers like GitLab are also possible)

Setup

  1. prepare git repo
git submodule init
git submodule update
  1. prepare python environment
# prepare a python virtual environment first
pip install -r requirements.txt
  1. build front-end

For node version >= 17:

cd angular
npm i
NODE_OPTIONS=--openssl-legacy-provider npm run build
cd ..

For node version < 17:

cd angular
npm i
npm run build
cd ..
  1. setup database
createuser submit -P
# put a new password when prompt

createdb submit -O submit
  1. build email templates
cd mail_templates/mjml
npm i
npm run build
cd ../..

Register client in auth system

  1. Access <auth-system-url>/admin/oauth/clients/new
  2. Input details of submit app. The Redirect URL should be <submit-system-url>/oauth-callback.
  3. Click 'Add' button
  4. Click 'Download Client Configuration File' button to download the oauth config file, put it in project root.

Configuration

cp config.example.json config.json
# edit config.json

Edit config.json

  1. Update SECRET_KEY with a good random string, e.g. using the following script to generate one:
python3 -c 'import secrets; print(secrets.token_urlsafe(8))'
  1. Update SQLALCHEMY_DATABASE_URI with a postgresql db connection url, postgresql://submit:[email protected]:5432/submit. (replace PASSWORD with real password)
  2. Delete SYNC_WORKER
  3. Edit SITE and MAIL according to real setup
  4. Delete broker_use_ssl in AUTO_TEST

Initialization

export PYTHONPATH="$PWD:$PWD/submit-testbot"
export FLASK_APP=server.py
flask create-db
flask init-db
flask init-email-subscriptions

Run

before run

The following environment variables are required to run the following servers

export PYTHONPATH="$PWD:$PWD/submit-testbot"
export FLASK_APP=server.py

Run main server

flask run -p 8888

Run period-worker

python period_worker.py

Run meta-bot

celery -A testbot.bot worker -Q testbot_meta -l info -n 'metabot@%h' -c 1 

Run anti-plagiarism bot

First, need to start a server separately

python anti_plagiarism/api_server.py

Then, start the bot process

celery -A testbot.bot worker -Q testbot_anti_plagiarism -l info -n 'apbot@%h' -c 1 

For deployment in production environment, please refer to notes for auth system

Run test bot (possibly in a different server)

See testbot project

submit's People

Contributors

tjumyk avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.