The aim of the project is to Automate Machine/Environment Creation On Amazon Web Service , so you can make your Environment up or down in short time and with a few scripts.
We need to create the below machine , so we can build and deploy any App using a CI pipeline consisting of Docker, GitHub, Jenkins, and Docker Registry.
-
Bastion : Machine with ubuntu OS which hosts wm-devop folder with all DevOps Scripts. To make the Environment up ,all the Script should be run from there .
-
Jenkins : Machine with ubuntu OS for Continouse Integration /Continouse Delivery.
-
Registry: Machine with ubuntu OS to act as Docker Local Registry .
-
Swarm:(Node-1"Leader",Node-2"Worker",Node-3"Worker") : Machines with Rancher OS to act as Docker Swarm Cluster .
The following diagram illustrates the CI pipeline that "you need to configure by Yourself" after machine creation on AWS: The pipeline will be kicked off by a commit to a GitHub repository. The commit will cause Jenkins machine to run (3) build+push to Docker Registry Machine, and upon successful completion of these jobs, pull new images from DR and deploy the app on Swarm cluster using docker-compose. The following diagram illustrates the CI pipeline.
What things you need to install the software and how to install them
1- Install the below tools locally on your Machine
A step by step that tell you How to get your env running
1- Generate the ssh key for your machine ,then Copy id_rsa.pub in wm-devop\ssh folder
Run This Command (ssh-keygen) on your commandline ,the output will be generated by default in **<UserHome>/.ssh/id_rsa.pub**
2- Edit AWS-ENV-Config.sh with your AWS Account details (ex: AWS_ACCESS_KEY and AWS_SECRET_ACCESS_KEY)
3- Run only one time AWS-Volume.Sh: to Create Backup Volume for Jenkins machine.
4- Then Run This Script EntryPoint_ENVSetup.sh on your commandline , use Git Bash if you are in Windows
5- Open your AWS Consule , Then you should see the above Machines up and running in your EC2 Frankfurt region .
-
AWS-ENV-Config.sh - This Scrpt will Export AWS Access & secret key and Region
-
EntryPoint_ENVSetup.sh - This Script will prepare the entry point to setup the Environment by doing the below:
- Delete Bastion Machine on AWS using this Script AWS-Machine-Terminate.sh
- Delet existing Bastion Security Group on AWS using this script AWS-SG-Delete.sh
- Add Bastion Security Group on AWS using this script AWS-SG-Add-Bastion.sh
- Create Bastion Machine on AWS + Docker machine +AWS Command line on it using this script AWS_Bastion_Ubuntu.sh
- Run ENVSetup.sh script on Bastion Machine
-
ENVSetup.sh - This Script will Setup the Environment and Create Swarm ,Registry,Jenkins Machines
- Create Swarm Security Group using this script AWS-SG-Add-Swarm.sh
- Create Swarm Machines on AWS using this Script AWS-swarm-cluster-RancherOS.sh
- Create Registry Security Group using this Script AWS-SG-Add-Registry.sh
- Create Registry Machine on AWS using this Script DockerRegistry.sh
- Create jenkins Security Group using this Script AWS-SG-Add-Jenkins.sh
- Create jenkins Machines on AWS using this Script Jenkins.sh
-
ENVShutdown.sh - This Script will Delete all the machine and it's security Group, except Bastion..please notice You need to run this Script from Bastion
-
AWS-Machine-Terminate.sh - This Script will Terminate any machine but it takes machine name as input in Shell
-
AWS-SG-Delete.sh - This Script will Delete any Security Group but it takes Security Group name as input in Shell
-
AWS-Volume.Sh - This Script will Create an EBS volume that can be attached to an instance in the same Availability Zone and Making an Amazon EBS Volume Available for Use. you need this Volume as Backup point not to lose your data after you terminate the machine
1- You can Create SSH Key-Pair of your machine and the remote machines like Jenkis and Bastion and save them In wm-devop\ssh To Avoid Re-create Key-Pair each time you Re-create the machine after it's termination.
2- You don't need to create Bastion machine , for example : You Can create run This script DockerRegistry.sh directly to create only Docker Registry machine.
3- If you need to Setup Jenkins Machine Only <YOU NEED TO RUN THIS SCRIPT AWS-Volume.Sh Only one time> then you can run Jenkins.sh directly any time after that without any prerequists.
4- You can update the Variable section and Comment or un-comment any section in the scripts to match your requirements.
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
We need to use Ansible to do the same task.
We can use SemVer for versioning.
list of [contributors]who participated in this project: