Peer-reviews-NLP: Set-Up: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
Line 28: Line 28:
* If the web service goes down and needs to be rebuilt, utilize the command "sudo docker-compose up --build"
* If the web service goes down and needs to be rebuilt, utilize the command "sudo docker-compose up --build"


==Alternative 2: Installation on Deployed CentOS (RedHat)
==Alternative 2: Installation on Deployed CentOS (RedHat)==
* Clone the public Github for the project
First, install yum and git.
* Install docker and docker-compose using the following command line code:
<pre>
<pre>
sudo yum install -y yum-utils
sudo yum install -y yum-utils
sudo yum install git
</pre>
Next, clone the git repo
<pre>
git clone https://github.com/Aeront39/Peer-reviews-NLP
</pre>
Then, navigate to within the downloaded directory, and perform the following commands:
<pre>
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io --allowerasing
sudo yum install docker-ce docker-ce-cli containerd.io --allowerasing
sudo dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
sudo curl -L https://github.com/docker/compose/releases/download/1.26.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/1.26.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo systemctl start docker
</pre>
Finally, run the following command to begin the webservice:
<pre>
sudo docker-compose up
</pre>
</pre>
==Alternative 3: Installation on Local Machine==
==Alternative 3: Installation on Local Machine==
* Clone the public Github for the project to your local machine. A link to the Github can be found [https://github.com/koushik1/Peer-reviews-NLP here].
* Clone the public Github for the project to your local machine. A link to the Github can be found [https://github.com/koushik1/Peer-reviews-NLP here].

Latest revision as of 00:59, 1 February 2022

Overview

The purpose of this page is to describe the steps necessary to set up and run the peer-reviews-NLP web service, as well as what is actually happening during those steps (should they need to change). This page will assume a reader who is familiar with Python programming, but not with any particular technical tool used for application or web service hosting (such as Docker, etc.)

To read more about the peer-review-NLP project, see the main page on the project here.

Two separate scenarios will be explained

Step-by-Step Installation

Two alternatives will be outlined for installation of the peer-review-NLP web service. The first will assume you are installing the web service onto a deployed Ubuntu environment, for the purposes of deploying the project for use on the Expertiza website. The second will assume you wish to run the webservice on your local machine for the sake of testing and development.

Alternative 1: Installation on Deployed Ubuntu

  • Clone the public Github for the project to the machine you are deploying to. A link to the Github can be found here.
  • Install Docker and Docker Compose onto the machine by running the following code:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo systemctl status docker
sudo curl -L https://github.com/docker/compose/releases/download/1.26.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Note: if the given code did not successfully install Docker, refer to the following official documentation for proper download instructions.

  • Check to make sure docker has been properly installed by using the command
    docker-compose --version
  • Navigate to the directory "~/Peer-reviews-NLP" and run "sudo docker-compose up" to start the web service
  • If the web service goes down and needs to be rebuilt, utilize the command "sudo docker-compose up --build"

Alternative 2: Installation on Deployed CentOS (RedHat)

First, install yum and git.

sudo yum install -y yum-utils
sudo yum install git

Next, clone the git repo

git clone https://github.com/Aeront39/Peer-reviews-NLP

Then, navigate to within the downloaded directory, and perform the following commands:

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io --allowerasing
sudo dnf --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos
sudo curl -L https://github.com/docker/compose/releases/download/1.26.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo systemctl start docker

Finally, run the following command to begin the webservice:

sudo docker-compose up

Alternative 3: Installation on Local Machine

  • Clone the public Github for the project to your local machine. A link to the Github can be found here.
  • Install Docker to your local machine. Please refer to the official Docker documentation for installation instructions for your specific OS.
  • Navigate to the directory "~/Peer-reviews-NLP" and run "sudo docker-compose up" to start the web service
  • If the web service goes down and needs to be rebuilt, utilize the command "sudo docker-compose up --build"


Testing Set-Up

To ensure the installation was successful and that the web service is functioning properly, this section will outline how to send some basic test input to the web service.

Those familiar with a particular API tool should feel free to use whatever they prefer. However, these instructions assume no familiarity with such tools, and so will recommend the download and use of Insomnia, a tool which allows API requests to be made to both localhosts and deployed addresses.

The initial steps for both alternatives are the same, and so will be said here before splitting into specifics:

  • Download Insomnia.
  • Open Insomnia and click the button in the top-right labelled "Create". From the dropdown, choose to create a new "Request Collection." Name it whatever you prefer.
  • Click the "+" symbol near the top-left and choose to make a new request. Name it as you prefer.
  • Once the request is created, change its type to a "POST" request in the bar near the top, and just beneath, click the word "Body" and select "JSON" from the dropdown.

You may now post into the text area whatever JSON payload you may wish to send to the web service. In order to do so, however, you must send the POST request to the proper address, which must be put in at the top (next to POST).

If you are testing locally, this address will start with "127.0.0.1", followed by the particular call you would like to make (for example, "127.0.0.1/volume"). If you are testing in the deployed environment, you should send your request to the address or url of the deployed machine.

For more information on what API calls you can make and what payloads to expect to send and receive, including testing examples, see this page on web service API.

Technical Explanation of Set Up

The following is a documentation of the specific steps that occur when the web service is set up. More specifically, this section will explain what the Dockerfile and subsequent scripts do to set up the server when the docker-compose command is called. These steps are documented in the case that they need future repair or refactoring.