~nhanb/gae-proxy

6b97510d730237ca319d7f8080497a85bd2272e1 — Bùi Thành Nhân 2 years ago a459ec0
use gunicorn for actual concurrency

Turns out GAE wouldn't just spin up extra instances...
3 files changed, 7 insertions(+), 3 deletions(-)

M app.yaml
M main.py
M requirements.txt
M app.yaml => app.yaml +1 -1
@@ 1,5 1,5 @@
runtime: python37
entrypoint: python main.py
entrypoint: gunicorn -b :$PORT --workers=5 main:app

handlers:
  - url: /.*

M main.py => main.py +5 -2
@@ 1,7 1,7 @@
import os

import requests
from bottle import HTTPResponse, request, route, run
from bottle import HTTPResponse, default_app, request, route, run

# GAE recommended
PORT = os.environ.get("PORT", 8080)


@@ 41,4 41,7 @@ def proxy():
    return HTTPResponse(body=resp.text, status=resp.status_code)


run(host="0.0.0.0", port=PORT)
app = default_app()

if __name__ == "__main__":
    run(host="localhost", port=PORT)

M requirements.txt => requirements.txt +1 -0
@@ 1,2 1,3 @@
requests
bottle
gunicorn