Monday, December 31, 2018

Can not run elasticsearch as root sonarqube Error - SonarQube Elasticsearch do not run as root

When you tried to configure SonarQube, you may experience the below error:

2018.10.15 17:32:13 ERROR es[][o.e.b.Bootstrap] Exception
java.lang.RuntimeException: can not run elasticsearch as root

at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) 

SonarQube does not support being run as root user, so we need to create regular user like sonar and give privilege to that use.

Fix for the above issue:
create a user called sonar by executing below command:
sudo useradd sonar

sudo chown -R sonar:sonar sonar-install-folder/


Edit the sonar.sh start script and change the #RUN_AS_USER to be RUN_AS_USER=sonar

sudo vi /opt/sonarqube/bin/linux-x86-64/sonar.sh


Change 
RUN_AS_USER=sonar
now start the server 
sudo sh /opt/sonarqube/bin/linux-x86-64/sonar.sh start

This should fix that issue.

Saturday, December 15, 2018

Ansible Playbook for provisioning a new EC2 instance in AWS - Create a new EC2 Using Ansible Playbook

Please find the Ansible Playbook for provisioning a new EC2 instance. Execute the below steps in the machine where you installed Ansible.

Steps to create Ec2 instance using Ansible: 1. Login to AWS console, click on username and go to My security credentials. 2. Continue on security credentials, click on access keys 3. Create a new access key if you dont have one. Make sure you download the keys. 4. Login to EC2 instance using Git bash or ITerm where you installed Ansible, execute the below command and then enter the access keys and secret access keys as below: sudo vi ~/.boto

add below three lines in the above file, replace the ?? with access key and secret key values:
[Credentials] aws_access_key_id = ?? aws_secret_access_key = ??


5. Now edit the hosts file sudo vi /etc/ansible/hosts Add the below two lines in the end of the file:
[localhost]
local



6. cd ~
7. mkdir playbooks
8. cd playbooks
9. sudo vi create_jenkins_ec2.xml 
copy the below content in green color.
edit the create_jenkins_ec2.xml to make sure you update the key, region, AMI
--- - name: provisioning EC2 Lab Exercises using Ansible hosts: localhost connection: local gather_facts: False tags: provisioning vars: keypair: MyinfraCodeKey instance_type: t2.micro image: ami-916f59f4 wait: yes group: webserver count: 1 region: us-east-2 security_group: jenkins-security-group tasks: - name: Create a security group local_action: module: ec2_group name: "{{ security_group }}" description: Security Group for webserver Servers region: "{{ region }}" rules: - proto: tcp from_port: 22 to_port: 22 cidr_ip: 0.0.0.0/0 - proto: tcp from_port: 8080 to_port: 8080 cidr_ip: 0.0.0.0/0   - proto: tcp from_port: 80 to_port: 80 cidr_ip: 0.0.0.0/0 rules_egress: - proto: all cidr_ip: 0.0.0.0/0 register: basic_firewall - name: Launch the new EC2 Instance local_action: ec2 group={{ security_group }} instance_type={{ instance_type}} image={{ image }} wait=true region={{ region }} keypair={{ keypair }} count={{count}} register: ec2 - name: Add the newly created EC2 instance(s) to the local host group (located inside the directory) local_action: lineinfile dest="/etc/ansible/hosts" regexp={{ item.public_ip }} insertafter="[webserver]" line={{ item.public_ip }} with_items: "{{ ec2.instances }}"

10. now execute the ansible playbook by
sudo ansible-playbook create_jenkins_ec2.xml

11. if everything is good, you should see the new instance on AWS console. make sure you are able to connect to that instance. 12. It will also make an entry in hosts file as well.

Sunday, July 15, 2018

Popular DevOps Interview Questions - Top DevOps Interview Questions - Part 3

Let us see some popular but basic DevOps Interview Questions:

1. How will you integrate Jenkins and SonarQube? Walk through steps of Jenkins SonarQube integration
2. Whats the pipeline code for integrating with SonarQube from jenkins?
3. Walk through steps of making a code changes locally and pushing into GitHub or Bitbucket.
4. What is the difference between git clone and git pull?
5. What are the advantages of containers? why we need them?
6. How will you resolve merge conflicts in Git?
7. What is the difference between Ansible and Puppet ? when will you use on tool over other?
8. What is the difference between Ant and Maven? Why maven is better than Ant?


Click here for part 1 DevOps Interview Questions.
Click here for part 2 DevOps Interview Questions.

Thursday, July 5, 2018

Install Tomcat 8 on Ubuntu 16.0.4 - How to install and configure Tomcat 8 on Ubuntu 16.0.4

Tomcat 8 Installation

