Git Product home page Git Product logo

geo-api's Introduction

Mautinoa Geo API

This is a multi-container Docker application that provides the Python version of Mautinoa's geolocation API, using lighttpd as frontend and Flask under gunicorn on the backend.

Installation

You will need:

To build the containers: docker-compose build To launch the application: docker-compose up -d

That's it! Docker will fetch all the component parts. (This will take a while the first time.) The application serves the API at http://localhost:80.

You can view the logs for any component process with docker logs <name>, e.g., docker logs geoapi_web_1.

What's inside

docker-compose.yml lists the four containers that make up this application.

  • The db container is a PostGIS database.
  • The data container is a data volume for db.
  • The web container serves the Flask API on port 8000 using gunicorn. There are 2 workers by default. (For more information on settings, see below.)
  • The lighttpd container proxies API requests on port 80 to the web container, using lighttpd.

Docker will attach these containers to a virtual network. Use docker network inspect geoapi_default to display the details of the network (e.g., the containers' IP addresses).

Settings and Internals

web

The Dockerfile for the web container has several environment variables that translate into gunicorn settings. For example, GUNICORN_WORKERS sets the number of workers to use, and GUNICORN_BIND sets the interface and port on which to serve the API. If you need to add a new gunicorn setting, add it to the Dockerfile as another environment variable (using the ENV instruction), uppercased and prefixed with GUNICORN_.

lighttpd

The Dockerfile for the lighttpd container exposes ports 80 and 443. If you want to turn off one or the other of these, you can do so in the Dockerfile, but remember that the ports setting in docker-compose.yml will override it.

All settings for lighttpd are in lighttpd.conf. The host value in the proxy.server seting must point to the IP address of the web endpoint, as assigned by Docker.

The ENTRYPOINT script, docker-entrypoint.sh, contains some minor pipe redirection wizardry that was necessary to get mod_accesslog working properly with docker logs. Do not modify this script unless you know what you're doing or don't care about logging. Don't give the lighttpd container a command in docker-compose.yml, either.

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.