Reputation: 2785
I'm experiencing so much trouble launch my application from the remote server after deploying it to Google AppEngine. I've looked up similar questions and tried to apply the suggested fixes, but still no success - I keep getting that 502 Bad Gateway Issue. Could someone please advise?
Folder structure is like this:
directory: cross_sell_dash/
app.yml
database.py
Dockerfile
gcp-sa-creds.json
main.py
requirements.txt
app.yml
entrypoint: "gunicorn --bind:$PORT main:app"
env: flex
runtime: custom
main.py
app = Flask(__name__)
@app.route("/call/<function_name>/search/", methods=["GET"])
def callFunction(function_name: str):
user_id = request.args.get('user_id')
savm_id = request.args.get('savm_id')
business_sub_entity = request.args.get('business_sub_entity')
user_comments = request.args.get('user_comments')
user_approval = request.args.get('user_approval')
functionToCall = getattr(Database(), function_name)
return str(functionToCall(user_id, savm_id, business_sub_entity, user_comments, user_approval))
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080, debug=True)
Dockerfile
FROM python:3-onbuild
RUN mkdir /app
ADD . /app
WORKDIR /app
RUN pip3 --no-cache-dir install -r requirements.txt
EXPOSE 8080
ENTRYPOINT ["python3", "main.py"]
ENTRYPOINT ["gunicorn","--bind=0.0.0.0:8080","main:app"]
Upvotes: 0
Views: 768
Reputation: 434
entrypoint
in app.yamlDockerfile
as followsFROM python:3-onbuild
RUN mkdir /app
ADD . /app
WORKDIR /app
RUN pip3 --no-cache-dir install -r requirements.txt
EXPOSE 8080
ENTRYPOINT ["gunicorn", "--bind=0.0.0.0:8080", "main:app"]
Upvotes: 3