sudo apt-get update
sudo apt-get install tomcat8
sudo apt-get install tomcat8-docs tomcat8-examples tomcat8-admin
sudo cp -r /usr/share/tomcat8-admin/* /var/lib/tomcat8/webapps/

sudo vi /var/lib/tomcat8/conf/tomcat-users.xml
Go to the end of the file,
Add the below lines in second last line above (above </tomcat-users>)
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
 
<user username="tomcat" password="password" roles="manager-gui,manager-script"/>

sudo vi /etc/default/tomcat8
Look for the line starting JAVA_OPTS and comment that line by adding # and copy the below line:
JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx512m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC"

sudo systemctl restart tomcat8

sudo systemctl status tomcat8

Now go to browser, enter ip address or DNS name of server with port no 8080

You will see a page that says It Works!

That's is Tomcat is successfully installed on Ubuntu

Wednesday, July 4, 2018

TODO Checklist after finishing DevOps Training Course - Must to do after finishing Devops Coaching

After DevOps Coaching classes are completed, make sure below items are taken by in order to in crease the chances of getting interviews quickly and also getting your offers. 

Please understand it is a process and it takes time...

Have a look at this link to plan your preparation..

Check list after the Training:
 

1. Have you finished all the lab exercises(including bonus :) labs) given by Coach?
2. Did you work on your resume, most importantly change look and feel of resume and get it reviewed by Coach?
3. Did you create an account in Dice, Monster, Indeed and Linkedin?

4. Do you have DevOps interview notes document? Are you using the document as a reference besides google and YouTube?
5. Do you apply for jobs every day in dice, monster, indeed.com?
6. Did you send your resume to at least 8 to 10 vendors a day?
7. Have you read DevOps interview questions(3 sets) from www.coachdevops.com?
8. Are you getting at least 12 to 15 calls a day for DevOps openings? If not, start from # 1 point.
9. Do you have your class notes ready? Are you ready with your notes preparation ?

10. Have you stopped or terminated not being used instances in AWS account and Azure Account?

Wednesday, April 18, 2018

DevOps Coaching Classes Online June 2021 schedules

Are you in IT? Tired of your work? Not able to make a progress? 
Are you not having a job? Looking for a break in IT? No Worries.. 
Are you interesting in learning about DevOps? 

DevOps is THE hot skill in US. Currently almost all the employers are struggling to get a right resource in their teams who can do the DevOps and automation work..You could be that person by attending my coaching program.

DevOps Coaching Schedule - May/June 2021(currently enrolling)

DateTimeTypeWhen?
May 116:00 to 7:45 PM CSTWeekdayTue/Thu
June 0511:30 to 1:15 PM on Sat, 3:00 PM to 04:30 PM CST on SunWeekendSat/Sun


DevOps Training highlights:

- Comprehensive hands on knowledge on Git, Jenkins, TeamCity, Maven, SonarQube, Nexus, Terraform, Ansible, Puppet, Docker on AWS and Azure.

- 20+ yrs IT exp, 5+ Yrs in DevOps/Cloud/Automation.

- Many students already placed in reputed companies from my coaching program successfully.

- Working as a Sr.DevOps Coach/Architect in a one of the top IT services companies in USA.

- Unique program...less theory, more hands on lab exercises...in Person class room training

Resume preparation will be done with candidates personally.

One-to-one Interview coaching.

- Coaching is purely hands on with 101% job relevant.

100% Job assistance.

- Both weekday(on-line) & weekend batches available.

- Coached about  820+ people successfully for past 3 and half years and many of my students got placed with various large enterprises in DFW, Chicago, Florida, Seattle, Bay area, Ohio and NY areas..

Contact no: 469-733-5248
Email - devops.coaching@gmail.com
Contact: AK

Sonarqube memory error - There is insufficient memory for the Java Runtime Environment to continue

There is insufficient memory for the Java Runtime Environment to continue.
 
If you have any errors in sonarQube like below:

# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 37531648 bytes for committing reserved memory.
Please apply below fix highlighted in yellow for any memory issus in SonarQube
The fix should be applied in sonar.properties file. you need to add below lines in appropriate places. 1. Login to SonarQube using GitBash or ITerm 2. open the below file and make the changes highligted in yellow color. sudo vi /opt/sonarqube/conf/sonar.properties

#--------------------------------------------------------------------------------------------------
# WEB SERVER
# Web server is executed in a dedicated Java process. By default heap
size is 512Mb.
# Use the following property to customize JVM options.
#    Recommendations:
#

sonar.web.javaOpts=-Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError

#-----------------------------
---------------------------------------------------------------------
# COMPUTE ENGINE
# The Compute Engine is responsible for processing background tasks.
# Compute Engine is executed in a dedicated Java process. Default heap
size is 512Mb.
# Use the following property to customize JVM options.
#    Recommendations:
sonar.ce.javaOpts=-Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError
 

Friday, April 13, 2018

DevOps Interview questions - Top DevOps Interview questions - Latest DevOps Interview Questions - Part 2

Please find more DevOps interview questions..
  1. What is Test Driven Development? How will you implement TDD?
  2. What is the difference between Agile and DevOps?
  3. What are the tools you integrated in pipeline you build?
  4. What are the different plug-ins you used in Jenkins?
  5. What is microservices? How will you create microservices?
  6. How will you dockerize an application? What are the steps?
  7. Have you configured webhooks in ? How will you do it?
  8. What is Jenkinsfile?
  9. What are the DevOps tools you have used?
  10. Why Git is distributed version control system?
  11. How will you set up communication between two systems without password but secure way?
  12. What do you understand by “Infrastructure as code”? 

How to Setup SonarQube on Azure VM | Install SonarQube Server on Ubuntu 18.0.4 VM in Azure Cloud

SonarQube is one of the popular static code analysis tools. SonarQube enables developers to write cleaner, safer code. SonarQube is open-sou...