Git Product home page Git Product logo

lua-reverse-proxy-with-flask's Introduction

OpenResty(lua) reverse proxy with flask backend app

unlicense

INDEX


ABOUT

この 2 つを合わせて通信できるようにした感じ。

動作の仕組み

  1. docker-compose.yml でリバースプロキシと backend アプリを定義しているので同じ docker network に所属している。 --> これで docker-compose.yml で定義したサービス名を名前解決してコンテナ間通信ができる。
  2. リクエストを受け取った際に nginx.conf に記載のある lua スクリプトが実行される。
  3. lua スクリプトにより動的にリクエストを転送するバックエンドが決まる。
  4. リクエストがバックエンドに転送される。

flask cli

現状動作確認のみしかやってないが気が向いたら定期処理とか実行させたい。

docker compose run -it backend_app "/bin/bash"
root@d8ed0df88ad6:/usr/local/app# ls
Dockerfile   app	 requirements.txt  tests
__pycache__  config.ini  run.py
root@d8ed0df88ad6:/usr/local/app# flask test hello
Hello, World.

LICENSE

UN LICENSE


ENVIRONMENT

  • reverse proxy
    • openresty
    • lua-nginx-module
  • backend
    • flask
    • gunicorn(サービス起動)

PREPARING

just download this repository.


HOW TO USE

コンソールのログみるのが一番わかりやすいのでターミナル 2 つあるといいかも。

docker buildx bake
docker compose up backend_app
docker compose up reverse_proxy

動作イメージ


REFERENCES

My repositories

Others

lua-reverse-proxy-with-flask's People

Contributors

ryosukedtomita avatar

Stargazers

 avatar

Watchers

 avatar

lua-reverse-proxy-with-flask's Issues

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.