Hi everyone,
I’m working on a project where I expect around 200 requests per day across three microservices:
identity
product1
(called “connect”)product2
Even though the average traffic is low, I want to build my system in a professional way using a microservices architecture. Some days may see traffic spikes, so I need the services to scale dynamically. Cost is also important to me—ideally, I want to stay within a monthly budget of $15–25. That means I’d prefer my services to auto-start when requests come in and sleep when idle to save on cost.
The services should be able to communicate with each other efficiently, as if they are on the same private network. For example, I want identity
to call connect
using a URL like:
http://connect.internal:8002
However, I get the following error:
Cannot connect to host connect.internal:8002 ssl:False [Connect call failed ('fdaa:14:f019:a1b:3fc:1297:f1:2', 8002, 0, 0)]
Note: I can access connect
via connect.fly.dev
with no problem. Only the internal address isn’t working as expected.
Here’s my Dockerfile
for the connect
service:
FROM python:3.11-slim AS backend
WORKDIR /app
COPY ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
COPY . /app
EXPOSE 8002
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8002"]
And here’s the fly.toml
for connect
:
app = 'connect'
primary_region = 'fra'
[build]
[http_service]
internal_port = 8002
force_https = true
auto_stop_machines = 'suspend'
auto_start_machines = true
min_machines_running = 0
processes = ['app']
[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
What am I missing to get the internal .internal
domain communication working properly between my services?
All of my microservices are defined under the same organization.
Would you recommend using Kubernetes as an alternative? What would the cost look like for products with such low traffic?
I’m also open to other alternatives if you have any suggestions. I’m new to the world of microservices.
Thanks in advance for any help!