The top way over complicated version of a Micro Service App just to get experience with a multi container deployment with production and development grade environment.
Combination of React, Express, Redis, Postgres and Node. Multi container app setup with docker and travis CI/CD pipeline. Using images on docker hub to deploy app directly into AWS Elasticbeanstalk
1.Make sure you have docker and docker compose installed in system
- Docker - Containerize app
- Docker Compose - Local development environment to run tests and builds by using volumes and networks
- Docker Hub - Convenient Images
- NGINX - Web Server
- Create React App - Bootstrapping
- Node - Backend
- Redis - Memcached
- PostgreSQL - Database
- Travis-ci - CI/CD Pipelines
- Amazon S3 - Storage on Production
- Amazon RDS - Database on Production
- Amazon ElastiCache - Memcached on Production
- AWS Elastic Beanstalk - Host And Manage App
Created using App Diagram
Run following command in your terminal
docker compose up --build
remove --build argument if you are rerunning the app witout making any change in dockerfile and docker-compose.yml file
and you are good to go visit http://localhost:3050
Created using App Diagram
Created using App Diagram
Go to AWS Management Console and use Find Services to search for RDS
Click Create database button
Select PostgreSQL
Check 'only enable options eligible for RDS Free Usage Tier' and click Next button
Scroll down to Settings Form
Set DB Instance identifier to multi-docker-postgres
Set Master Username to postgres
Set Master Password to postgres and confirm
Click Next button
Make sure VPC is set to Default VPC
Scroll down to Database Options
Set Database Name of your choice
Scroll down and click Create Database button
Go to AWS Management Console and use Find Services to search for ElastiCache
Click Redis in sidebar
Click the Create button
Make sure Redis is set as Cluster Engine
In Redis Settings form, set Name to multi-*****
Change Node type to 'cache.t2.micro'
Change Number of replicas to 0
Scroll down to Advanced Redis Settings
Subnet Group should say “Create New"
Set Name to redis-group
VPC should be set to default VPC
Tick all subnet’s boxes
Scroll down and click Create button
Go to AWS Management Console and use Find Services to search for VPC
Click Security Groups in sidebar
Click Create Security Group button
Set Security group name to multi-docker
Set Description to multi-docker
Set VPC to default VPC
Click Create Button
Click Close
Manually tick the empty field in the Name column of the new security group and type multi-docker, then click the checkmark icon.
Scroll down and click Inbound Rules
Click Edit Rules button
Click Add Rule
Set Port Range to 5432-6379
Click in box next to Custom and start typing 'sg' into the box. Select the Security Group you just created, it should look similar to 'sg-…. | multi-docker’
Click Save Rules button
Click Close
Go to AWS Management Console and use Find Services to search for ElastiCache
Click Redis in Sidebar
Check box next to Redis cluster and click Modify
Change VPC Security group to the multi-docker group and click Save
Click Modify
Go to AWS Management Console and use Find Services to search for RDS
Click Databases in Sidebar and check box next to your instance
Click Modify button
Scroll down to Network and Security change Security group to multi-docker
Scroll down and click Continue button
Click Modify DB instance button
Go to AWS Management Console and use Find Services to search for Elastic Beanstalk
Click the multi-docker application tile
Click Configuration link in Sidebar
Click Modify in Instances card
Scroll down to EC2 Security Groups and tick box next to multi-docker
Click Apply and Click Confirm
Go to AWS Management Console and use Find Services to search for Elastic Beanstalk
Click the multi-docker application tile
Click Configuration link in Sidebar
Select Modify in the Software tile
Scroll down to Environment properties
In another tab Open up ElastiCache, click Redis and check the box next to your cluster. Find the Primary Endpoint and copy that value but omit the :6379
Set REDIS_HOST key to the primary endpoint listed above, remember to omit :6379
Set REDIS_PORT to 6379
Set PGUSER to postgres
Set PGPASSWORD to *********
In another tab, open up RDS dashboard, click databases in sidebar, click your instance and scroll to Connectivity and Security. Copy the endpoint.
Set the PGHOST key to the endpoint value listed above.
Set PGDATABASE to fibvalues
Set PGPORT to 5432
Click Apply button
Go to AWS Management Console and use Find Services to search for IAM
Click Users link in the Sidebar
Click Add User button
Set User name to multi-docker-deployer
Set Access-type to Programmatic Access
Click Next:Permissions button
Select Attach existing polices directly button
Search for 'beanstalk' and check all boxes
Click Next:Review
Add tag if you want and Click Next:Review
Click Create User
Copy Access key ID and secret access key for use later
Open up Travis dashboard and find your multi-docker app
Click More Options, and select Settings
Scroll to Environment Variables
Add AWS_ACCESS_KEY and set to your AWS access key
Add AWS_SECRET_KEY and set to your AWS secret key
Add DOCKER_ID and set to your docker id secret key
Add DOCKER_PASSWORD and set to your docker password
See the screenshots folder for detailed instructions.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.