/docker-nginx-flask

:cloud: Host a multi-tenant Python-Flask web application hosted behind an nginx proxy

Primary LanguagePythonMIT LicenseMIT

Provides a convenient way to connect frontend/backend services together:

+---------+   +--------+
|memcached|   |postgres|  Services
+-+-------+   +-----+--+
  ^       ^         ^
+-+-----+ |    +----+--+
|  api  | +----+  web  |  Applications
+---+---+      +---+---+
    ^              ^
+---+--------------+---+
|         nginx        |  Server
+----------------------+

Startup

# start everything
docker-compose up [--build]

# [OPTIONAL]
# start individual services (with dependencies)
docker-compose up api

# Build and run containers in the foreground
make docker-deps-up-nodaemon

Usage

First, browse to Here, and view the response:

Hello world! - 1

This queried postgres for index #1, and set the value in memcached (accessible across both the web and api containers) for 30 seconds.

To view the value, check the response Here:

Hello world! - [(1, 'Bitwolf', 'morbi vel lectus')]

Browsing to different indexes, e.g. ID 2 will set different information into memcached.

References