├── deploy_warfile_on_tomcat_server_using_maven.md ├── jenkins_installation.md ├── setup_artifactory.md ├── setup_maven.md └── tomcat_installation.MD /deploy_warfile_on_tomcat_server_using_maven.md: -------------------------------------------------------------------------------- 1 | # How to deploy on tomcat server using maven 2 | Pre-requisites 3 | 1. Maven Server [Get help here] 4 | 2. Tomcat Server [Get help here] 5 | 6 | Procedure 7 | 8 | 1. download archetype maven-archetype-webapp 9 | ```sh 10 | mvn archetype:generate -DgroupId=com.valaxy.webapp -DartifactId=helloworld-project -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false 11 | ``` 12 | 13 | 1. Update pom.xml code to add maven plugin to copy artifacts onto tomcat 14 | this should be under 15 | ```sh 16 | 17 | 18 | org.apache.tomcat.maven 19 | tomcat7-maven-plugin 20 | 2.2 21 | 22 | http://localhost:8080/manager/text 23 | TomcatServer 24 | /helloworld-webapp 25 | 26 | 27 | 28 | ``` 29 | 30 | 1. create settings.xml for credentials 31 | ```sh 32 | 33 | 34 | 35 | 36 | 37 | TomcatServer 38 | admin 39 | password 40 | 41 | 42 | 43 | 44 | ``` 45 | 46 | 47 | 1. Build and the project on tomcat 48 | ```sh 49 | mvn tomcat7:deploy 50 | ``` 51 | -------------------------------------------------------------------------------- /jenkins_installation.md: -------------------------------------------------------------------------------- 1 | # Install Jenkins on AWS EC2 2 | Jenkins is a self-contained Java-based program, ready to run out-of-the-box, with packages for Windows, Mac OS X and other Unix-like operating systems. As an extensible automation server, Jenkins can be used as a simple CI server or turned into the continuous delivery hub for any project. 3 | 4 | 5 | ### Prerequisites 6 | 1. EC2 Instance 7 | - With Internet Access 8 | - Security Group with Port `8080` open for internet 9 | 1. Java v1.8.x 10 | 11 | ## Install Java 12 | 1. We will be using open java for our demo, Get the latest version from http://openjdk.java.net/install/ 13 | ```sh 14 | yum install java-1.8* 15 | #yum -y install java-1.8.0-openjdk-devel 16 | ``` 17 | 18 | 1. Confirm Java Version and set the java home 19 | ```sh 20 | java -version 21 | find /usr/lib/jvm/java-1.8* | head -n 3 22 | JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk- 23 | export JAVA_HOME 24 | PATH=$PATH:$JAVA_HOME 25 | # To set it permanently update your .bash_profile 26 | vi ~/.bash_profile 27 | ``` 28 | _The output should be something like this,_ 29 | ```sh 30 | [root@~]# java -version 31 | openjdk version "1.8.0_151" 32 | OpenJDK Runtime Environment (build 1.8.0_151-b12) 33 | OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode) 34 | ``` 35 | 36 | ## Install Jenkins 37 | You can install jenkins using the rpm or by setting up the repo. We will set up the repo so that we can update it easily in the future. 38 | 1. Get the latest version of jenkins from https://pkg.jenkins.io/redhat-stable/ and install 39 | ```sh 40 | yum -y install wget 41 | sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo 42 | sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key 43 | yum -y install jenkins 44 | ``` 45 | 46 | ### Start Jenkins 47 | ```sh 48 | # Start jenkins service 49 | service jenkins start 50 | 51 | # Setup Jenkins to start at boot, 52 | chkconfig jenkins on 53 | ``` 54 | 55 | ### Accessing Jenkins 56 | By default jenkins runs at port `8080`, You can access jenkins at 57 | ```sh 58 | http://YOUR-SERVER-PUBLIC-IP:8080 59 | ``` 60 | #### Configure Jenkins 61 | - The default Username is `admin` 62 | - Grab the default password 63 | - Password Location:`/var/lib/jenkins/secrets/initialAdminPassword` 64 | - `Skip` Plugin Installation; _We can do it later_ 65 | - Change admin password 66 | - `Admin` > `Configure` > `Password` 67 | - Configure `java` path 68 | - `Manage Jenkins` > `Global Tool Configuration` > `JDK` 69 | - Create another admin user id 70 | 71 | ### Test Jenkins Jobs 72 | 1. Create “new item” 73 | 1. Enter an item name – `My-First-Project` 74 | - Chose `Freestyle` project 75 | 1. Under the Build section 76 | Execute shell: echo "Welcome to Jenkins Demo" 77 | 1. Save your job 78 | 1. Build job 79 | 1. Check "console output" 80 | 81 | -------------------------------------------------------------------------------- /setup_artifactory.md: -------------------------------------------------------------------------------- 1 | # Artifacotry Setup 2 | An artifact repository manages your end-to-end artifact lifecycle and supports different software package management systems while providing consistency to your CI/CD workflow. An artifact repository is both a source for artifacts needed for a build and a target to deploy artifacts generated in the build process. 3 | 4 | JFrog Artifactory is a universal DevOps solution providing end-to-end automation and management of binaries and artifacts through the application delivery process that improves productivity across your development ecosystem. It enables freedom of choice supporting 25+ software build packages, all major CI/CD platforms, and DevOps tools you already use. 5 | 6 | ## Pre-requisites: 7 | 1. An AWS T2.small EC2 instance (Linux) 8 | 1. Open port 8081 and 8082 in the security group 9 | 10 | ## Installation Steps 11 | 12 | 1. Login to instance as a `root` user and install Java 13 | ```sh 14 | yum install java-1.8* -y 15 | ``` 16 | 1. Download Artifactory packages onto /opt/ 17 | For Latest version of Artifactory OSS [download it from here](https://jfrog.com/open-source/) 18 | For Older version of Artifactory OSS [download it from here](https://jfrog.bintray.com/artifactory/) 19 | For Latest version of Artifactory Pro [download it from here](https://jfrog.com/artifactory/) 20 | 21 | ```sh 22 | cd /opt 23 | wget https://jfrog.bintray.com/artifactory/jfrog-artifactory-oss-6.9.6.zip 24 | ``` 25 | 26 | 1. extract artifactory tar.gz file 27 | ```sh 28 | unzip jfrog-artifactory-oss-6.9.6.zip 29 | ``` 30 | 1. Go inside to bin directory and start the services 31 | ```sh 32 | cd /opt/jfrog-artifactory-oss-6.9.6/bin 33 | ./artifactory.sh start 34 | ``` 35 | 1. access artifactory from browser 36 | ```sh 37 | http://:8081 38 | ``` 39 | 40 | 1. Provide credentials 41 | ```sh 42 | username: admin 43 | password: passwrod 44 | ``` 45 | 46 | ## Not able to start Artifactory services? 47 | Make sure You meet the Artifactory [system requirements](https://www.jfrog.com/confluence/display/JFROG/System+Requirements) 48 | 49 | --- 50 | --- 51 | 52 | ### Integrate Artifactory with Jenkins [Click here](https://youtu.be/BVxhLIfunmI) 53 | ### Integrate Artifactory with Maven [Yet to release]() 54 | ### How to install Maven on EC2 instance [Click here](https://youtu.be/wgfsVmHnAiM) 55 | ### How to install Jenkins on EC2 instance [Click here](https://youtu.be/M32O4Yv0ANc) 56 | -------------------------------------------------------------------------------- /setup_maven.md: -------------------------------------------------------------------------------- 1 | # Install & configure Maven build tool on Jenkins 2 | Maven is a code build tool which used to convert your code to artifact. this is widely used plugin to build in continuous integration 3 | 4 | #### Follow this artical in **[YouTube](https://www.youtube.com/watch?v=wgfsVmHnAiM)** 5 | 6 | #### Prerequisites 7 | 1. Jenkins server **[Get Help Here](https://www.youtube.com/watch?v=M32O4Yv0ANc) 8 | 9 | #### Install Maven on Jenkins 10 | Download maven packages https://maven.apache.org/download.cgi onto Jenkins server. In this case I am using /opt/maven as my installation directory 11 | - Link : https://maven.apache.org/download.cgi 12 | ```sh 13 | # Creating maven directory under /opt 14 | mkdir /opt/maven 15 | cd /opt/maven 16 | # downloading maven version 3.6.0 17 | wget http://mirrors.fibergrid.in/apache/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.zip 18 | unzip /opt/maven/apache-maven-3.6.0-bin.zip 19 | ``` 20 | 21 | Setup M2_HOME and M2 paths in .bash_profile of user and add these to path variable 22 | ```sh 23 | vi ~/.bash_profile 24 | M2_HOME=/opt/maven/apache-maven-3.6.0 25 | M2=$M2_HOME/bin 26 | PAHT=:$M2_HOME:$M2 27 | ``` 28 | #### Check point 29 | logoff and login to check maven version 30 | Check maven version 31 | ```sh 32 | mvn –version 33 | ``` 34 | So far you have completed installation of maven software to support maven plugin on jenkins console. Let's jump onto jenkins to complete remining steps. 35 | 36 | #### Setup maven on jenkins console 37 | - Install maven plugin without restart 38 | - `Manage Jenkins` > `Jenkins Plugins` > `available` > `Maven Invoker` 39 | 40 | #### (Update) Install "Maven Integration" Plugin as well 41 | - Install maven Integration Plugin without restart 42 | - `Manage Jenkins` > `Jenkins Plugins` > `available` > `Maven Integration` 43 | 44 | - Configure java path 45 | - `Manage Jenkins` > `Global Tool Configuration` > `Maven` 46 | 47 | #### Next Steps 48 | 49 | - [x] [Configure Users & Groups in Jenkins](https://youtu.be/jZOqcB32dYM) 50 | - [x] [Secure your Jenkins Server](https://youtu.be/19FmJumnkDc) 51 | - [x] [Jenkins Plugin Installation](https://youtu.be/p_PqPBbjaZ4) 52 | - [x] [Jenkins Master-Slave Configuration](https://youtu.be/hwrYURP4O2k) 53 | -------------------------------------------------------------------------------- /tomcat_installation.MD: -------------------------------------------------------------------------------- 1 | # Tomcat installation on EC2 instance 2 | 3 | ### Pre-requisites 4 | 1. EC2 instance with Java v1.8.x 5 | 6 | ### Install Apache Tomcat 7 | 1. Download tomcat packages from https://tomcat.apache.org/download-80.cgi onto /opt on EC2 instance 8 | ```sh 9 | # Create tomcat directory 10 | cd /opt 11 | wget http://mirrors.fibergrid.in/apache/tomcat/tomcat-8/v8.5.35/bin/apache-tomcat-8.5.35.tar.gz 12 | tar -xvzf /opt/apache-tomcat-8.5.35.tar.gz 13 | ``` 14 | 1. give executing permissions to startup.sh and shutdown.sh which are under bin. 15 | ```sh 16 | chmod +x /opt/apache-tomcat-8.5.35/bin/startup.sh 17 | shutdown.sh 18 | ``` 19 | 20 | 1. create link files for tomcat startup.sh and shutdown.sh 21 | ```sh 22 | ln -s /opt/apache-tomcat-8.5.35/bin/startup.sh /usr/local/bin/tomcatup 23 | ln -s /opt/apache-tomcat-8.5.35/bin/shutdown.sh /usr/local/bin/tomcatdown 24 | tomcatup 25 | ``` 26 | #### Check point : 27 | access tomcat application from browser on port 8080 28 | - http://:8080 29 | 30 | Using unique ports for each application is a best practice in an environment. But tomcat and Jenkins runs on ports number 8080. Hence lets change tomcat port number to 8090. Change port number in conf/server.xml file under tomcat home 31 | ```sh 32 | cd /opt/apache-tomcat-8.5.35/conf 33 | # update port number in the "connecter port" field in server.xml 34 | # restart tomcat after configuration update 35 | tomcatdown 36 | tomcatup 37 | ``` 38 | #### Check point : 39 | Access tomcat application from browser on port 8090 40 | - http://:8090 41 | 42 | 1. now application is accessible on port 8090. but tomcat application doesnt allow to login from browser. changing a default parameter in context.xml does address this issue 43 | ```sh 44 | #search for context.xml 45 | find / -name context.xml 46 | ``` 47 | 1. above command gives 3 context.xml files. comment () `Value ClassName` field on files which are under webapp directory. 48 | After that restart tomcat services to effect these changes 49 | ```sh 50 | tomcatdown 51 | tomcatup 52 | ``` 53 | 1. Update users information in the tomcat-users.xml file 54 | goto tomcat home directory and Add below users to conf/tomcat-user.xml file 55 | ```sh 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | ``` 64 | 1. Restart serivce and try to login to tomcat application from the browser. This time it should be Successful 65 | 66 | --------------------------------------------------------------------------------