I've been following a Fargate/docker tutorial here: https://medium.com/containers-on-aws/building-a-socket-io-chat-app-and-deploying-it-using-aws-fargate-86fd7cbce13f
Here is my Dockerfile
FROM mhart/alpine-node:15 AS build
WORKDIR /srv
ADD package.json .
RUN yarn
ADD . .
FROM mhart/alpine-node:base-9
COPY --from=build /srv .
EXPOSE 3000
CMD ["node", "index.js"]
production
was created from the AWS CloudFormation public-service template
chat
was created from the AWS CloudFormation public-vpc template with some parameter substitutions from the tutorial:
The production stack exposes a valid ExternalUrl output parameter
When I open the URL, I can see a successful initial load of the index
But resources respond with a 502 (Bad Gateway)
And if I refresh the URL, the index throws the error as well
I'm new to AWS and Fargate. Are there server logs I should check? Could this be a problem with either of the templates (public-vpc.yml
or public-service.yml
) that I used for setup? Any help is appreciated — thank you.
Mystery solved! Thank you @Marcin and @cynicaljoy for your help. @cynicaljoy, I checked the ECS cluster status, but there was nothing out of the ordinary — the chat task was RUNNING.
@Marcin, I followed your lead and re-created the stacks and app. Now it works! My issue was neglecting to match up the correct regions in all of my AWS commands the first time around. Some were run with us-west-1
and some with us-west-2
. Once I matched those up, the gateway problem went away.