I was following this tutorial on how to deploy your containers to AWS using the ECS plugin.
My setup is a little different from the tutorial (even simpler). I just have
Only trickery, which shouldn't be that complex is setting up a shared File System, because the point of the GROBID web server is convert PDFs to XML, and he stores them in the file system to which the FastAPI needs to have access when called via HTTP.
Here's my docker compose file:
version: "3"
services:
fastapi:
image: <account>.dkr.ecr.eu-central-1.amazonaws.com/repo:latest # fastapi+uvicorn image
ports:
- "8000:8000"
volumes:
- efs:/root
networks:
- backend
grobid:
image: grobid/grobid:0.6.2
ports:
- "8070:8070"
networks:
- backend
networks:
backend:
driver: bridge
volumes:
efs:
driver_opts:
# Filesystem configuration
backup_policy: ENABLED
lifecycle_policy: AFTER_14_DAYS
throughput_mode: bursting
I don't think anything's wrong with it, but for some reason the FastAPI server doesn't seem to be able to properly reach GROBID. It is giving the following error HTTPConnectionPool(host='127.0.0.1', port=8070): Max retries exceeded with url: /api/processFulltextDocument (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f11e1a777c0>: Failed to establish a new connection: [Errno 111] Connection refused'))
. I know for a fact that that endpoint is reachable because it works in the browser.
Moreover, if I see the logs, both the containers seem to be restarting a lot, which leads me more and more to believe that the containers are simply unstable and the plugin is somehow broken.
Has anybody experienced similar problems or has a hint of what it might be? I also accept suggestions on alternatives on how to deploy two webservers that share the same filesystem, with capacity for the system to scale to millions of users without downtime if possible.
Thank you
When you are running your applications in two containers, they aren't on each other's localhost
any more. You have to use the internal.network name, which is the same as the container name. So instead of your FastAPI application trying to connect to http://127.0.0.1:8070
, set it to http://grobid:8070
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.