Runs in Docker, but not in Amazon ECS #813
Replies: 4 comments
-
Oh, and I just thought of another thing to try: sending an HTTP request from within the container itself.
And as with |
Beta Was this translation helpful? Give feedback.
-
And one more thing... While connected to the running container, I decided to start a second instance of the node application, but on a different port (which worked). Then, from another host, I made a But here's what I observed: when I tried to CTRL+C to terminate the second node process, it spit out At the same time, I had an SSH connection to a remote host, from which I was running So that seems to indicate that the TCP connection (shown in I see this project is using express, so I wonder if there are any configuration options or method calls before |
Beta Was this translation helpful? Give feedback.
-
As a test, I connected to the running container and created a file as const express = require( 'express' );
const app = express();
app.get( '/', ( req, res, next ) => {
res.sendStatus( 200 );
});
app.listen( 8080, '0.0.0.0' ); ...then executed |
Beta Was this translation helpful? Give feedback.
-
AHA! I think I found the problem: Line 40 in 8619fa7 I started commenting out So, for whatever reason, the express-rate-limit middleware causes the the Express server to hang indefinitely? And why it does this on Fargate and not in Docker is still a mystery. Upon closer inspection, I found that if I comment out the blink/middlewares/rate-limiter.js Lines 9 to 19 in 8619fa7 Apparently there's beef with the rate limiter and my Redis server? So, I ran a But it worked on my local Docker, which was configured to use the Postgres and Redis services in AWS (I have a site-to-site VPN to AWS, so I can access all resources privately), which misled me to believe it was a Docker vs. Fargate problem. So the problem with Fargate is that one of the ways to enable communication with other AWS services is to have endpoints for those services added to the VPC -- I'd forgotten to add endpoints for ElastiCache and RDS. TL;DR: |
Beta Was this translation helpful? Give feedback.
-
I've been fighting this problem for many hours. I have been trying to deploy the Docker image to Amazon ECS, which is successful, but it will not respond on port 3000.
I can shell into the container and verify that
node
is running:...and that it is listening on TCP 3000, too:
In fact, you can even see two remote clients have established connections to TCP 3000 (one is a browser on my workstation, the other is a load balancer attempting to run a health check), but the node process just isn't responding.
The logs show the correct output:
But no matter what, pointing my browser to
http://172.30.8.162:3000/app
just hangs until it finally times out. Same with usingcurl
-- the command stalls until it times out, with no output or errors:I even cloned the repo and rebuilt the production version into a new image (had to re-generate the
package-lock.json
because some of the dependencies were out of date and caused npm to fail), but the behavior was the same.But again: if I run it in Docker, it runs just fine.
I'm not suggesting this is a problem with Blink itself (hence starting this discussion rather than a new issue), but obviously there's a difference between Docker and Amazon's Fargate platform. But I have other node-based apps running on Fargate, no problem, so I'm not sure why this one is different 🤷🏻♂️
Anyone have any insight? Or at least any suggestions on how to troubleshoot this further?
Beta Was this translation helpful? Give feedback.
All reactions