Microservice-Based Web Application deployed on AWS with Terraform, Ansible and Docker

Overview

Microservice-Based Web Application deployed on AWS with Terraform, Ansible and Docker

Terraform Pages Github top language Github language count Repository size License Github stars

About Β  | Β  Project Architecture Β  | Β  Technologies Β  | Β  Requirements Β  | Β  Case Study Details Β  | Β  License Β  | Β  Author

🎯 About

Microservice-Based Web Application aims to deploy web-page written Nodejs and React Frameworks on AWS Cloud Infrastructure using Ansible. Building infrastructure process is managing with control node utilizing Ansible. This infrastructure has 1 control node and 3 EC2's as worker node. These EC2's will be launched on AWS console. Web-page has 3 main components which are postgresql, nodejs, and react. Each component is serving in Docker container on EC2s dedicated for them. Postgresql is serving as Database of web-page. Nodejs controls backend part of web-side and react controls frontend side of web-page. The code was written by Devenes and architecture will be created by Devenes.

πŸ“œ Project Architecture

Project

πŸš€ Technologies

The following tools were used in this project:

βœ… Requirements

Before starting 🏁 , you need to have Git, Node, Docker, Terraform, Ansible, React and AWS account.

πŸ’Ό Case Study Details

  • Your team has recently ended up a project that aims to serve as web page. You and your colleagues are assigned to work on this project. Developer team has done with code and DevOps team is going to deploy the app in production environment using ansible.

  • Application is coded by Fullstack development team and given you as DevOps team. Web-page allows users to collect their infos. Registration data should be kept in separate PostgreSQL database located in one of EC2s. Nodejs framework controls backend and serves on port 5000, it is als connected to the PostgreSQL database on port 5432. React framework controls the frontend and it is also connected to the Nodejs server on port 5000. React server broadcasts web-page on port 80.

  • The Web Application will be deployed using Nodejs and React framework.

  • The Web Application should be accessible via web browser from anywhere on port 80.

  • EC2's and their security groups should be created on AWS console.

  • Security groups should be attached to EC2's with at least permission rule.

  • The rest of the process has to be controlled with control node which is connected SSH port.

  • Codes written by developers and should be pulled from repository into the control node and sent them to the EC2's from here with Ansible.

  • Postgresql, Nodejs and React parts has to be placed in docker container.

  • Your project manager wants the DevOps team to launch an EC2 for each postgresql, nodejs and react docker container. In addition, he asks to write three different playbook groups for this project.

    • First one is to write playbook to control all process for each worker instance separately.
    • Second one is to control all process in one playbook without using roles.
    • Third one is to control all process in one playbook using roles

In the architecture, you can configure your architecture with these conditions,

  • All process has to be controlled into the control Node

  • Dynamic inventory has to be used for inventory file.

  • Ansible config file has to be placed in control node.

  • Docker should be installed in all worker nodes using ansible.

  • File should be pulled from Github Repo at the beginning.

  • For PostgreSQL worker node

    • PostgreSQL files (Dockerfile and init.sql) should be sent into it from control node using ansible

    • Docker image should be created for PostgreSQL container and init.sql file should be placed under necessary folder.

    • Create PostgreSQL container. Do not forget to set password as environmental variable. This password has to be protected with ansible vault.

    • Please make sure this instance's security group should be accept traffic from PostgreSQL's dedicated port from Nodejs EC2 and port 22 from anywhere.

    • To keep database's data, volume has to be created with docker container and necessary file(s) should be kept under this file.

  • For Nodejs worker node

    • Please make sure to correct or create .env file under server folder based on PostgreSQL environmental variables

    • Nodejs's server folder should be sent into it from control node using ansible. This file will use for docker image. You don't need any extra file for creating Nodejs image.

    • Docker image should be built for Nodejs container

    • Create Nodejs container and publish it on port 5000

    • Please make sure this instance's security group should be accept traffic from 5000, 22 dedicated port from anywhere.

  • For React worker node

    • Please make sure to correct .env file under client folder based on Nodejs environmental variables

    • React's client folder should be sent into it from control node using ansible. This file will be used for docker image. You don't need any extra file for creating react image.

    • Docker image should be created for React container

    • Create React container and publish it on port 80

    • Please make sure this instance's security group should be accept traffic from 80, and 80 dedicated port from anywhere.

