├── .gitignore ├── AWS EC2 ├── Connect_to_EC2_via_SSH.md ├── Dollarphotoclub_57987679.jpg ├── EC2_Setup.md └── Screenshot 2023-03-20 at 4.38.34 pm.png ├── Docker └── Docker_Setup.md ├── Jenkins ├── Jenkins_Git_Integration.md ├── Jenkins_Maven_Integration.md └── Jenkins_Setup.md ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | -------------------------------------------------------------------------------- /AWS EC2/Connect_to_EC2_via_SSH.md: -------------------------------------------------------------------------------- 1 | # Connect to AWS EC2 via SSH 2 | 3 | - Download a SSH Client. 4 | * Name: "MobaXterm" 5 | - Open MobaXterm SSH Client. 6 | - Configure MobaXterm SSH Client. 7 | * Press the button "Session". There you can see "Session settings" 8 | * Press the button "SSH" 9 | * Configure "Basic SSH settings" 10 | * Update "Remote host" - "Public IPv4 address" 11 | * Specify "username" - "ec2-user" 12 | * Port: "22" 13 | * Press "Advanced SSH settings" 14 | * Configure "Advanced SSH settings" 15 | * Press the button "Use private key" 16 | * Find the pem key. 17 | * Choose the key. 18 | * Protocol: "SFTP" 19 | * Compression: "Yes" 20 | * X-11-Forwarding: "Yes" 21 | 22 | 23 | -------------------------------------------------------------------------------- /AWS EC2/Dollarphotoclub_57987679.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sunagatov/DevOps/105d0cbd267dca206b72e237005df876f6f90a85/AWS EC2/Dollarphotoclub_57987679.jpg -------------------------------------------------------------------------------- /AWS EC2/EC2_Setup.md: -------------------------------------------------------------------------------- 1 | # AWS EC2 Setup 2 | 3 | - Open AWS UI dashboard. 4 | - Find AWS EC2 Service. 5 | - Press the button "Launch AWS EC2 instance" 6 | - Choose Amazon Machine Image (AMI) 7 | * Name: "Amazon Linux 2 Kernel 64-bit (x86)" 8 | - Choose an instance type 9 | * Name: "r2.micro" 10 | - Add storage 11 | * Name: "General purpose SSD (gp2) 8 GiB" 12 | - Add tags 13 | * Key: "Name" 14 | * Value: "Jenkins_Server" 15 | - Configure Security Group 16 | * Create a new security group 17 | * Name: "DevOps_Project_Security_Group" 18 | * Description: "DevOps_Project_Security_Group" 19 | * Add a new custom TCP rule 20 | * Port Range: "8080" 21 | * Protocol: "TCP" 22 | * Source: "0.0.0.0/0" 23 | * Source: "::/0" 24 | * Source Type: "Custom" 25 | - Create a new key pair: 26 | * Type: "RSA" 27 | * Name: "DevOps_Project_RSA_Key" 28 | * Key file format: "pem" 29 | 30 | 31 | -------------------------------------------------------------------------------- /AWS EC2/Screenshot 2023-03-20 at 4.38.34 pm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sunagatov/DevOps/105d0cbd267dca206b72e237005df876f6f90a85/AWS EC2/Screenshot 2023-03-20 at 4.38.34 pm.png -------------------------------------------------------------------------------- /Docker/Docker_Setup.md: -------------------------------------------------------------------------------- 1 | # Docker Setup 2 | 3 | ### Connect to AWS EC2 Instance 4 | - Choose root user 5 | * Command _"_**sudo su -**_"_ 6 | 7 | ### Install Docker 8 | - Execute these commands 9 | * yam install docker -y 10 | 11 | ### Launch Docker 12 | - Execute these commands 13 | * service docker start 14 | 15 | ### Check Docker Status 16 | - Execute these commands 17 | * service docker status 18 | 19 | -------------------------------------------------------------------------------- /Jenkins/Jenkins_Git_Integration.md: -------------------------------------------------------------------------------- 1 | # Jenkins - Git Integration 2 | 3 | ### Connect to AWS EC2 Instance 4 | - Choose root user 5 | * Command _"_**sudo su -**_"_ 6 | 7 | ### Install Git 8 | - Execute these commands 9 | * yum install git 10 | 11 | ### Install Github Jenkins Plugin 12 | - Open a web browser 13 | - Open Jenkins UI using your EC2 instance url and 8080 port. 14 | - Press the button "Manage Jenkins" 15 | - Press the button "Manage Plugins" 16 | - Press the button "Available plugins" 17 | - Find "Github" plugin 18 | - Press the button "Install without restart" 19 | 20 | ### Configure Git 21 | - Press the button "Manage Jenkins" 22 | - Press the button "Global Tool Configuration" 23 | - Configure Git section 24 | * Name: "Git" 25 | * Path to Git executable 26 | * Execute these commands "whereis git" 27 | * Copy this path to the Git section - /usr/bin/git 28 | 29 | ### Configure Github Jenkins Plugin 30 | - Press the button "New item" 31 | * Name: "Pull_Code_From_Github" 32 | - Choose "Freestyle project" 33 | - Press the button "OK" 34 | - Add the description 35 | * Description: "Pull code from Github" 36 | - Choose "Source Code Management" 37 | * Option: "Git" 38 | - Provide repository url from Github 39 | - Press the button "Apply" 40 | - Press the button "OK" 41 | 42 | # Jenkins job is created! 43 | 44 | If you press the button "Build now". Git will pull the project from the Github to the EC2 Instance. 45 | You can check the project using the command "cd /var/lib/jenkins/workspace/" 46 | 47 | -------------------------------------------------------------------------------- /Jenkins/Jenkins_Maven_Integration.md: -------------------------------------------------------------------------------- 1 | # Jenkins - Apache Maven Integration 2 | 3 | ### Connect to AWS EC2 Instance 4 | - Choose root user 5 | * Command _"_**sudo su -**_"_ 6 | 7 | ### Install Java 8 | - Execute these commands 9 | * amazon-linux-extras install java-openjdk11 10 | 11 | ### Download Apache Maven 12 | - Visit Apache Maven website 13 | * Link: _"https://maven.apache.org/"_ 14 | - Go to Download page 15 | * Link: _"https://maven.apache.org/download.cgi"_ 16 | - Choose Apache Maven "Binary tar.gz archive" version 17 | - Copy the link of "Binary tar.gz archive" 18 | - Go back to EC2 Instance terminal. 19 | - Open the "opt" directory 20 | * Execute these commands _"cd /opt/"_ 21 | - Download the Apache Maven 22 | * wget https://dlcdn.apache.org/maven/maven-3/3.9.0/binaries/apache-maven-3.9.0-bin.tar.gz 23 | - Unrchive the Apache Maven file 24 | * tar xzvf apache-maven-3.9.0-bin.tar.gz 25 | - Rename the Apache Maven directory 26 | * mv apache-maven-3.9.0 maven 27 | * cd /maven/ 28 | 29 | ### Add Apache Maven to the Linux OS Classpath 30 | - Open the "root" directory 31 | * Execute these commands _"cd ~"_ 32 | - Edit ".bash_profile" file 33 | * Execute the command "**_vi .bash_profile"_** 34 | - Press the button "Esc" 35 | - Press the button "i" 36 | - Add the JAVA_HOME path 37 | * Execute the command "**_find / -name java*"_** 38 | * Find the java 11 path 39 | * Copy the path 40 | * Add the path to the JAVA_HOME variable 41 | - Add the MAVEN_HOME path 42 | * /opt/maven 43 | - Add the M2 path 44 | * /opt/maven/bin 45 | - Update the PATH variable - PATH=$PATH:$HOME/bin 46 | * Add this value "$JAVA_HOME:$M2_HOME:$M2" 47 | * Result: "PATH=$PATH:$HOME/bin:$JAVA_HOME:$M2_HOME:$M2" 48 | - Save the file 49 | * Press the button "Esc" 50 | * Press the button "Shift" + ":" 51 | * Execute "wq" 52 | - Accept ".bash_profile" file changes 53 | * Execute the command "**_source .bash_profile*"_** 54 | - Check the maven version now 55 | * Execute the command "**_mvn -v*"_** 56 | 57 | ### Install Github Jenkins Plugin 58 | - Open a web browser 59 | - Open Jenkins UI using your EC2 instance url and 8080 port. 60 | - Press the button "Manage Jenkins" 61 | - Press the button "Manage Plugins" 62 | - Press the button "Available plugins" 63 | - Find "Maven" plugin 64 | - Press the button "Install without restart" 65 | 66 | ### Configure Apache Maven 67 | - Press the button "Manage Jenkins" 68 | - Press the button "Global Tool Configuration" 69 | - Configure Maven section 70 | - Configure JDK section 71 | * Name: "JAVA_11" 72 | * Path to "java 11 bin" 73 | - Configure Maven section 74 | * Name: "MAVEN_3.9.0" 75 | * Path to Maven "/opt/maven" 76 | 77 | ### Configure Apache Maven Jenkins Plugin 78 | - Press the button "New item" 79 | * Name: "**First_Maven_Project**" 80 | - Choose "Maven project" 81 | - Press the button "OK" 82 | - Add the description 83 | * Description: "First Maven Project" 84 | - Choose "Source Code Management" 85 | * Option: "Git" 86 | - Provide repository url from Github 87 | - Go to "Build Section" 88 | * Go to "Goals and options" 89 | * Add goals "clean install" 90 | - Press the button "Apply" 91 | - Press the button "OK" 92 | 93 | # Apache Maven job is created! 94 | 95 | If you press the button "Build now". 96 | Git will pull the project from the Github to the EC2 Instance. 97 | Then Apache Maven will build the project with specified goals. 98 | You can check the project using the command "cd /var/lib/jenkins/workspace/" 99 | 100 | 101 | -------------------------------------------------------------------------------- /Jenkins/Jenkins_Setup.md: -------------------------------------------------------------------------------- 1 | # Jenkins Setup 2 | 3 | ### Connect to AWS EC2 Instance 4 | - Choose root user 5 | * Command _"_**sudo su -**_"_ 6 | 7 | 8 | ### Install Java 9 | - Execute these commands 10 | * amazon-linux-extras install java-openjdk11 11 | 12 | 13 | ### Download Jenkins 14 | - Visit Jenkins website 15 | * Link: _"https://www.jenkins.io/"_ 16 | 17 | - Go to Download page 18 | * Link: _"https://www.jenkins.io/download/"_ 19 | 20 | - Choose Jenkins version for particular OS 21 | * OS Name: _**"Red Hat/Fedora/Alma/Rocky/CentOS"**_ 22 | * Link: _"https://pkg.jenkins.io/redhat-stable/"_ 23 | 24 | ### Install Jenkins 25 | - Execute these commands 26 | * sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo 27 | * sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key" 28 | * yum install jenkins 29 | 30 | ### Open Jenkins 31 | - Open a web browser 32 | - Open Jenkins UI using your EC2 instance url and 8080 port. 33 | - Insert a password 34 | * Retrieve password using command: _**"cat /var/lib/jenkins/secrets/initialAdminPassword"**_ 35 | 36 | 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Zufar Sunagatov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DevOps 2 | This repository contains an example of typical DevOps pipeline for a modern IT project. 3 | 4 | Technologies: 5 | * Docker 6 | * Kubernetes 7 | * AWS EC2 8 | * Terraform 9 | * Jenkins 10 | --------------------------------------------------------------------------------