Skip to content
AndresFelipeCastellanos edited this page May 13, 2021 · 14 revisions

Install and deploy UNCode

In this section you will see how to deploy UNCode on a server to start grading your courses, as well as setting up the development environment to start contributing to the project.

Deploy on your own server

To deploy UNCode on your own server and start supporting your courses with the automatic grader, please refer to the Deployment repository, where you will find all the updated documentation and the steps to follow.

Setup development environment

Supported platforms

UNCode is intended to run on Linux (kernel 3.10+), also, throughout this guide, we will show the steps to install UNCode and the different required services.

Note: This guide is focused for ubuntu users. In case your Linux distribution is other, check the correct way to install the different dependencies.

Guide

  1. Install the following dependencies:

    Run the next command to install some additional dependencies that include git, gcc, tidy, python3-dev and libzmq.

    sudo apt-get install git gcc tidy python3-dev libzmq-dev

    For other linux distributions, check the INGInious documentation.

  2. Install Node JS as it is necessary for some plugins and features.

    curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -
    sudo apt-get install -y nodejs
  3. Install the Python modules for UNCode:

    As UNCode is developed in Python, we recommend to use a Python Virtual Environment, which isolates the python environment and the different python dependencies, that way, they do not interact with the environment installed in your machine.

    • Install virtualenv:

      sudo apt-get install python-virtualenv
    • Create a virtualenv with virtualenv -p python3 <virtualenv_name>.

    • Activate the virtualenv with source env_name/bin/activate

    • Install the UNCode dependencies, with the environment active.

      pip3 install --upgrade git+https://github.com/JuezUN/INGInious.git
  4. The main repository of UNCode is: https://github.com/JuezUN/INGInious, it contains all the frontend and backend code. Thus, it most be cloned as it will be pretty much the place where most of changes are done. Clone the UNCode repository in a separate folder of the environment:

    git clone https://github.com/JuezUN/INGInious.git
  5. Create a task and backup folder, this is optional of where you set them, we recommend you do this in the same directory where you are working at. This folders are necessary for UNCode, where the tasks file system is stored.

    mkdir tasks
    mkdir backup
  6. Create a configuration.yaml file inside the previously cloned repository. This file specifies which plugins will run when the UNCode starts, as well as some general settings. To understand more the different settings, see the configuration reference. Here is a template you can use with the used plugins, although, notice it might not be up to date, as there might new plugins or introduced settings. For that, check the configuration reference previously mentioned as it is up to date.

    backend: local
    backup_directory: <backup_path> # For example ../backup/
    local-config:
        tmp_dir: <tmp_directoy_path> # For example /tmp
        concurrency: 1 # Equal to the number of cores
    log_level: WARNING # You can set also INFO or DEBUG
    smtp:
        sendername: <sender_email>
        host: smtp.gmail.com
        port: 587
        username: <your_user_name>
        password: <your_user_password>
        starttls: true
    mongo_opt:
        database: UNCode
        host: localhost
    superadmins:
    - superadmin # Add the superadmins' usernames you create on DB
    tasks_directory: <tasks_path> # For example ../tasks
    use_minified_js: true
    plugins:
      - plugin_module: inginious.frontend.plugins.statistics
      - plugin_module: inginious.frontend.plugins.multilang
        linter_url: "http://localhost:4567"
        python_tutor_url: "http://localhost:8003"
        use_wavedrom: True
      - plugin_module: inginious.frontend.plugins.grader_generator
      - plugin_module: inginious.frontend.plugins.UN_template
      - plugin_module: inginious.frontend.plugins.problem_bank
      - plugin_module: inginious.frontend.plugins.UNCode
        used_grading_environments: ["multiple_languages", "HDL", "Data Science", "Notebook"] # Add others you think you'll need
        used_subproblem_types: ["code_multiple_languages", "code_file_multiple_languages", "notebook_file"] # Add others you think you'll need
      - plugin_module: inginious.frontend.plugins.register_students
      - plugin_module: inginious.frontend.plugins.auth.google_auth
        id: "google_auth"
        client_id: "<your_google_secret_id>"
        client_secret: "<your_google_secret_key>"
      - plugin_module: inginious.frontend.plugins.task_cache
      - plugin_module: inginious.frontend.plugins.plagiarism
      - plugin_module: inginious.frontend.plugins.code_preview
      - plugin_module: inginious.frontend.plugins.analytics
      - plugin_module: inginious.frontend.plugins.task_editorial
      - plugin_module: inginious.frontend.plugins.task_hints
  7. We already provide some sample tasks setup to use the different grading environments. Download the sample course and uncompress the file inside the tasks folder.

  8. You are almost done, but before you can start using locally UNCode, you have to insert a user to get around the application. Thus, the superadmin user is added manually in DB. Run next commands the user superadmi with the password superadmin as well. Feel free to change this if you want to.

    mongo UNCode # Start the mongo shell and use the UNCode DB
    db.users.insert({
        "username" : "superadmin",
        "realname" : "superadmin",
        "language" : "en",
        "password" : "964a5502faec7a27f63ab5f7bddbe1bd8a685616a90ffcba633b5ad404569bd8fed4693cc00474a4881f636f3831a3e5a36bda049c568a89cfe54b1285b0c13e",
        "email"    : "superadmin@inginous.org",
        "bindings" : {
        }
    }) # Insert a superadmin called 'superadmin' and 'superadmin' as username and password. The password is coded in sha-512.
  9. If you have read the introduction of the wiki, you may have noticed that UNCode grades the student's submission via Docker containers. Thus, you have to download the corresponding images to be able to grade the submissions. Run the next commands:

    sudo docker pull unjudge/inginious-c-base
    sudo docker pull unjudge/inginious-c-default
    sudo docker pull unjudge/uncode-c-base
    sudo docker pull unjudge/inginious-c-multilang
    sudo docker pull unjudge/inginious-c-datascience
    sudo docker pull unjudge/hdl-uncode
    sudo docker pull unjudge/inginious-c-notebook
    
    sudo docker tag unjudge/inginious-c-base ingi/inginious-c-base
    sudo docker tag unjudge/inginious-c-default ingi/inginious-c-default
    sudo docker tag unjudge/inginious-c-multilang ingi/inginious-c-multilang
    sudo docker tag unjudge/inginious-c-datascience ingi/inginious-c-datascience
    sudo docker tag unjudge/hdl-uncode ingi/hdl-uncode
    sudo docker tag unjudge/inginious-c-notebook ingi/inginious-c-notebook
  10. Finally, you are able to start UNCode. Remember that the virtualenv you previously created must be active. Run the next command inside the cloned repository

./inginious-webapp

After that, if everything went right, you should be able to open UNCode in http://localhost:8080. Now you can login with the superadmin user you previously created.

  1. (OPTIONAL) In case you want to also setup the linter and python tutor containers, follow this instructions:

    • Outside the repository, create a docker-compose.yml with the next content:

      version: "3"
      services:
        linter-service:
          image: unjudge/linter-web-service
          ports:
            - 4567:4567
          restart: always
        python-tutor:
          image: unjudge/onlinepythontutor
          environment:
            - COKAPI_ENDPOINT=uncode.unal.edu.co/cokapi
            - PY_CMD=python3
          ports:
            - 8003:8003
          restart: always
      
    • Run the docker compose to pull the images and run the services:

      docker-compose up -d

      Now, when you do try to solve a coding task, it will run the linter and python tutor.

You are now all set. Start getting around UNCode and we look forward for you contributions!

Do not forget to check the developer's documentation with further details on how to start contributing.

Clone this wiki locally