Skip to content
This repository was archived by the owner on Mar 12, 2022. It is now read-only.

Server Guide

dalarm edited this page Oct 8, 2017 · 4 revisions


Starting up Scribe

  1. After accessing the server:
    rvm use 2.3.1 --default
    rake project:load['cc-ing', workflows] 
    rails s -d
    

1.5 [Temporary Fix]:

rvm use 2.3.1 --default
rake project:load['cc-ing', workflows]
screen -S rails  #this will make a separate session/window 
rails s
Ctrl+A then press d #this will detach that screen and you'll be able to go back to your original window.

You need to use rvm 2.3.1 to ensure that you are using the right version of Rails. The -d command for rails makes it so that you run the app in the background even after you log out. However, when we use the -d command, rails is unable to properly use our styles.css. Due to this, the website's layout is weird. In order to bypass that problem, we can run rails normally using rails s in a separate screen.

Restarting Scribe

If Scribe is already running and you want to restart it:

  1. Find the PID and kill it:
    lsof -i :8000   //Change 8000 to a different port number if Scribe is running on something else.
    kill -9 <PID>
    

You might have to do sudo if nothing happens when you do lsof. After the process is killed, start the Scribe App again.

Starting up Django App (Image Uploader)

  1. Go to this directory: image-uploader/django_rest_imageupload_backend/
  2. Type this command:
    ./runserver
    

Alternate way to do the same thing:

python manage.py runserver 0.0.0.0:3000
  1. Do these steps if you want to run the Django app in the background:
    screen -S django #or some arbitrary title you want to name the screen to make it easier to reattach.
    ./runserver
    Ctrl+A and then press d  #This 'detaches' the screen so you can go back to your original window.
    

This creates another 'screen' or window in the server that will keep it running
while you go back to doing whatever you were working on.
You can go back to your django app server screen by doing:

screen -r django #The title that you used to name it.
screen -ls #You can use this to find the id of the screens that are currently running

The original command to start the server would be python manage.py runserver but it uses 127.0.0.1 as
the default ip. We want to use 0.0.0.0
Instead of typing out the long alternate way, I created a script that will run it with one word.


Changing Ports for a Rails App (Scribe):

  1. Modify boot.rb which is located in the directory, scribeAPI/config/
  2. Inside boot.rb, there will be a snippet of code I put in
    require 'rails/commands/server' module DefaultOptions def
    default_options super.merge!(Port: 8000) end end
    Rails::Server.send(:prepend, DefaultOptions)
    
  3. Change the '8000' to the desired port number.

By default, the Rails App uses the port 3000.

Changing Ports for a Django App (Image Uploader):

  1. Go to this directory: image-uploader/django_rest_imageupload_backend/
  2. Edit the runserver script and change the port settings.
  3. Alternate way to do it:
    python manage.py runserver 0.0.0.0:<b>The port number you want to use</b>
    

The location of the images:

The images that are already inside Scribe are located in
project/cc-ing/subjects/group_only_one_group.csv

When uploading an image through the image uploader, it will be sent to this directory:
/var/www/html/test_images
If you want to change the endpoint of the image uploader:

  1. Edit settings.py
  2. Look for the variable, MEDIA_ROOT
  3. Type in the directory you want the new endpoint to be.


( Needs to be tested)
We have a script that initiates OCR on the images inside test_images
which then gets moved to project/cc-ing/subjects/group_only_one_group.csv

Clone this wiki locally