Automated Installation Scripts

The automated installation scripts are the simplest way to install Doubtfire using Ubuntu as your fully-fledged development environment.

To begin, you will first need to clone the doubtfire-web, doubtfire-api, and doubtfire.io repositories. Before doing so, you should fork each of these repositories to your own Github account, to allow your own development and enable the creation of pull requests at a later stage. If you are using Ubuntu within a virtualized development environment, you should also consider taking a snapshot of your machine before you begin this process.

Once the repositories have been cloned to your local machine, in order, execute the setup.sh scripts located in each of the following directories:

  • doubtfire-api,
  • doubtfire-web, and
  • doubtfire.io.

It is not necessary to execute the setup scripts with sudo privileges, although you will be prompted for your password throughout stages of the setup. You may be prompted for information or to continue the installation at various stages throughout the installation; simply respond as required.


Manual Installation

Installing doubtfire-api

Getting Started

If you are a developer for the project, it is usually better to create a fork for the repository and then follow the steps given below.

First, clone the doubtfire-api repository to your local machine:

$ git clone <link>

Install rbenv and ruby-build

Install rbenv and ruby-build:

$ cd ~
$ git clone git://github.com/sstephenson/rbenv.git .rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ exec $SHELL

$ git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
$ exec $SHELL

Note: if you're using Oh-My-Zsh, add to your .zshrc:

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
$ echo 'eval "$(rbenv init -)"' >> ~/.zshrc
$ echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.zshrc

Now install Ruby v2.3.8:

$ sudo apt-get install -y libreadline-dev
$ rbenv install 2.3.8

Install Postgres

Install Postgres:

$ sudo apt-get install -y postgresql postgresql-contrib libpq-dev

$ sudo service postgresql restart

Ensure pg_config is on the PATH, and then login to Postgres. You will need to locate where apt-get has installed your Postgres binary and add this to your PATH. You can use whereis psql for that, but ensure you add the directory and not the executable to the path

$ whereis pqsl
/usr/bin/psql
$ export PATH=/usr/bin:$PATH
$ sudo -u postgres createuser --superuser $USER
$ sudo -u postgres createdb $USER
$ psql

Create the Doubfire user the following at the Postgres prompt:

CREATE ROLE itig WITH CREATEDB PASSWORD 'd872$dh' LOGIN;

Install native tools

Install imagemagick, libmagic and ghostscript. You will also need to install the Python pygments package:

sudo apt-get install -y ghostscript imagemagick libmagickwand-dev libmagic-dev python-pygments ffmpeg curl libreadline-dev gcc make libssl1.0-dev zlib1g-dev

Install Doubtfire API dependencies

Clone project and change your working directory to the api:

$ git clone https://github.com/doubtfire-lms/doubtfire-api.git
$ cd ./doubtfire-api

Set up overcommit and install hooks:

$ gem install overcommit -v 0.47.0
$ rbenv rehash
$ overcommit --install

Then install Doubtfire API dependencies using bundler:

$ gem install bundler -v 1.17.3
$ bundler install --without production replica staging
$ rbenv rehash
$ source ~/.bashrc

Create and populate Doubtfire

Whilst still in the Doubtfire API project root, execute:

$ bundle exec rake db:create

You can choose to populate the database with some fake test data using:

$ bundle exec rake db:populate

Install LaTeX to generate PDFs

sudo apt-get install texlive-full

Follow the Generating PDFs guide to assist with installing LaTeX to generate PDFs. This step is optional unless you wish to generate PDF submissions.

Installation of doubtfire-web

Getting Started

Before you get started, make sure you have the doubtfire-api up and running. You will need to do this before continuing.

Usually if you are the developer, its always better to create a fork and then follow the below steps. Firstly we need to clone the web repository to your local machine by selecting "clone or download" and copying the link. You can do this by using command below and change to the root directory:

$ git clone <link>
$ cd ./doubtfire-web

Install Node.js either by downloading it and installing it manually by using apt-get

$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
$ sudo apt-get install -y nodejs

Install overcommit and Ruby SASS:

$ gem install overcommit sass

If gem fails, you should read the Doubtfire API README doc to install ruby. If you are not using rbenv, e.g., using Docker instead, you may need to prefix sudo to the above commands to have root write access.

If using rbenv, rehash to ensure each of the gems are on your PATH:

$ rbenv rehash

Install and sign the git hooks using overcommit:

$ overcommit --install
$ overcommit --sign

Install all node dependencies using npm, as well as grunt-cli globally:

$ npm install

Note: You may need to install grunt-cli globally in Linux using sudo.

Lastly, to compile and run a watch server and web server, use npm start:

$ npm start

This will automatically run the angular 1 grunt watch, and the angular 9 ng serve.

You can then navigate to the Doubtfire web interface at http://localhost:8000.

Installation of Doubtfire.io

Clone the Doubtfire.io project and change the working directory into it via,

$ git clone https://github.com/doubtfire-lms/doubtfire.io.git

$ cd ./doubtfire.io

Then, follow the instructions in the "Getting Started" section of its CONTRIBUTING.md file to setup the project and its development environment, locally.