Skip to content
Snippets Groups Projects

MetObs API Application

This is a flask application that is served at metobs.ssec.wisc.edu/api.

See https://metobs.ssec.wisc.edu/api for documentation.

Operational conda environment

These instructions assume the operational "standard practice" that is current at the time of writing. This practice is to create a conda environment using the "root" user under /opt/metobs/metobs_api.

  1. Get and install the conda environment:

    cd /tmp
    curl -O "https://gitlab.ssec.wisc.edu/metobs/MetObsAPI/-/raw/master/environment.yaml"
    sudo /opt/miniconda3/condabin/conda env create --file environment.yaml --prefix /opt/metobs/metobs_api
  2. Clone the git repository into the environment and other setup:

    cd /opt/metobs/metobs_api
    sudo mkdir -p repos/git log lock
    sudo chown metobs:metobsgrp log lock
    sudo git clone "https://gitlab.ssec.wisc.edu/metobs/MetObsAPI.git" repos/git/MetObsAPI
  3. Install the metobsapi python package:

    sudo /opt/metobs/metobs_api/bin/pip install -e repos/git/MetObsAPI/
  4. Copy systemd files if necessary:

    sudo cp repos/git/MetObsAPI/etc/systemd/system/metobs_api* /etc/systemd/system/
  5. Enable service:

    sudo systemctl enable metobs_api
    sudo systemctl start metobs_api
  6. Start service:

    sudo systemctl start metobs_api

Developer Installation

Install the package in "development" mode:

pip install gunicorn
pip install -e .

Run a local flask server:

gunicorn --reload --reload-extra metobsapi/templates/ metobsapi.server:app

Open browser to localhost:8000/api.