Expected Outcome

Todo Web Page

  • Check the status of containers on managed nodes

ansible all -m shell -a "docker ps -a"

containers

  • API Usage: Add todo using POST method

Replace your Node.js server DNS address and port number

curl --request POST \
--url 'http://3.90.229.142:5000/todos' \
--header 'content-type: application/json' \
--data '{"description":"Learn Ansible"}'

At the end of the project, following topics are to be covered;

  • Ansible playbook preparation without roles

  • Ansible playbook preparation with roles.

  • Bash scripting

  • AWS Security groups create and attach to EC2.

  • Launch EC2 and it's configurations

  • Write dockerfile for postgresql, nodejs and react images.

  • Docker image creation for postgresql, nodejs and react containers with ansible playbook

  • Docker container launching using created image with ansible playbook

  • Git & Github for Version Control System

At the end of the project, you will be able to;

  • Write Ansible playbook in different ways which are without Roles and with Roles

  • Apply web programming skills, importing packages within Nodejs and React Frameworks

  • Write Dockerfiles for different environments

  • Create containers which use React, Nodejs and PostgreSQL docker images

  • Configure connection to the PostgreSQL database.

  • Connect backend server to database

  • Configure Nodejs Framework

  • Connect frontend server to backend server

  • Configure React Framework for development environment

  • Configure React Framework for production environment

  • Demonstrate bash scripting skills using Ansible playbook to setup web-page on EC2 Instance.

  • Apply git commands (push, pull, commit, add etc.) and Github as Version Control System.

πŸ“š Resources

πŸ“ License

This project is under license from Apache. For more details, see the LICENSE file.

Made with ❀️ by devenes

Β 

⬆️ Back to top

You might also like...
Chat Loop is a highly scalable, low-cost, and high performant chat application built on AWS and React leveraging GraphQL subscriptions for real-time communication.
Chat Loop is a highly scalable, low-cost, and high performant chat application built on AWS and React leveraging GraphQL subscriptions for real-time communication.

Chat Loop is a highly scalable, low-cost, and high performant chat application built on AWS and React leveraging GraphQL subscriptions for real-time communication.

Example Of Fine-Tuning BERT For Named-Entity Recognition Task And Preparing For Cloud Deployment Using Flask, React, And Docker
Example Of Fine-Tuning BERT For Named-Entity Recognition Task And Preparing For Cloud Deployment Using Flask, React, And Docker

Example Of Fine-Tuning BERT For Named-Entity Recognition Task And Preparing For Cloud Deployment Using Flask, React, And Docker This repository contai

Visualize and manage your Docker networks.
Visualize and manage your Docker networks.

Follow us on DockerNet An easy-to-use, locally-hosted web app for developers and engineers to visualize and manage their Docker Networks in real-time.

Kanmail - An email client that functions like a kanban board, for Mac/Windows/Docker
Kanmail - An email client that functions like a kanban board, for Mac/Windows/Docker

Kanmail - An email client that functions like a kanban board, for Mac/Windows/Docker

Visual Docker Container Management on Mac & Windows
Visual Docker Container Management on Mac & Windows

⚠️ Deprecation Notice: This project and repository is now deprecated and is no longer under active development, see the related roadmap issue. Please

An example configuration of a fullstack Node app with PostgreSQL using Docker Compose
An example configuration of a fullstack Node app with PostgreSQL using Docker Compose

Usage To use this project make sure you have Docker installed then run the follo

