Skip to content

Using NGINX as reverse proxy, multi-container (Docker compose) application can be hosted on a single EC2 instance. Single IP address for API server and Client server

Notifications You must be signed in to change notification settings

neatcoder/AWS-MultiContainerWebsite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS-MultiContainerWebsite

This multi-container website can be hosted on a single EC2 instance via an automatic deployment by Elastic Beanstalk. This approach solves the issues like handling multiple EC2 instances, multiple IP address for server and client. Hence, it also solves the problem of Cross Origin Resource sharing (CORS) request failures when we try to access an API from another origin.

Highlights:

  • Docker compose is used to orchestrate multiple containers
  • NginX reverse proxy server is used to handle requests on a single port 8080. It then diverts the traffic on suitable server depending on the URL identifier. Example:
  • AWS dockerrun file will automatically create EC2 instance and deploy the containers via Elastic Beanstalk

Steps to get started

  • Install node dependencies for Client and Server. Use command "npm install".
  • Build the ReactJS client. Use command npm run build.
  • To start the application locally, run docker-compose up. Make sure you have installed Docker on your machine.
  • Push the docker images to a container registry.
  • If you want to host this application on AWS, use Elastic Beanstalk to create a multi-container application. Change the Docker images' names in the file Dockerrun.aws.json. This dockerrun file will fetch the images from the mentioned container registry where you hosted the containers after creating them.

Authors

About

Using NGINX as reverse proxy, multi-container (Docker compose) application can be hosted on a single EC2 instance. Single IP address for API server and Client server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published