Skip to content

Local Installation

Nicholas VanFossen edited this page Jan 2, 2024 · 2 revisions

The following guide will follow the steps of setting up an offline version of FTIR-SIS. These steps were tested and verified on an Ubuntu 22.04 virtual machine on 1st January 2024. Operating systems, toolkits, libraries, dependencies, and conventions change constantly. While the processes below will likely be similar in the future, things will inevitably change. At the Raston Lab, we strive to keep our documentation current, but things slip through the cracks. The best way to keep an open and public conversation about these issues would be to report directly to the associated repository on GitHub.

Prerequisites

The following should happen before attempting to run the FTIR-SIS. Depending on the approach selected, you may not need to perform all the prerequisite steps.

  1. Update operating system

    sudo apt update
    sudo apt upgrade
  2. Install git

    sudo apt install git
    git --version
  3. Install Docker Engine (for Docker and Dev Container setups)

    Install Docker Engine by following the official documentation: https://docs.docker.com/engine/install/ubuntu/.

  4. Install Python3 (for Python setups)

    Python is typically installed by default on Ubuntu. You can verify this by running python3 --version.

    sudo apt install python3

    For local installations without Docker, a Python virtual environment (venv) is needed.

    sudo apt install python3.10-venv

Back-end (Docker)

  1. Clone this repository

    git clone https://github.com/RastonLab/Virtual-FTIR-Functions.git
  2. Move into cloned directory

    cd Virtual-FTIR-Functions
  3. Create image

    docker build -t ftir-api .
  4. Build container

    docker run -p 5000:5000 --name back-end ftir-api
  5. Once running, visit localhost ("Raston Lab FTIR API – Version 0.0.0" should be present)

    http://localhost:5000/

Additional Docker commands

  • List containers

    docker ps -a
  • Stop container

    docker stop [NAME]
  • Delete container

    docker rm [NAME]
  • List images

    docker images
  • Delete image

    docker image rm [IMAGE-ID]

Back-end (Python)

  1. Clone this repository

    git clone https://github.com/RastonLab/Virtual-FTIR-Functions.git
  2. Move into cloned directory

    cd Virtual-FTIR-Functions
  3. Create Python virtual environment (venv)

    python3 -m venv venv
  4. Activate venv

    source venv/bin/activate
  5. Install dependencies from scripts/requirements.txt

    pip3 install -r ./scripts/requirements.txt
  6. Start application

    python3 app.py

    or

    python3 wsgi.py
  7. Once running, visit localhost ("Raston Lab FTIR API – Version 0.0.0" should be present)

    http://localhost:5000/

Back-end (Visual Studio Code Dev Container)

  1. Install the Dev Containers Visual Studio Code extension

  2. Clone this repository

    git clone https://github.com/RastonLab/Virtual-FTIR-Functions.git
  3. Open the repository in a Dev Container. When opened, all dependencies will be automatically installed. This installation process does not repeat unless one of the .devcontainer configuration files change or it is manually triggered (Dev Containers: Rebuild Container)

    1. (Option 1) Open the repository in VS Code either in your native OS or WSL. Once open, in the bottom-right, a message should appear prompting the user to open the repository in a container.

    2. (Option 2) Open the Command Palette, search and select the option: Dev Containers: Open Folder in Container.... Navigate and select the cloned repository's directory.

  4. Start application

    python3 app.py

    or

    python3 wsgi.py
  5. Once running, visit localhost ("Raston Lab FTIR API – Version 0.0.0" should be present)

    http://localhost:5000/