Docker Tutorial | Nodejs + Express + Mongodb + React + Redis + Nginx| Nodejs + Express + Mongodb + React + Redis + Nginx

Docker Tutorial | Nodejs + Express + Mongodb + React + Redis + Nginx How to use Docker to build and develop Nodejs, Express, Mongodb, React, and Redis

HOUDINI - a curated list of Network Security related Docker Images for Network Intrusion purposes
HOUDINI - a curated list of Network Security related Docker Images for Network Intrusion purposes

🐳 HOUDINI: Hundreds of Offensive and Useful Docker Images for Network Intrusion HOUDINI is a curated list of Network Security related Docker Images f

Notes taking Project uses Python (Django, REST API) + React (SPA Frontend) + Docker (Compose).
Notes taking Project uses Python (Django, REST API) + React (SPA Frontend) + Docker (Compose).

Notes taking website. Try it! / But how to run? Description This is monorepository with notes website, with API and Frontend servers. Website provides

Owner
Enes
The best of me is yet to come β˜οΈπŸ§πŸ³β˜ΈοΈπŸ‘ΎπŸ‹πŸš’
Enes
react-express front & back end code challenge deployed on docker

Installation for Working Environment : Docker Install docker in Windows Install docker in Mac(Apple) Here's how you can install make Install make in W

Kyle Wilson 3 Mar 29, 2022
A Microservice Migration Helper And Dependency Manager Using Electron And React

Introducing bev bev (Bird’s Eye View) is a microservice migration helper and a dependency manager. Developed under tech accelerator, OS Labs, bev is a

OSLabs Beta 39 Apr 8, 2022
Todo Web Application Deployed on ECR to ECS Cluster with Jenkins Pipeline

Javascript web application ?? automated with Jenkins pipeline to create Docker image and push the image to AWS Elastic Container Registry (ECR) and deploy them on Elastic Container Service (ECS) Cluster.

Enes 1 Jun 11, 2022
A Realtime Chat Application based on React Native and Expo with backend as AWS Amplify

WhatAppClone based on React Native for iOS [WhatAppClone] is a basic chat application made with React-Native. NOTE:- BACKEND SUPPORT COMING SOON..(via

Aayush Jha 5 Oct 3, 2022
olx-clone using react js , firease as backend ,deployed in firebase , react-router,context,react hooks,olx web app project

OLX clone Start your own website like Olx in minutes with help of Sijeesh Miziha's Olx-Clone React App. Olx-Clone is the potential classified advertis

Sijeesh Miziha 43 Dec 29, 2022
This AWS Ecommerce Website is a multi-tier ecommerce web application that uses React, HTML, typescript, and Javascript

This AWS Ecommerce Website is a multi-tier ecommerce web application that uses React, HTML, typescript, and Javascript Outline Overview The goal of th

Alok Roy Chatterjee 4 Jun 4, 2022
A lightweight open source alternative to linktree, complete with Docker container that hosts your web server and code. Written in ReactJS SSR.

?? LittleLink-Server This project is based on the great work from littlelink It takes the same simple approach to a link page and hosts it within a No

TechnoTim 520 Jan 3, 2023
This is not the real NETFLIX, its a clone. Built with REACT JS, authenticated and deployed with firebase.

NETFLIX-CLONE This is not the real NETFLIX, its a clone. Built with REACT JS and authenticated with firebase. click here to view the finished page I u

Kevv_in 10 Dec 14, 2022
M Haidar Hanif's personal website with React, Remix, Stitches, Radix UI, and deployed to Vercel.

mhaidarhanif-web M Haidar Hanif's personal website with React+Remix. Deployed to Vercel. Current repo is at mhaidarhanif-web on GitHub. Variants The w

M Haidar Hanif 2 Nov 16, 2022
A basic Todo App built with React, React Hooks and deployed on Vercel

Todo App A basic responsive todo app for javascript beginners. Built with several javascript concepts and hooks to help beginners start their programm

Imoh Precious 4 May 31, 2022