Code Monkey home page Code Monkey logo

flask-app-reverse-proxy-inalabusgs's Introduction

Simple Flask App

This is a Python Flask application that greets users with a simple message.

Goal

The main objectives of this project were:

  • To "dockerize" the application by providing an image and a configuration for running locally with Docker Compose.
  • To provide a script that retrieves data from an API and performs basic parsing.
  • To provide a reverse proxy configuration.

Docker Exercise

To achieve the above objectives, the following steps were taken:

  • A Dockerfile was created to build and run the application.
  • The application was modified to replace Hello, World! with an optional string set using an environment variable, and defaulting to Hello, World!.
  • A docker-compose.yml file was provided to run the application and set a custom string using an environment variable.

This should result in the ability to navigate to http://localhost:5000/ and see the custom greeting.

Scripting Exercise

A script was provided to parse the data returned from http://localhost:5000/data and create a file in a files/ sub-directory named <id>.txt with the name as the contents of the file. E.g. files/3fc4ccfe745870e2c0d99f71f30ff0656c8dedd41cc1d7d3d376b0dbe685e2f3.txt

Note: The SHA256 sum of each file's contents (<name>) should match the <id>.

Reverse Proxy Configuration

A minimal reverse proxy configuration was provided for the application using Nginx. The nginx.conf file was used and ran from the same Docker Compose file as the application.

Files

Here's a list of the files in this project:

  • app.py: the Flask application code
  • docker-compose.yml: the Docker Compose configuration file
  • Dockerfile: the Dockerfile used to build the Docker image for the application
  • files/: a directory where the parsed files are stored
  • nginx.conf: the Nginx reverse proxy configuration file
  • parse_and_create_files.py: the script to parse the data and create the files
  • parse_data.py: the script to retrieve the data from the API
  • README.md: the file you're reading right now
  • requirements.txt: the Python packages required for the application to run

flask-app-reverse-proxy-inalabusgs's People

Contributors

pr0xxy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.