Basic Flask app: entrypoint.url.agent: error in service handler

I have a very basic Flask app.

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Flask application'

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')

Also my Dockerfile is pretty straightforward:

FROM ubuntu:18.04

RUN apt-get update -y && \
    apt-get install -y python-pip python-dev

COPY ./requirements.txt /app/requirements.txt

WORKDIR /app

RUN pip install -r requirements.txt

COPY . /app

ENTRYPOINT [ "python" ]

CMD [ "run.py" ]

When I run the app manually, it works. When I use Waypoint it always gives the following error:

Couldn’t find a Waypoint deployment with this URL (see screenshot)

My waypoint.hcl file is as follows:

project = "Flask Todo application"

app "flask_todo_app" {
    build {
        use "docker" {}
    }

    deploy {
        use "docker" {}
    }
}

The moment I try to go to the displayed deployment URL I get in the logs the following error message:

[ERROR] entrypoint.url.agent: error in service handler: error=“Get “http://:3000/”: dial tcp :3000: connect: connection refused”

I copied your config, and the docker container that is built does not stay running. I get these errors from Waypoint via docker logs

2021-01-29T14:35:45.813Z [TRACE] entrypoint.log: sending line: line="/usr/bin/python: can't open file 'run.py': [Errno 2] No such file or directory"
2021-01-29T14:35:45.816Z [WARN]  entrypoint.child: subprocess exited: args=[/usr/bin/python, run.py] cmd=/usr/bin/python err="exit status 2"

Do you have a run.py file in your setup as well?

We also have a basic Flask example in our examples repo if you want an additional reference point!

Hi,

Thanks for looking into this. The run.py file is this one:

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Flask application'

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')

I have also attached the requirements.txt file here (95 Bytes)

Hope this helps to reproduce it. In the meantime will also have a look at the basic Flask examples already.

I fixed it through working with a WSGI file. All Ok now.

1 Like