Running a uvicorn server as an internal app and setting host to [::] causes deployment to fail


Fly is amazing, thank you so much for making cloud deployments so much easier!

However, I have stumbled across a problem i dont know how to solve.

I’m just testing internal api calls between apps in my personal organisation, so things are still super simple.

I have one app acting as a simple api gateway, the uvicorn server is bound to host and this works great for receivng public traffic from the internet.

the second app - let’s call it upstreamA - is another uvicorn server. i had trouble reaching this with my http requests until i read helpful intel here about not binding uvicorn to but instead the equivalent ipv6 of [::].

When i make this change in the uvicorn docker command, the deployment proceeds but fails a critical check and is then rolled back. But during a small window of time, upstreamA IS reachable and returns reposnses. But when the rollback completes (and reverts to previous uvicorn host) the internal requests once again fail.

here is my docker file for upstreamA:

FROM python:3.11 as requirements-stage


RUN pip install poetry

COPY ./pyproject.toml ./poetry.lock* /tmp/

RUN poetry export -f requirements.txt --output requirements.txt --without-hashes

FROM python:3.11


COPY --from=requirements-stage /tmp/requirements.txt /code/requirements.txt

RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

COPY ./upstreamA /code/upstreamA

CMD [“uvicorn”, “upstreamA.main:api”, “–host”, “::”, “–port”, “8000”]

To confirm, deployments work with host as but fail with “::”. However “::” is the only way i can make upstreamA reachable, as confirmed by the temporary success.

Any help or guidance?

So i swapped out uvicorn for hypercorn using the docker commands:

CMD [“hypercorn”, “upstreamA.main:api”, “–bind", "[::]:8000”]

and this did the trick.

I’ll leave this up for anyone else interested and mark it as solved but i still thinks it’s odd and may merit understanding (likely from my side, but maybe from fly’s?)

cheers all