About | Project Architecture | Technologies | Requirements | Case Study Details | License | Author
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.
The following tools were used in this project:
Before starting :checkered_flag:, you need to have Git, Node, Docker, Terraform, Ansible, React and AWS account.
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.
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.
ansible all -m shell -a "docker ps -a"
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"}'
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
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.
This project is under license from Apache. For more details, see the LICENSE file.
Made with :heart: by devenes