0

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"] 
1
  • Hey, does this work locally? It only fails on GAE? Could you please post your requirements.txt also? Could you explain why are you using python:3-onbuild instead of just python3? Is your VM instance running correctly? Bad gateways normally happen when the application isn't capable of answering the request. (probably never initalized or crashed) Let me know. Commented Oct 9, 2019 at 11:24

1 Answer 1

3
  • Remove the entrypoint in app.yaml
  • Update Dockerfile as follows
FROM 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"] 
Sign up to request clarification or add additional context in comments.

1 Comment

Please, let me know how I can include information of the Dockerfile to be applied while installation using this command: gcloud app deploy; apparently, it does not take into account the info within Dockerfile.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.