Skip to content

Change health check to generate its URL #1446

@tcely

Description

@tcely

We have environment variables for where gunicorn is listening, so we should use those to generate the proper URL instead of using a hard-coded argument in the Dockerfile.

I'd suggest instead of an error, we should format a string as the URL instead. This preserves the ability to override the URL with an argument but uses the generated one by default.

try:
url = sys.argv[1]
except IndexError:
sys.stderr.write('URL must be supplied\n')
sys.exit(1)

def get_bind():
host = os.getenv('LISTEN_HOST', '127.0.0.1')
port = os.getenv('LISTEN_PORT', '8080')
return '{}:{}'.format(host, port)

tubesync/Dockerfile

Lines 776 to 778 in 33479e8

# Create a healthcheck
HEALTHCHECK --interval=1m --timeout=10s --start-period=3m CMD ["/app/healthcheck.py", "http://127.0.0.1:8080/healthcheck"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions