percurnicus / opportunity

Local web application to view images from Opportunity Rover
MIT License
0 stars 0 forks source link

Opportunity App

.. image:: https://travis-ci.com/pbvarga1/opportunity.svg?branch=master :target: https://travis-ci.com/pbvarga1/opportunity .. image:: https://coveralls.io/repos/github/pbvarga1/opportunity/badge.svg?branch=master :target: https://coveralls.io/github/pbvarga1/opportunity?branch=master .. image:: https://img.shields.io/github/license/pbvarga1/opportunity.svg?style=plastic :target: https://github.com/pbvarga1/opportunity/blob/master/LICENSE .. image:: https://img.shields.io/badge/python-3.7-blue.svg :target: https://www.python.org/downloads/release/python-371/ .. image:: https://img.shields.io/badge/AngularJS-1.6.9-red.svg :target: https://docs.angularjs.org/guide .. image:: https://zenodo.org/badge/172360719.svg :target: https://zenodo.org/badge/latestdoi/172360719

.. contents:: Table of Contents :local:

I want to play around with some programming techniques (listed below). This repo can be used as examples of using these techniques (although I do not guarantee that they are all the best way to do things as I am just learning). To explore these techniques, I'm creating a simple app and adding just enough complexity to serve as real world examples without it becoming too large. The application is a local website where one can look at images taken by the opportunity rover. As a note, the front-end is not my main concern, most of the skills I want to practice regard the back-end. To maintain my work, I separate different uses of packages into different branches. For example, I have a branch for a Flask front-end and a branch for a Quart front-end (see Branches_). See the issues for what I plan to do going forward.

Branches

.. _Master: https://github.com/pbvarga1/opportunity#opportunity-app .. _Flask-Frontend: https://github.com/pbvarga1/opportunity/tree/flask-frontend#opportunity-app

+-------------------+------------------------------------------------+ | Name | Description | +===================+================================================+ | Master | Flask-Sqlalchemy back-end with Quart front-end | +-------------------+------------------------------------------------+ | Flask-Frontend | Flask-sqlalchemy back-end with Flask front-end | +-------------------+------------------------------------------------+

Software

Software/techniques/packages used so far. Different branches will have different features and are broken up by branch name.

Union +++++

Master ++++++

Flask-Frontend ++++++++++++++

Quick Start

If you want to use this project for your own learning exercises, fork the repo to your own github account and then clone your forked repo to your computer. Make sure docker is installed and running. To get the application running:

  1. If you are not using docker toolbox, set the following environment envariable:

    .. code-block:: bash

    $ export DOCKER_IP='127.0.0.1'

  2. You will need to adjust the volumes in docker-compose.yml to your own paths.

  3. If using a volume for the `opp-webservice (as I do), you have to install the node packages first.cdinto the directory with thepackage.json`` file and then

    .. code-block:: bash

    $ yarn install --modules-folder static/node_modules

  4. To get sentry working, follow the instructions from Sentry on Premise <https://github.com/getsentry/onpremise>_ reproduced below:

    1. docker volume create --name=sentry-data && docker volume create --name=opportunity-postgres

    2. Make adjustments to the .env file.

    3. docker-compose build - Build and tag the Docker services

    4. docker-compose run --rm web config generate-secret-key - Generate a secret key. Add it to .env as SENTRY_SECRET_KEY.

    5. docker-compose run --rm web upgrade - Build the database. Use the interactive prompts to create a user account.

      • If you never get to the interactive prompt, you need to make room by deleting images and volumes.
  5. From the top directory oportunity, run:

.. code-block:: bash

$ docker-compose up

Which will build the images and run the docker containers. If you are using dockertoolbox, then the host will be 192.168.99.100, otherwise it will be the local host 127.0.0.1. In the examples ahead, I assume the host will be 127.0.0.1. In your browser go to http://127.0.0.1:5002/ to see the home web page:

.. image:: homepage.jpg

The first two links allow you to register product types (i.e. EDR, RDR) and cameras (i.e. pancam). The third link is where you will find images to register. Clicking Register Image allows you to register an image with the local database and then select it for viewing. Selecting an image will display it on the home page.

Port 5001 is where the API is located to retrieve data from the database.

Links

+----------------+-----------------------------+------------------------+ | Page | Toolbox | Docker | +================+=============================+========================+ | Home | http://192.168.99.100:5002/ | http://127.0.0.1:5002/ | +----------------+-----------------------------+------------------------+ | Docs | http://192.168.99.100:5005/ | http://127.0.0.1:5005/ | +----------------+-----------------------------+------------------------+ | Swagger | http://192.168.99.100:5004/ | http://127.0.0.1:5004/ | +----------------+-----------------------------+------------------------+ | Sentry | http://192.168.99.100:9000/ | http://127.0.0.1:9000/ | +----------------+-----------------------------+------------------------+

Citing this Repo

It's MIT Licensed so feel free to use whatever you want from here. I don't care if you do not cite this repo in published work if you used any of it. Creating the DOI was more of an exercise for myself than anything else.