Hi,
First and foremost, I apologize for how stupid this question may be.
For the past week hours I've been researching how I could host my webapp on a cloud provider such as AWS given my circumstances, but haven't had any success. I promised myself I wouldn't ask the community, but I am giving up.
Localhost Setup
- On my localhost, I have 3 containers:
- Backend/API container
- Frontend / React app container
- Nginx container ( acts as a to route based on path)
- When I run
docker-compose up
on my local machine, the app(s) come together to work as intended. For reference, I followed this guide and my source code is exactly the same.
- My docker-compose is the following:
version: '3'
services:
web:
build: ./nginx
ports:
- "80:80"
depends_on:
- api
- frontend
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
api:
image: platform-api:latest
ports:
- "8080:8080"
env_file:
- backend.env
frontend:
image: platform-frontend:latest
ports:
- "3000:3000"
env_file:
- frontend.env
AWS Setup (?)
- I spent ALOT of time researching how I can host my app on AWS, but have just been going in a circle.
- I've uploaded all 3 of my containers to ECR
- Backend/API container
- Frontend / React app container
- Nginx reverse proxy container (to route based on path)
- I've created task definitions with
bridge
mode so that I am able to link the containers together
The issues
- When I create my cluster and service with my task definition, nothing seems to happen. The service just stays on
provisioning
and won't move.
- Similarly, if I just tried just running 1 container, my backend container, it still gets stuck on
provisioning
- I've added a health check endpoint to my API that returns a 200 status code, but it still gets stuck on
provisioning
- I want to say that my setup isn't working because of a port-related issue, but I am not entirely sure what I can do to debug.
My questions
- I am using the
bridge
network mode as it seems it's the only way to link my containers together. Should I be usingawsvpc
as the network mode? If so, how can I link/get the containers to talk to eachother on different ports?
- When using the
bridge
network mode, I set both the host & container port to 8080 as that how I run it on my local machine. Should I be doing this differently?
My overall goal
- My overall goal is to have everything running under 1 domain and/or cluster. I plan on doing path based routing with a reverse proxy, which is why I have a 3rd nginx container, similar to this guide
What are the next steps I can do to get these containers and linked together? Is there a detailed tutorial or post on someone hosting on ECS with bridge mode?
I thank you in advanced for taking the time to read my lengthy post