Skip to content
VirtualDiegox edited this page Nov 4, 2022 · 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 mongoDB v3.4 or grater but lower to 4 Official site here

    Downloading a mongoDB version previous to 4 might be slightly more complicated. The next commandsmay serve as an example for installing mongoDB 3.6.23 in Ubuntu 16.04 LTS.

    wget -qO - https://www.mongodb.org/static/pgp/server-3.6.asc | sudo apt-key add -
    echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
    sudo apt-get update
    sudo apt-get install -y mongodb-org=3.6.23 mongodb-org-server=3.6.23 mongodb-org-shell=3.6.23 mongodb-org-mongos=3.6.23 mongodb-org-tools=3.6.23

    As stated in the official documentation, apt-get might later try to update mongo and its dependencies to newer versions. To prevent this, the next commands can be run:

    echo "mongodb-org hold" | sudo dpkg --set-selections
    echo "mongodb-org-server hold" | sudo dpkg --set-selections
    echo "mongodb-org-shell hold" | sudo dpkg --set-selections
    echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
    echo "mongodb-org-tools hold" | sudo dpkg --set-selections

    To check mongoDB is working, first start the service:

    sudo systemctl start mongod

    In case "Failed to start mongod.service: Unit mongod.service not found" run

    sudo systemctl daemon-reload

    and then try restarting the service once again.

    After no error message is returned, check the status of the service:

    sudo systemctl status mongod

    Finally, start a mongo shell:

    mongo

. 3. 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

NodeJS 10.0 can also be installed through NVM to make it easier>

sudo apt-get update -y
sudo apt-get install build-essential libssl-dev -y
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
source ~/.profile
nvm --version
nvm install 10.0 --lts
node --version
  1. 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

    • In order to use the compatible versions of the dependencies with python 3.5, ensure that the default libs of virtualenv support wheel 0.37.1 and setuptools 50.3.2, the last versions of this packages compatible with python 3.5:

      pip3 install wheel==0.37.1 setuptools==50.3.2 --no-cache
    • Install the UNCode dependencies, with the environment active.

      pip3 install --upgrade git+https://github.com/JuezUN/INGInious.git --no-cache
  2. 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
  3. 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
  4. 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
      - plugin_module: inginious.frontend.plugins.manual_scoring
      - plugin_module: inginious.frontend.plugins.contact_page
        slack_url_contact_channel: <main_channel_webhook_url>
        slack_url_course_creation_channel: <course_creation_channel_webhook_url>
      - plugin_module: inginious.frontend.plugins.course_creation
      - plugin_module: inginious.frontend.plugins.user_management
      - plugin_module: inginious.frontend.plugins.lti_register
  5. We already provide some sample tasks to show how the different grading environments are used. Download the sample course and uncompress the file inside the tasks folder.

  6. 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 superadmin 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.
  7. If you have read the introduction ofs 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
  1. 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 these 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