mvn archetype:generate -DgroupId=com.edureka.app -DartifactId=maven-demo -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false
- Sudo apt update
- Sudo apt install default-are
- Sudo apt install maven
- Sudo wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
- sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
- Sudo apt update
- Sudo apt install Jenkins
- Sudo sytemctl status Jenkins
- Sudo systemctl start Jenkins
- Goto the url - http:// : 8080/ as Jenkins runs on port 8080.
- sudo cat /var/lib/jenkins/secrets/initialAdminPassword
-You must have to log into just one gmail account (the one you are using to send email). -Then go to https://www.google.com/settings/security/lesssecureapps and Turn On this feature. -And last go to https://accounts.google.com/DisplayUnlockCaptcha and click Continue.
wget http://ec2-3-22-234-221.us-east-2.compute.amazonaws.com:8080/jnlpJars/slave.jar
java -jar agent.jar -jnlpUrl http://ec2-18-217-44-60.us-east-2.compute.amazonaws.com:8080/computer/Jenkins-slave1/slave-agent.jnlp -secret d89ca0328c7c3f92973aa8793cfbc022ce967bd7d4b84a8b372e49df74f055cf
java -jar agent.jar -jnlpUrl http://ec2-18-217-44-60.us-east-2.compute.amazonaws.com:8080/computer/jenkins-slave/slave-agent.jnlp -secret b9a39162860dc87b8f5669cd8183684592518b04ba38ac7a9d35329d2f9c9be9 -workDir "/var/lib/jenkins/"
- Apt update
- Apt install tomcat9
- Apt install tomcat9-admin
- Configure user in /var/lib/tomcat9/conf/tomcat-users.xml
- Configure http port from 8080 to 8888 in /var/lib/tomcat9/conf/server.xml
- Systemctl status tomcat9
- Systemctl start tomcat9
#Changing root password :
- Sudo su
- Passed root #Creating new User
- Adduser #Add user to Sudo group
- Usermod -aG sudo #Add Jenkins to sudo group
- Usermod -aG sudo Jenkins
- Put in sudoers.d/jenkins jenkins ALL=(ALL) NOPASSWD:ALL
- Install Chrome :
- sudo curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
- sudo echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
- sudo apt-get -y update
- sudo apt-get -y install google-chrome-stable
- Install Chrome Driver
- wget https://chromedriver.storage.googleapis.com/88.0.4324.96/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- Complete the CICD pipeline for address book project and ensure it is running on server.
- Create a new maven project for Selenium.
- Update pom.xml with selenium library, testng library and shade plugin.
- Push it to the GitHub repository.
- Create a job in Jenkins.
- And build and package your application as jar.
- Run jar to execute the selenium script. Note :
- ensure —headless argument is added while running on ubuntu
- Ensure that Jenkins user have given admin rights.
node{ stage('git checkout'){ sh 'mvn clean' git 'https://github.com/shubhamkushwah123/sel-repo.git' }
stage('build'){
sh 'mvn clean package'
}
stage('execute selenium test cases'){
sh 'sudo su -c "java -jar /var/lib/jenkins/workspace/selenium-test/target/test-my-app-0.0.1-SNAPSHOT-shaded.jar"'
}
}
- Sudo su
- Apt update
- Apt install -y docker
- Systemctl start docker
- Systemctl status docker
- Systemctl stop docker
- Docker —version
- FROM ubuntu:latest
- MAINTAINER Sahiti ([email protected])
- RUN apt-get update
- RUN apt-get install -y nginx
- ENTRYPOINT ["/usr/sbin/nginx","-g","daemon off;"]
- EXPOSE 80
docker build .
docker run -itd -p 8002:80 shubhamkushwah123/nginx:1.0
Docker version Docker build . Docker ps Docker ps -a Ps -ef | grep docker Docker run hello-world Docker run -d hello-world Docker run -d hello-world sleep 15 Docker run -itd ubuntu:latest Docker run —name my-containewr ubuntu Hostname -I Hostname -a / hostname -f
-i : interactive = exit to come out CTRL+P+Q -t : terminal - CTRL+P+Q to come out -d: detached – stop containerid to stop container
- Docker exec -it <container_id> /bin/bash
Docker rm -f <container_id>
Docker ru -itd ubuntu:latest
Docker attach <container_id>
- Docker start < container_id>
- Docker stop <container_id>
- Docker pause <container_id>
- Docker unpause <container_id>
Docker run -it —memory=“128M” —cpus=“1.0”
- Docker run -itd tomcat:latest
- Docker run -p 20000:8080 —name=my-tomcat tomcat:latest
- Docker run -itd -p 20000:8080 —name=my-tomcat1 tomcat:latest
- Docker run -itd -P —name=my-tomcat2 tomcat:latest