diff --git a/day-01 b/01 - git
similarity index 100%
rename from day-01
rename to 01 - git
diff --git a/day-06 b/06 - ansible
similarity index 98%
rename from day-06
rename to 06 - ansible
index 980c7a8..8710217 100644
--- a/day-06
+++ b/06 - ansible
@@ -222,3 +222,4 @@ TO EXECUTE: ansible-playbook playbbok.yml
- docker*
- java-1.8.0-openjdk*
- tree*
+ansible-playbook playbook.yml --syntax (this will show any errors in playbook)
diff --git a/day-07 b/07 - ansible
similarity index 100%
rename from day-07
rename to 07 - ansible
diff --git a/day-08 b/08 - ansible
similarity index 92%
rename from day-08
rename to 08 - ansible
index d8ff568..e390bb5 100644
--- a/day-08
+++ b/08 - ansible
@@ -104,3 +104,13 @@ dev-2: mysql -- > ms
test-1: python -- > py
test-2: NumPy and Pandas -- > n & p
+- hosts: all
+ tasks:
+ - name: installing apache
+ yum: name=httpd state=present
+ - name: installing mysql
+ yum: name=mysql state=present
+ - name: installing python
+ yum: name=python3 state=present
+
+
diff --git a/day-09 b/09 - ansible
similarity index 100%
rename from day-09
rename to 09 - ansible
diff --git a/day-10 b/10 - docker
similarity index 100%
rename from day-10
rename to 10 - docker
diff --git a/day-11 b/11 - docker
similarity index 100%
rename from day-11
rename to 11 - docker
diff --git a/day-12 b/12 - docker
similarity index 100%
rename from day-12
rename to 12 - docker
diff --git a/day-13 b/13 - docker
similarity index 100%
rename from day-13
rename to 13 - docker
diff --git a/day-20 b/20 - tfm
similarity index 100%
rename from day-20
rename to 20 - tfm
diff --git a/LAMP-stack b/LAMP-stack
new file mode 100644
index 0000000..b67f0ab
--- /dev/null
+++ b/LAMP-stack
@@ -0,0 +1,55 @@
+The LAMP stack is a popular open-source software stack used for web development.
+Linux
+
+Apache
+
+MySQL
+MySQL: This is the relational database management system (RDBMS) used to store and manage the website's data.
+
+PHP/Python/Perl
+-> PHP is a server-side scripting language used for developing dynamic web pages.
+
+WEB:"web" typically refers to the World Wide Web, which is a global information space accessible via the internet.
+
+"stack" refers to a set of software that is commonly used together to enable the hosting of dynamic websites and web applications.
+
+1. Install Apache:
+sudo apt update
+sudo apt install apache2
+sudo systemctl start apache2
+sudo systemctl enable apache2 (this is similar to chkconfig)
+
+2. Install MySQL:
+sudo apt install mysql-server
+sudo systemctl start mysql
+sudo systemctl enable mysql
+
+3. Install PHP:
+sudo apt install php libapache2-mod-php php-mysql
+sudo systemctl restart apache2
+
+Test Your LAMP Stack:
+echo "" | sudo tee /var/www/html/info.php
+
+Additional Considerations:
+Ensure that your firewall allows traffic on the necessary ports (80 for HTTP, 443 for HTTPS).
+Secure your MySQL installation by running the MySQL secure installation script: sudo mysql_secure_installation.
+
+
+for amazon linux:
+sudo yum update
+sudo yum install httpd
+sudo service httpd start
+sudo chkconfig httpd on
+
+sudo yum install mysql-server
+sudo service mysqld start
+sudo chkconfig mysqld on
+
+sudo mysql_secure_installation
+This script will prompt you to set a root password, remove anonymous users, and more.
+
+sudo yum install php php-mysql
+sudo service httpd restart
+
+echo "" | sudo tee /var/www/html/info.php
diff --git a/configmaps and secrets b/configmaps and secrets
new file mode 100644
index 0000000..0244250
--- /dev/null
+++ b/configmaps and secrets
@@ -0,0 +1,28 @@
+to pass env variables using ENV
+
+kubectl create deploy deployname --image=mariadb
+kubectl set env deploy deployname MYSQL_ROOT_PASSWORD=sumo97
+cmnd: kubectl get po
+cmnd: kubectl delete deploy deployname
+
+to pass env variables using ENVFROM-file
+
+ vim abc
+MYSQL_ROOT_PASSWORD=sumo97
+MYSQL_USER=admin
+
+kubectl create cm cmname --from-env-file=abc
+kubectl get cm
+kubectl describe cm cmname
+kubectl create deploy deployname --image=mariadb
+kubectl get po
+kubectl set env deploy deployname --from=configmap/cmname
+kubectl get po
+kubectl delete deploy deployname
+
+SECRETS:
+kubectl create deploy deployname --image=mariadb
+kubectl get po
+kubectl create secret generic pswdname --from-literal=ROOT_PASSWORD=sumo97
+kubectl get secrets
+kubectl describe secrets
diff --git a/day-04 b/day-04
index 1b12b6e..a45e859 100644
--- a/day-04
+++ b/day-04
@@ -40,7 +40,6 @@ S : STEPS
SINGLE STAGE: this pipeline will have only one stage.
-
pipeline {
agent any
@@ -54,18 +53,6 @@ pipeline {
}
-pipeline {
- agent any
-
- stages {
- stage('raham') {
- steps {
- sh 'touch file2'
- }
- }
- }
-}
-
MULTI STAGE: this pipeline will have more than one stage.
EXAMPLE-1:
@@ -86,23 +73,6 @@ pipeline {
}
}
-EXAMPLE-2:
-pipeline {
- agent any
-
- stages {
- stage('cpu') {
- steps {
- sh 'lscpu'
- }
- }
- stage('mem') {
- steps {
- sh 'lsmem'
- }
- }
- }
-}
CI PIPELINE:
@@ -193,25 +163,6 @@ pipeline {
}
}
-EXAMPLE-2:
-pipeline {
- agent any
-
- stages {
- stage('one') {
- steps {
- git 'https://github.com/devopsbyraham/jenkins-java-project.git'
- sh '''
- mvn compile
- mvn test
- mvn package
- mvn install
- mvn clean package
- '''
- }
- }
- }
-}
USER INPUT:
pipeline {
@@ -329,26 +280,26 @@ ALTERNATIVES: NGINX, IIS, WEBSPHERE, JBOSS, GLASSFISH
SETUP:
-INSTALL JAVA: amazon-linux-extras install java-openjdk11 -y
-
-STEP-1: DOWNLOAD TOMCAT (dlcdn.apache.org)
+vim tomcat.sh
+#
+amazon-linux-extras install java-openjdk11 -y
wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.83/bin/apache-tomcat-9.0.83.tar.gz
-
-STEP-2: EXTRACT THE FILES
tar -zxvf apache-tomcat-9.0.83.tar.gz
+sed -i '56 a\' apache-tomcat-9.0.83/conf/tomcat-users.xml
+sed -i '57 a\' apache-tomcat-9.0.83/conf/tomcat-users.xml
+sed -i '58 a\' apache-tomcat-9.0.83/conf/tomcat-users.xml
+sed -i '59 a\' apache-tomcat-9.0.83/conf/tomcat-users.xml
+sed -i '56d' apache-tomcat-9.0.83/conf/tomcat-users.xml
+sed -i '21d' apache-tomcat-9.0.83/webapps/manager/META-INF/context.xml
+sed -i '22d' apache-tomcat-9.0.83/webapps/manager/META-INF/context.xml
+sh apache-tomcat-9.0.83/bin/startup.sh
+#
-STEP-3: CONFIGURE USER, PASSWORD & ROLES
-vim apache-tomcat-9.0.83/conf/tomcat-users.xml
-
- 56
- 57
- 58
-
-STEP-4: DELETE LINE 21 AND 22
-vim apache-tomcat-9.0.83/webapps/manager/META-INF/context.xml
+NOTE:
+copy code from # to # and run the script i.e, sh tomcat.sh
-STEP-5: STARTING TOMCAT
-sh apache-tomcat-9.0.83/bin/startup.sh
+TO SHUTDOWN THE TOMCAT SERVER:
+sh apache-tomcat-9.0.83/bin/shutdown.sh
CONNECTION:
COPY PUBLIC IP:8080
@@ -394,9 +345,9 @@ pipeline {
steps {
deploy adapters: [
tomcat9(
- credentialsId: '056c3140-9f77-44c0-8b85-1f1435b918ea',
+ credentialsId: 'give cred id that you create',
path: '',
- url: 'http://3.84.101.170:8080/'
+ url: 'http://3.84.101.170:8080/'#(give tomcat url)
)
],
contextPath: 'netflix',
diff --git a/day-14 b/day-14
index 819edab..308cfbb 100644
--- a/day-14
+++ b/day-14
@@ -99,6 +99,7 @@ NOTE: When you download a command as binary file it need to be on /usr/local/bin
because all the commands in linux will be on /usr/local/bin
and need to give executable permission for that binary file to work as a command.
+A binary file is a computer file that contains data in a format that is not intended for humans to read.
POD:
diff --git a/day-17 b/day-17
index e298865..2f9371e 100644
--- a/day-17
+++ b/day-17
@@ -211,7 +211,7 @@ kubectl get al1
now opne second terminal
kubectl get po
-kubectl exec mydeploy-6bd88977d5-7s6t8 -it -- /bin/bash
+kubectl exec pod_name_id -it -- /bin/bash (this will not take you inside )
go to terminal one
kubectl get all : it will observer for every 2 seconds
@@ -227,74 +227,3 @@ now if the load gets down then after 5 minutes all the pods will go
these 5 minutes is called as cooldown period
-
- history:
- oot@ip-172-31-47-225 ~]# history
- 1 vim kops.sh
- 2 vim .bashrc
- 3 sh kops.sh
- 4 source .bashrc
- 5 sh kops.sh
- 6 kops validate cluster --wait 10m
- 7 cat kops.sh
- 8 kops validate cluster --wait 10m
- 9 export KOPS_STATE_STORE=s3://cloudanddevopsbyraham8899007.k8s.local
- 10 kops validate cluster --wait 10m
- 11 kubectl get svc
- 12 vim abc.yml
- 13 kubectl create -f abc.yml
- 14 kubectl get svc,deploy
- 15 kubectl delete -f abc.yml
- 16 vim abc.yml
- 17 kubectl create -f abc.yml
- 18 kubectl get svc,deploy
- 19 kubectl get po -o wide
- 20 kubectl delete -f abc.yml
- 21 vim abc.yml
- 22 kubectl create -f abc.yml
- 23 kubectl get svc,deploy
- 24 vim abc.yml
- 25 kubectl apply -f abc.yml
- 26 kubectl get svc,deploy
- 27 kubectl delete -f abc.yml
- 28 vim abc.yml
- 29 kubectl create -f abc.yml
- 30 kubectl get svc,deploy
- 31 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
- 32 minikube addons enable metrics-server #(only for minikube)
- 33 kubectl top nodes
- 34 kubectl top pods
- 35 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
- 36 kubectl top po
- 37 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yaml
- 38*
- 39 kubectl top po
- 40 kubectl top NO
- 41 kubectl top no
- 42 vim abc.yml
- 43 cat abc.yml
- 44 kubectl create -f abc.yml
- 45 vim abc.yml
- 46 kubectl create -f abc.yml
- 47 vim abc.yml
- 48 kubectl create -f abc.yml
- 49 vim abc.yml
- 50 cat abc.yml
- 51 vim abc.yml
- 52 kubectl create -f abc.yml
- 53 cat r
- 54 cat abc.yml
- 55 vim abc.yml
- 56 kubectl create -f abc.yml
- 57 vim abc.yml
- 58 kubectl create -f abc.yml
- 59 kubectl get po
- 60 kubectl get deploy
- 61 kubectl delete deploy swiggy-deploy
- 62 kubectl get deploy
- 63 kubectl autoscale deployment mydeploy --cpu-percent=20 --min=1 --max=10
- 64 kubectl get po
- 65 kubectl exec -it mydeploy-c5d4f9cbb-flsgk -- /bin/bash
- 66 kubectl get po
- 67 history
-
diff --git a/metric-server.sh , HPA b/metric-server.sh , HPA
new file mode 100644
index 0000000..fa68509
--- /dev/null
+++ b/metric-server.sh , HPA
@@ -0,0 +1,32 @@
+FOR MINIKUBE:
+kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
+minikube addons enable metrics-server #(only for minikube)
+
+FOR KOPS:
+kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
+https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yaml
+
+kubectl top nodes
+kubectl top pods
+kubectl get po --watch (THIS WILL MONITOR ALL POD ACTIVITIES)
+
+
+
+HORIZONTAL POD AUTOSCALLING: HPA
+
+TO SET MIN AND MAX POD LEVELS:
+
+kubectl autoscale deploy deployment_name --cpu-percent=20 --min=5 --max=10
+
+STRESS ON PODS:
+
+ kubectl exec -it pod_name -- /bin/bash (this will execute command by going inside of pod)
+
+ if image OS is UBUNTU
+ for stress: apt install stress -y
+ run the last command to increase stress on pod
+ cmnd: stress
+
+ if image OS is linux
+ cmnd: amazon-linux-extras install epel -y
+ cmnd: yum install stress -y
diff --git a/nexus-pipeline b/nexus-pipeline
new file mode 100644
index 0000000..dc33a88
--- /dev/null
+++ b/nexus-pipeline
@@ -0,0 +1,44 @@
+pipeline {
+ agent any
+
+ stages {
+ stage('checkout') {
+ steps {
+ git 'https://github.com/summu97/jenkins-java-project.git'
+ }
+ }
+ stage('build') {
+ steps {
+ sh 'mvn compile'
+ }
+ }
+ stage('test') {
+ steps {
+ sh 'mvn test'
+ }
+ }
+ stage('Artifact') {
+ steps {
+ sh 'mvn clean package'
+ }
+ }
+ stage('nexus'){
+ steps{
+ nexusArtifactUploader artifacts: [[artifactId: 'myweb', classifier: '', file: 'target/myweb-1.2.3.war', type: '.war']], credentialsId: '4296f906-995a-493e-b590-a9feeb7d8ebd', groupId: 'in.javahome', nexusUrl: '47.128.253.7:8081', nexusVersion: 'nexus3', protocol: 'http', repository: 'qwer', version: '1.2.2'
+ }
+ }
+ stage('Deployment') {
+ steps {
+ deploy adapters: [
+ tomcat9(
+ credentialsId: 'a73d7166-7ab5-4b64-bb5a-db27783eb31e',
+ path: '',
+ url: 'http://54.254.193.223:8080/'
+ )
+ ],
+ contextPath: 'netflix',
+ war: 'target/*.war'
+ }
+ }
+ }
+}
diff --git a/project-ansible-jenkins b/project-ansible-jenkins
new file mode 100644
index 0000000..77e03c9
--- /dev/null
+++ b/project-ansible-jenkins
@@ -0,0 +1,36 @@
+pipeline {
+ agent any
+
+ stages {
+ stage('checkout') {
+ steps {
+ git 'https://github.com/summu97/jenkins-java-project.git'
+ }
+ }
+ stage ('build'){
+ steps {
+ sh 'mvn compile'
+ }
+ }
+ stage ('test') {
+ steps {
+ sh 'mvn test'
+ }
+ }
+ stage ('artifact') {
+ steps {
+ sh 'mvn clean package'
+ }
+ }
+ stage ('nexus') {
+ steps {
+ nexusArtifactUploader artifacts: [[artifactId: 'myweb', classifier: '', file: 'target/myweb-1.2.3.war', type: '.war']], credentialsId: '20d3d740-8e7c-4994-95ed-57261696f691', groupId: 'in.javahome', nexusUrl: '18.142.50.68:8081', nexusVersion: 'nexus3', protocol: 'http', repository: 'abcde', version: '1.2.3'
+ }
+ }
+ stage ('deploy') {
+ steps {
+ ansiblePlaybook credentialsId: '304feef9-30d1-4777-bc05-623f8b3fce66', disableHostKeyChecking: true, installation: 'ansible', inventory: '/etc/ansible/hosts', playbook: '/etc/ansible/playbook.yml', vaultTmpPath: ''
+ }
+ }
+ }
+}