Skip to main content

Local System Installation

Installation and setup instructions while doing the configuration on a new system.

Frontend​

Installing nodejs​

  1. As of November 21, 2022, GQC uses Node v16 LTS for its development.
  2. In the coming months, as v16 will get deprecated, GQC will switch to Node v18 LTS

Installing node_modules​

  1. GQC prefers using yarn as it's global node manager manager.
  2. Clone the repo and run the command
    yarn install
  3. Once the node_modules are installed, run yarn start to run the frontend server.

Defining Environment Variables​

  1. In the root level of the react application, create a file called .env
  2. Make sure the following variables are defined:
# #############################################################################
# For development environments:
# #############################
NODE_ENV=development
REACT_APP_PROXY_PROTOCOL=http
REACT_APP_PROXY_URL=127.0.0.1
# The Proxy Port should point at the DRF instance's port
REACT_APP_PROXY_PORT=8000
REACT_APP_PROXY_SECURE=false
# If running DRF locally, the API URL should point at the React App's URL
REACT_APP_API_URL=http://127.0.0.1:3001/
# If relying on a hosted DRF, then the API URL should point at the hosted DRF:
# REACT_APP_API_URL=https://www.ohioriver.org/
# #############################################################################

Backend​

Installing packages from requirements.txt​

  1. Create a new virtualenv using the command mkvirtualenv <env name>
  2. Install the requirements using pip install -r requirements.txt

Setting up the postgres database​

  1. Launch pgadmin
  2. Create a new database called orsanco_flows
  3. Right click on Extensions and install timescaledb in the database.
  4. Go back to the repo and
    1. Iif a migrations folder does NOT exist
    2. Create a migrations folder at the root level and add __init__.py inside the folder; resulting in te following folder structure
      orsanco_backend
      migrations/
      __init__.py
      manage.py
      .gitignore
      requirement.txt
  5. and launch a terminal window.
  6. Run the following commands
    python manage.py makemigrations
    python manage.py migrate
    python manage.py setup_cross_sections
    python manage.py download_hdf_ftp

Configuring HDF Downloader and Processor (Linux)​

  1. SSH into the NOAA FTP server once to get it stored in your user's known hosts (NOTE that you don't need to actually type in your password/connect, you just need to try to connect and select YES when asked to remember/trust this host): ssh skshirsagar@data7.erh.noaa.gov
  2. Update the SSHPASS variable stored in cron-ftp-flows.sh
  3. Define the cron job:
    1. Set your default editor to nano by using the following command, then typing in nano: select-editor
    2. Edit the crontab configuration: crontab -e
    3. Add your crontab configuration as a new line at the bottom of the file. The cron job on the VM is 0 20 * * * ~/cron-ftp-flows.sh >> ~/cron.log which translates to "run the shell script at 0 minutes and 20 hours of every day". Note that the "20 hours" time is local to the machine, meaning ET on Microcenter or UTC on VMs.