Skip to content

Local web application to view images from Opportunity Rover

License

Notifications You must be signed in to change notification settings

percurnicus/opportunity

Repository files navigation

Opportunity App

https://travis-ci.com/pbvarga1/opportunity.svg?branch=master https://coveralls.io/repos/github/pbvarga1/opportunity/badge.svg?branch=master https://img.shields.io/github/license/pbvarga1/opportunity.svg?style=plastic

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.

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

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

  • Flask + Angular
    • Routing to multiple pages handled by Angular through Flask
  • Flask

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:

    $ 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-web` service (as I do), you have to install the node packages first. cd into the directory with the package.json file and then

    $ yarn install --modules-folder static/node_modules
  1. To get sentry working, follow the instructions from Sentry on Premise 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.
  2. From the top directory oportunity, run:
$ 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:

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.

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/

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.