This is a small repository to get your feet wet with a reverse proxy.
- Docker
We will launch a small node.js backend application followed by a small frontend application.
- The frontend will consist of an HTML file served by an nginx Server which will display a greeting.
- This greeting will be fetched from the backend API.
- Finally we will launch an nginx server which will serve as a reverse proxy.
- Thus, we will be able to reach our services through the reverse proxy as a single entrypoint
-
Build backend image:
docker build -t backend -f backend/backend.Dockerfile backend/
-
Run backend container:
docker run -d --name=backend backend
-
Build frontend image:
docker build -t frontend -f frontend/frontend.Dockerfile frontend/
-
Run frontend container:
docker run -d --name=frontend frontend
-
Create a network:
docker network create mynetwork
-
Connect backend and frontend to the network:
docker network connect mynetwork backend
docker network connect mynetwork frontend
-
Build proxy image:
docker build -t proxy -f proxy/proxy.Dockerfile proxy/
-
Run proxy container:
docker run -it -d -p 8080:8080 --network=mynetwork --name proxy proxy
-
Go to
localhost:8080
- you should see a greeting page.