Top 10 Interview Question in Laravel 2021?

Q #1) What is Laravel?.

Laravel is a free and open-source PHP framework that is utilized to developed wide variety of web applications. Laravel is an accessible language for new programmers because the laravel community provides lots of modules resources are free available. Laravel provides a simple way to authorization logic and control access to resources with a simple ActiveRecord implementation that makes their interaction with databases.

Q #2) Define Composer.

Composer is a dependency manager for php framework. Composer runs through the command line. The main purpose of the composer is to install the dependencies or libraries for an application. Composer help to install required package component whatever you want to install in your application.

Q #3) What is Routing?

Route is a way to create request URL of your application, Route is a method of accepting a request and sending it to the relevant function in the controller.

What are the two main routing files in Laravel?

1. web.php
2. api.php

Q #4) What is a CSRF token?

Answer: CSRF is an abbreviation for Cross-Site Request Forgery that is generated by the server-side application and transmitted to the client. A CSRF token is a unique value that is generated by the server-side of the application and sent to the client

CSRF token helps to protect web applications from attacks which force a user to perform an unwanted action (commonly known as CSRF attacks).

Q #5) What is an artisan?

Artisan is the command-line tool for Laravel to help the developer build the application use while developing your application. You can enter the below command to get all the available commands:

example of commands

php artisan make:controller — Make Controller file
php artisan make:model

Q #6) How to put Laravel applications in maintenance mode?

php artisan down

And can put the application again on live using the below command:

php artisan up

Q #7) How to put Laravel applications in maintenance mode?

What are the default route files in Laravel?

web.php — For registering web routes.
api.php — For registering API routes.
console.php — For registering closure-based console commands.
channel.php — For registering all your event broadcasting channels that your application supports.

Q #8) What are seeders in Laravel?

Seeders in laravel are used to put dummy data in the database tables automatically. After running migrations to create the tables, we can run `php artisan db:seed` to run the seeder to populate the database tables.

We can create a new Seeder using the below artisan command:

php artisan make:seeder [className]

Q #9) List out common artisan commands used in Laravel.

Laravel supports following artisan commands:

PHP artisan down;
PHP artisan up;
PHP artisan make:controller;
PHP artisan make:model;
PHP artisan make:migration;
PHP artisan make:middleware;

Q #10) What is the Latest version of Laravel?

Answer: Laravel 8 is the latest version.

Thanks… 👍👍

Tagged : / / / / /

DBMS Interview Q&A Part- 2

Q1. Can you create a table without using create command ?

A. Yes, we can create table with the help of SELECT INTO statement. It
copies content of one table to another table. However, there should be
at least one table from where we can copy content.
Example : Copying all columns : select * into new_table from old_table where
Copying specific column : select col1,col2 into new_table from old_table
where condition
Creating new empty table : select * into new_table from old_table where 1
= 0

Q2. What is Denormalization ?

A. It is the reverse process of Normalization. It is the process of trying to
improve the readability of the database by grouping data. Denormalization
is also used for speeding up the performance.

Q3. What are Joins ?

A. Join clause are used to combine rows from two or more tables,
depending upon the columns between them.

Q4. What are the different types of Joins ?

A. Different types of Joins are :

  1. INNER JOIN : It returns all records that are common in both tables.
  2. LEFT OUTER JOIN : It returns all records from the left table, and matched records from right table
  3. RIGHT OUTER JOIN : It returns all records from the right table, and matched records from left table.
  4. FULL OUTER JOIN : It returns all records when there is a match in either left or right table.
Q5. Explain Transaction ?

A. Transaction refers to the collection of multiple statements, that are
responsible for transferring a database from one consistent state to another
consistent state.

Q6. Explain the role of views in database ?

A.View refers to the virtual table. We can create view using create view

CREATE VIEW as Select col1
FROM table1
Q7. Explain Trigger ?

A. Triggers are defined as special kind of stored programs, which are
automatically executed whenever a specific operation occurs in the
database server.

Q8. What are Locks ?

A. Locking is the mechanism to protect data integrity and ensure data
consistency during transactions. Locks are the most common cause of
blocked processes. Stronger the Isolation level, more the chances of

Q9. Explain different types of Locks ?

A. Locks are broadly characterized into following types :

Shared Locks : These locks are acquired by readers during read
operations. In other words, these locks exist when two transactions are
granted read access. Data updation is not allowed until shared lock is
Exclusive Locks : In exclusive lock, data items can be both read as well
as written by the transaction. In Exclusive lock, multiple transactions do not
modify the same data simultaneously.

Q10. What is Super Key ?

A. An attribute or set of attributes that uniqueness in database is refered to
as Super key. It is the superset of Candidate key.

Q11. What is Candidate Key ?

A. A minimal set of attribute/attributes that can be used to uniquely identify
a single row in a given relation is refered to as Candidate key.

Q12. Explain Primary Key ?

A. DB Designer selects one of the candidate key as primary key for a
relation for the purpose of identification of a tuple uniquely. It is identified
during table creation.

Q13. What is Composite Key ?

A. If a primary key has more than one attribute, then it is referred to as
Composite key.

Q14. Explain Foreign Key ?

A. A set of attribute/attributes that is used to establish and enforce a link
between data in two or more relations.

Q15. Can a table have more than one primary key ?

A. No.

Q16. Can We Have NULL Value in Primary Key?

A. No.

Q17. What are cursors ?

A. A cursor is a temporary work area created in system memory when a
SQL statement is executed. A cursor can hold more than one row, but can
process only one row at a time.

Q18.What are the differences between Hash join, Merge join and Nested loops?
Hash joinMerge joinNested loops
The hash join is used when you have to join large tables.Merge join is used when projections of the joined tables are sorted on the join columns.The nested loop consists of an outer loop and an inner loop.
Q19. What do you understand by Proactive, Retroactive and Simultaneous Update ?
  1. Proactive Update: These updates are applied to the database before it becomes effective in the real-world environment.
  2. Retroactive Update: These retroactive updates are applied to a database after it becomes effective in the real-world environment.
  3. Simultaneous Update: These updates are applied to the database at the same instance of time as it becomes effective in a real-world environment.
Q20.What do you understand by Data Independence?

A. When you say an application has data independence, it implies that the application is independent of the storage structure and data access strategies of data.

Tagged : / / / / / / / / /

DBMS Interview Q&A Part- 1

Q. What is Data ?

A. Data refers to raw facts and figures that can be recorded.

Q. What is Database ?

A. Database refers to the collection of interrelated and coherent data.

Q. Explain DBMS ?

A. DBMS stands for Database Management System. It is a software
package designed to define, manipulate, retrieve and manage data in

Q. Why DBMS ?

A. To make information easy to access and protected, we use database
management systems. DBMS is important because it manages the data
efficiently and allow users to perform multiple tasks on it with the ease.

Q. What is a database system?

A. The collection of database and DBMS software together is known as a
database system.

Q. What do you mean by Data Modelling ?

A. Data Modelling is the set of conceptual tools for describing data
relationship, data semantics, and consistency constraints. Different data
models are : Network model, Relational model, Object Oriented model, ER
model, and more.

Q. Explain RDBMS ?

A. RDBMS stands for Relational Database Management System. It
arranges information into allied rows and columns. RDMS is an information
management system which is oriented on a data model. RDBMS Example
systems are SQL Server, Oracle, MySQL, MariaDB and SQLite.

Q. Explain Abstraction of Data, with reference to DBMS ?

A. Data Abstraction refers to the process of hiding background details from

Q. Explain the 3 L’s of Data Abstraction ?

A. It refers to three levels of abstraction. They are :

  1. Physical Level : It is lowest level of abstraction. It describes how data is
    actually stored. It also describes complex data structure in detail.
  2. Logical Level : It describes what data get stored in the database and what are the relationships among them.
  3. View Level : It is the highest level of data abstraction that only describes a part of database indirectly
Q. What is Database Schema ?

A. Schema refers to the overall structure of database without data values.

Q. What do you mean by transparent DBMS?

A. The transparent DBMS is a type of DBMS which keeps its physical
structure hidden from users.

Q. Explain ER Model ?

A. This model is based on the perception of real world that consists of
collection of basic entities and relationship among these objects. It is the
graphical representation of the database.

Q. What do you understand by Data Independency ?

A. It refers to the capacity to change data at one level without affecting next
higher level is called Data Independence. It is of two types : Physical DI,
Logical DI.
Physical DI : It indicates that physical storage of device could be changed
without affecting conceptual view.
Logical DI : It indicates that conceptual schema can be changed without
affecting existing external schema.

Q. What is a Database Language ?

A. Database Language is a medium by which we can interact with the
database system through some set of commands. These commands are

Q. What is a Tuple ?

A. A single row of a table, which contains a single record for that relation is
called a tuple.

Q. Explain degree and Cardinality ?

A. Degree is the total number of attributes in a relation or table and
cardinality is total number of tuples/rows in a relation/table.

Q. What is a relation in DBMS ?

A. A database relation refers to an individual table in a relational database.
A table is a relation because it stores the relation between data in its
column-row format.

Q. What is the role of DML Compiler ?

A. It translates DML statements in a query language into low-level
instructions that the query evaluation engine can easily understand.

Q. Explain me the role of using clause for queries ?

A. Clause enables you to specify conditions that filters the results as per
the requirement. Some of the most commonly used clauses are : having,
where etc.

Q. What is a Query ?

A. Query is a statement that is used for the extraction of data from
For example – select * from table1 is a query

Q. What is Subquery ?

A. Subquery is a query within query.
For example – select * from students where marks = ( select max(marks)
from students);

Q. Explain BCNF ?

A. BCNF is Boyce-Codd Normal Form. It is considered to be the advanced
version of 3 NF. Hence it is also refered to as 3.5 NF. A relation is said to
be in BCNF, if it satisfies following rules :

  1. It is in 3NF.
  2. For every functional dependency P->Q, P should be the super key of the table.
Q. What are Stored Procedures ?

A. Stored Procedure refers to the set of Structured Query Language(SQL)
statements stored in a relational database management system as a group.
It can further be reused and shared by multiple programs. It provides a
layer of security between a user interface and database.

Tagged : / /

Questionnaire: Access your SCM Process in Project


1…… General Assessment Questions. 2

1.1     Questions to analyze the development process description.. 2

1.2     Questions to characterize the project application.. 2

1.3     Questions to identify the supporting tools. 2

2…… Assessment on Configuration and Change Management   2

2.1     Project/Development Managers. 2

2.2     Developers. 3

2.3     Testers. 3

2.4     Configuration Manager. 3

3…… Assessment on Build and Release Management.. 3

3.1     Build Engineer. 3

3.2     Release Engineer. 4


1           General Assessment Questions

1.1      Questions to analyze the development process description


Which of the following do you get from your existing process?

·         Examples

·         Guidelines

·         Artifact templates

·         Activity descriptions

·         Artifact descriptions


1.2      Questions to characterize the project application


  • What is the size of each project (duration, persons, person years,  LOC)

·         What type (maintenance / enhancement / new development / prototype /

§  feasibility)

  • What type of development model is being used?
  • Are we using any process models like UCM, RUP or any other?
  • Any industry/domain specific standards (like CMMI, ITIL etc.) to be followed?


1.3      Questions to identify the supporting tools


·         What are the tools that you currently use in your work?

·         How is the integration among the above tools?

·         Are we using the tool features the way they are designed or intended?


2           Assessment on Configuration and Change Management

2.1         Project/Development Managers


·         How do you maintain all the artifacts together and version them?

·         Where are the people working on the project located?

·         What’s the difference between Developer CM and Release CM?

·         How do you assess, and track the impact of a proposed change?

·         How do you manage system integration of modules developed by individual developers?

·         How many product versions are you supporting at this moment?

·         Who is the designated Configuration Manager?



2.2         Developers


·         How do you baseline project artifacts?

·         Can you build your system reliably and repeatedly?

·         Explain your labeling scheme?

·         Can you show me what versions went into a certain release?

·         What does the version tree for this file look like?

·         How many product versions are you supporting at the moment?

·         What is the version control tool being used? Is it user friendly?

·         What is the bug tracking/change management tool being used? Is it user friendly?


2.3         Testers

·         Do you know what files/documents should be delivered?

·         How do you assess, and track the impact of a proposed change?

·         Can you show me what artifact versions went into a certain release?

·         How comfortable are you working with Bug/Change management tool?


2.4         Configuration Manager

·         Do you know what files/documents should be delivered?

·         How do you track who changed what, when, where, and why?

·         How long does a build or release take?

·         Is there a Configuration Management Plan document?

·         Is there a tight integration between Version control tool and Bug/Change tracking tool?

·         How the parallel (if any) development is enabled? Any limitations with the current branching strategy?

·         Is this project development spanned across multiple sites? If so, what is your multi-site strategy?


3          Assessment on Build and Release Management

3.1         Build Engineer


  • What is the build process adopted (automated/manual)?
  • Are there nightly builds?
  • Is there continuous integration?
  • Are there smoke and sanity tests at the end of the build?
  • What is the build acceptance criterion (BAT)?
  • What is the build duration? Is it optimal?
  • How are pre-conditions to the build verified?
  • Are there any build environment integrated automated unit test-cases?
  • Is there any enforcement tool on coding standards?
  • Is there any code coverage tool being used?
  • Are the post build activities automated?
  • Any additional practices (like checksum generation, signing the build artifacts) in place as part of the build?
  • Are there any scripting technologies used in automating build process?
  • Is Labeling strategy well-defined?
  • If any third party tool is being used for packaging, is that package creation process automated?


3.2         Release Engineer


  • How many major, minor releases a year per project?
  • How many customers per release per project?
  • How do you deliver the releases to the customers? – Is it physical media distribution or Push/Pull mechanism from web or any other process?
  • Is the distribution CD/DVD creation process automated?
  • What is the size of the release deliverable?
  • What are the contents of a release?
  • How is the release bundle tested?
  • How many platforms are certified? How different are the release packages?
  • Is there any release check-list for cross-check?
  • Is any part of the release process automated?
  • Is there a need for i18n? If yes, is the i18n release handled separately?
  • In case of installers, is there installer testing? Is it automated?
  • Is the release schedule well-planned?
  • Are you delivering patches in well constructed and cost effective way?
  • Is there any release audit process in place?
  • How are you tracking your releases?
  • Is there any legal compliance in place while shipping the release to the customers?
Tagged : / / / /

Top Questions on Server Configuration Management Tools Chef, Puppet, and Ansible



Source –

As a quick recap, configuration management tools enable companies to standardize and automate their infrastructure. Through standardization, you can build systems that are platform independent (i.e. instead of relying on AMIs or provider specific toolsets). These tools also make it easy reproduce servers for scaling or testing, and recover from disaster quickly by defining a proper application state. For example, if servers are not in that defined state when each server is checked, they are restored to their proper state. In addition, this standardization makes it easy to onboard new developers.

While the language across configuration management tools is different, the concepts are the same. At the fundamental level in each configuration tool, a resource represents a part of the system and its desired state, such as a package that should be installed, a service that should be running, or a file that should be generated.

In Chef, a recipe is a collection of resources that describes a particular configuration or policy. These collections are called playbooks in Ansible, and manifests in Puppet. These collections describe everything that is required to configure part of a system. Collections install and configure software components, manage files, deploy applications, and execute other recipes. We go into more detail in our blog post here.

Here are the top questions we got from the community:

How is the concept of master/agent configuration better (or not) than agentless, when it comes to infrastructure as code?

Chef and Puppet are master/agent configuration systems, while Ansible is an agentless system. The historic argument is that the agent-based installation process is difficult –  you have to set up the master, and then set up the agents on your nodes so that they know about the master. If you’ve got servers with diverse linux distros, on different versions of Windows, etc., installation can get tricky. Though, because they’re logging every few minutes, agent-based systems are powerful for advanced monitoring. At the end of the day this really is based on personal preference and what company requires. If your infrastructure is beefy and heavily standardized, installation on nodes isn’t complicated so use agent-based systems. If you have servers that run Python, try agentless.

Are these configuration management systems like MicroSoft System Center Configuration Manager (SCCM) but used for local and cloud?

This is like MS SCCM, but open-source and paid for per node. For those who haven’t used it, MicroSoft System Center Configuration Manager (SCCM) is used for infrastructure provisioning, monitoring, and automating workflow processes (usually sysadmin stuff). SCCM is a powerhouse in the enterprise space. While it can manage end clients on non-Windows servers, the server console portion of SCCM must be hosted and run on a Windows server machine. The reason other orchestration/configuration systems win here is that you pay on a per-node basis and you’re not totally tied into Windows Server’s licensing agreements. In other words, open-source vs proprietary. And with Chef/Puppet/Ansible the thinking is more in resources as opposed to SCCM, which is more in files and terminal commands.

An attendee commented on using SCCM:

 We really like Ansible because of the none-agent requirement. For Windows patching we utilize System Center Configuration Manager, and even though System Center can provide patching to Linux we have run into issues with SCCM agent staying healthy and running on our Linux systems. We have also run into when the SCCM admins have made changes it broke SCCM agent on a majority of our Linux servers. Our Linux patching process has been highly manual up to this point but we are seeking to automate this to free up staff time to be better directed at other support tasks, which is why were are reviewing several solutions. The non-agent aspect is highly desirable in our situation because of past experience with SCCM agent. I just wanted to provide that feedback so others that have not experienced agent issues with other deployment solutions may want to keep that in mind.”

If we have to pick a tool dependent on whether we deploy on cloud or on-premise – which of these tools would be a better choice?

We would recommend looking into network access requirements for each tool. If you have an agent that checks in periodically with a central master management piece, that is likely to work better then SSH which requires direct path / path through lots of proxies. 

One attendee mentioned in the comments: “[In regards to] SSH vs Agent – Agent is more secure where SSH not an option.

What happened to cfengine? This tool used to be mentioned alongside Chef and Puppet. 
Version 3 of cfengine is a complete revamp, but it compared to other configuration management tools the brand and community outreach isn’t strong, and does little the others don’t do better.

How does StackStorm compare to the other orchestrators being reviewed?
StackStorm labels itself more of an automation platform, or a DevOps workflow tool that handles provisioning and configuring servers but also leans on automatic and event driven services that plugs into Jenkins and other CI/CD workflows.

From one attendee that had used all three: “For us, getting the Server engineers to adopt Chef has been very difficult. It grew organically on the Dev side of the house. Ansible appears to be something that guys without Dev skills could pick up more easily. Just [my] perception.”

Can I run tasks in parallel with Ansible rather than running it serially (say 50 servers being updated with a patch)?

The default method is to run each task across all servers in parallel, meaning that it will run the first task (e.g. installing Git) on all servers in a group, and once all servers respond with a success, failure, or unchanged response, Ansible will move to the next task on all servers. It doesn’t run on a server, wait, move on to the next, it will run on all servers at once over SSH. If you want to deploy updates in batches, you can run a percentage of servers in a group (e.g. 50%, by listing it in the playbook as serial: 50%).

An attendee made this comment as we mentioned Ansible:

I have attended a presentation from RedHat regarding Ansible that states [that Ansible scales well]. They have large scale hosting companies that on the fly spin up servers and perform patching for their servers via Ansible. The one mentioned had over 50,000 servers and it seemed to handle the volume / scale fine. I of course don’t know everything about Puppet or Chef or Salt, but one thing I find really nice about Ansible is the ability to perform rolling updates / tasks. So if you say had 1000 servers you can say you want to run 10% or 100 at a time and keep it rolling until all 1000 are done. It can be stated by percentage or defined number…I am sure I sound a bit biased but one of the main reasons Ansible is high on our list right now is the fact that it is agentless and does not really consume resources.”

With Ansible, how can we handle the security implications about allowing passwordless ssh to a root account on all systems? What mechanisms are there for access control and auditing?

There are definitely security implications if you are going to allow passwordless ssh. So it’s on the company to ensure that security groups or NSGs are well defined. We should also mention that the passwordless ssh is only enabled on the machine you are running Ansible commands and playbooks from, so if anything consider that workstation to be your weak point. Make sure SSH access is only permissible through your IP. As an alternative solution to connecting via SSH, if you use docker, Ansible allows you to deploy playbooks directly into Docker containers using the local Docker client. All you need is a user inside that container.

Does ansible run single-threaded or is it addressing multiple servers in a group asynchronously?
Ansible runs on each host in parallel. This means that it attempts to run your tasks on all servers defined at the top of the playbook before moving on to the next task.

One user said in regards to all three tools: “Ansible seems better for “orchestration” and Puppet/Chef are really good for “Configuration Management”.  Ansible can be used to stop applications and databases and then run Puppet and then start applications and databases.

Lastly, we got a surprise question from the audience on Jenkins, a CI/CD pipeline tool that can be used in conjunction with tools like Chef to completely automate the infrastructure behind your applications.

What is the alternative of Jenkins?
While we recommend Jenkins, If you’re a Ruby shop, Capistrano is geared towards your deployments. If you live in the AWS world, you can try using the CodeCommit/CodeDeploy/CodePipeline toolset. If you’re looking for a provider agnostic solution, CircleCI is great. If your workflows revolve around Atlassian, try Bamboo. 

If you are unsure of what CI/CD pipeline tool to use, or how they work, we will be hosting a webinar on Jenkins as part of our on-going series on infrastructure-as-code.

Tagged : / / / / / / /

Git Interview Questions and Answer


Q1. What is GIT?

Git is a distributed version control system and source code management (SCM) system with focus to handle small and large projects source code versions in the local repository with speed and efficiency. It is free and open source and its one of widly used versioning tools used ever worldwide.

Q2. What do you understant the repository in Git?

A repository in git, consists of .git directory which contains the each source code commited in form of objects created using SHA1 algorithms. A .git directry where git keeps all of its metadata for the source code in objects forms. It also contains the git configuration file, breanch reference and staging state of the work space.

Q. What is the command you can use to write a commit message?

The command that is used to write a commit message is “git commit –m”this is reason for commit”.  The –a on the command line instructs git to commit the new content of all tracked files that have been modified. You can use “git add <file>” before git commit –a if new files need to be committed for the first time.

In nutshell, any new changes has to added from working directory to stageing area and then commit from staging area to reposiory. Please refer the image for the same as below;

Q. What is the difference between GIT and SVN?

The difference between GIT and SVN is

  1. Git is less preferred for handling extremely large files or frequently changing binary files while SVN can handle multiple projects stored in the same repository.
  2. GIT does not support ‘commits’ across multiple branches or tags.  Subversion allows the creation of folders at any location in the repository layout.
  3. Gits are unchangeable, while Subversion allows committers to treat a tag as a branch and to create multiple revisions under a tag root.

Q. What are the advantages of using GIT?

  1. Data redundancy and replication
  2. High availability
  3. Only one.git directory per repository
  4. Superior disk utilization and network performance
  5. Collaboration friendly
  6. Any sort of projects can use GIT

Q. What language is used in GIT?

GIT is fast, and ‘C’ language makes this possible by reducing the overhead of runtimes associated with higher languages.

Q. What is the function of ‘GIT PUSH’ in GIT?

‘GIT PUSH’ updates remote refs along with associated objects.

Q. Why GIT better than Subversion?

GIT is an open source version control system; it will allow you to run ‘versions’ of a project, which show the changes that were made to the code overtime also it allows you keep the backtrack if necessary and undo those changes.  Multiple developers can checkout, and upload changes and each change can then be attributed to a specific developer.

Q. What is “Staging Area” or “Index” in GIT?

Before completing the commits, it can be formatted and reviewed in an intermediate area known as ‘Staging Area’ or ‘Index’.

Q. What is GIT stash?

GIT stash takes the current state of the working directory and index and puts in on the stack for later and gives you back a clean working directory.  So in case if you are in the middle of something and need to jump over to the other job, and at the same time you don’t want to lose your current edits then you can use GIT stash.

Q. What is GIT stash drop?

When you are done with the stashed item or want to remove it from the list, run the git ‘stash drop’ command.  It will remove the last added stash item by default, and it can also remove a specific item if you include as an argument.

Q. How will you know in GIT if a branch has been already merged into master?

Git branch—merged lists the branches that have been merged into the current branch

Git branch—no merged lists the branches that have not been merged

Q. is the function of git clone?

The git clone command creates a copy of an existing Git repository.  To get the copy of a central repository, ‘cloning’  is the most common way used by programmers.

Q. What is the function of ‘git config’?

The ‘git config’ command is a convenient way to set configuration options for your Git installation.  Behaviour of a repository, user info, preferences etc. can be defined through this command.

Q. What does commit object contain?

  1. A set of files, representing the state of a project at a given point of time
  2. Reference to parent commit objects
  3. An SHAI name, a 40 character string that uniquely identifies the commit object.

Q. How can you create a repository in Git?

In Git, to create a repository, create a directory for the project if it does not exist, and then run command “git init”. By running this command .git directory will be created in the project directory, the directory does not need to be empty.

Q. What is ‘head’ in git and how many heads can be created in a repository?

A ‘head’ is simply a reference to a commit object. In every repository, there is a default head referred as “Master”.  A repository can contain any number of heads.

Q. What is the purpose of branching in GIT?

The purpose of branching in GIT is that you can create your own branch and jump between those branches. It will allow you to go to your previous work keeping your recent work intact.

Q. What is the common branching pattern in GIT?

The common way of creating branch in GIT is to maintain one as “Main“

branch and create another branch to implement new features. This pattern is particularly useful when there are multiple developers working on a single project.

Q. How can you bring a new feature in the main branch?

To bring a new feature in the main branch, you can use a command “git merge” or “git pull command”.

Q. What is a ‘conflict’ in git?

A ‘conflict’ arises when the commit that has to be merged has some change in one place, and the current commit also has a change at the same place. Git will not be able to predict which change should take precedence.

Q. How can conflict in git resolved?

To resolve the conflict in git, edit the files to fix the conflicting changes and then add the resolved files by running “git add” after that to commit the repaired merge,  run “git commit”.  Git remembers that you are in the middle of a merger, so it sets the parents of the commit correctly.

Q. To delete a branch what is the command that is used?

Once your development branch is merged into the main branch, you don’t need development branch.  To delete a branch use, the command “git branch –d [head]”.

Q. What is another option for merging in git?

“Rebasing” is an alternative to merging in git.

Q. What is the syntax for “Rebasing” in Git?

The syntax used for rebase is “git rebase [new-commit] “

Q. What is the difference between ‘git remote’ and ‘git clone’?

‘git remote add’  just creates an entry in your git config that specifies a name for a particular URL.  While, ‘git clone’ creates a new git repository by copying and existing one located at the URI.

Q. What is GIT version control?

With the help of GIT version control, you can track the history of a collection of files and includes the functionality to revert the collection of files to another version.  Each version captures a snapshot of the file system at a certain point of time. A collection of files and their complete history are stored in a repository.

Q. Mention some of the best graphical GIT client for LINUX?

Some of the best GIT client for LINUX is

  1. Git Cola
  2. Git-g
  3. Smart git
  4. Giggle
  5. Git GUI
  6. qGit

Q. What is Subgit? Why to use Subgit?

‘Subgit’ is a tool for a smooth, stress-free SVN to Git migration.  Subgit is a solution for a company -wide migration from SVN to Git that is:

a)      It is much better than git-svn

b)      No requirement to change the infrastructure that is already placed

c)       Allows to use all git and all sub-version features

d)      Provides genuine stress –free migration experience.

Q. What is the function of ‘git diff ’ in git?

‘git diff ’ shows the changes between commits, commit and working tree etc.

Q. What is ‘git status’ is used for?

As ‘Git Status’ shows you the difference between the working directory and the index, it is helpful in understanding a git more comprehensively.

Q. What is the difference between the ‘git diff ’and ‘git status’?

‘git diff’ is similar to ‘git status’, but it shows the differences between various commits and also between the working directory and index.

Q. What is the function of ‘git checkout’ in git?

A ‘git checkout’ command is used to update directories or specific files in your working tree with those from another branch without merging it in the whole branch.

Q. What is the function of ‘git rm’?

To remove the file from the staging area and also off your disk ‘git rm’ is used.

Q. What is the function of ‘git stash apply’?

When you want to continue working where you have left your work, ‘git stash apply’ command is used to bring back the saved changes onto the working directory.

Q. What is the use of ‘git log’?

To find specific commits in your project history- by author, date, content or history ‘git log’ is used.

Q. What is ‘git add’ is used for?

‘git add’ adds file changes in your existing directory to your index.

Q. What is the function of ‘git reset’?

The function of ‘Git Reset’ is to reset your index as well as the working directory to the state of your last commit.

Q. What is git Is-tree?

‘git Is-tree’ represents a tree object including the mode and the name of each item and the SHA-1 value of the blob or the tree.

Q. How git instaweb is used?

‘Git Instaweb’ automatically directs a web browser and runs webserver with an interface into your local repository.

Q. What does ‘hooks’ consist of in git?

This directory consists of Shell scripts which are activated after running the corresponding Git commands.  For example, git will try to execute the post-commit script after you run a commit.

Q. Explain what is commit message?

Commit message is a feature of git which appears when you commit a change. Git provides you a text editor where you can enter the modifications made in commits.

Q. How can you fix a broken commit?

To fix any broken commit, you will use the command “git commit—amend”. By running this command, you can fix the broken commit message in the editor.

Q. Why is it advisable to create an additional commit rather than amending an existing commit?

There are couple of reason

  1. The amend operation will destroy the state that was previously saved in a commit.  If it’s just the commit message being changed then that’s not an issue.  But if the contents are being amended then chances of eliminating something important remains more.
  2. Abusing “git commit- amend” can cause a small commit to grow and acquire unrelated changes.

Q. What is ‘bare repository’ in GIT?

To co-ordinate with the distributed development and developers team, especially when you are working on a project from multiple computers ‘Bare Repository’ is used. A bare repository comprises of a version history of your code.

Q. How do you revert a commit that has already been pushed and made public?

One or more commits can be reverted through the use of git revert. This command, in essence, creates a new commit with patches that cancel out the changes introduced in specific commits. In case the commit that needs to be reverted has already been published or changing the repository history is not an option, git revert can be used to revert commits. Running the following command will revert the last two commits:

git revert HEAD~2..HEAD

Alternatively, one can always checkout the state of a particular commit from the past, and commit it anew.

Q. How do you squash last N commits into a single commit?

Squashing multiple commits into a single commit will overwrite history, and should be done with caution. However, this is useful when working in feature branches. To squash the last N commits of the current branch, run the following command (with {N} replaced with the number of commits that you want to squash):

git rebase -i HEAD~{N}

Upon running this command, an editor will open with a list of these N commit messages, one per line. Each of these lines will begin with the word “pick”. Replacing “pick” with “squash” or “s” will tell Git to combine the commit with the commit before it. To combine all N commits into one, set every commit in the list to be squash except the first one. Upon exiting the editor, and if no conflict arises, git rebase will allow you to create a new commit message for the new combined commit.

Q. How do you find a list of files that has changed in a particular commit?

git diff-tree -r {hash}

Given the commit hash, this will list all the files that were changed or added in that commit. The -r flag makes the command list individual files, rather than collapsing them into root directory names only.

The output will also include some extra information, which can be easily suppressed by including a couple of flags:

git diff-tree –no-commit-id –name-only -r {hash}

Here –no-commit-id will supress the commit hashes from appearing in the output, and –name-only will only print the file names, instead of their paths.

Q. How do you setup a script to run every time a repository receives new commits through push?

To configure a script to run every time a repository receives new commits through push, one needs to define either a pre-receive, update, or a post-receive hook depending on when exactly the script needs to be triggered.

Pre-receive hook in the destination repository is invoked when commits are pushed to it. Any script bound to this hook will be executed before any references are updated. This is a useful hook to run scripts that help enforce development policies.

Update hook works in a similar manner to pre-receive hook, and is also triggered before any updates are actually made. However, the update hook is called once for every commit that has been pushed to the destination repository.

Finally, post-receive hook in the repository is invoked after the updates have been accepted into the destination repository. This is an ideal place to configure simple deployment scripts, invoke some continuous integration systems, dispatch notification emails to repository maintainers, etc.

Hooks are local to every Git repository and are not versioned. Scripts can either be created within the hooks directory inside the “.git” directory, or they can be created elsewhere and links to those scripts can be placed within the directory.

Q. What is git bisect? How can you use it to determine the source of a (regression) bug?

Git provides a rather efficient mechanism to find bad commits. Instead of making the user try out every single commit to find out the first one that introduced some particular issue into the code, git bisect allows the user to perform a sort of binary search on the entire history of a repository.

By issuing the command git bisect start, the repository enters bisect mode. After this, all you have to do is identify a bad and a good commit:

git bisect bad # marks the current version as bad

git bisect good {hash or tag} # marks the given hash or tag as good, ideally of some earlier commit

Once this is done, Git will then have a range of commits that it needs to explore. At every step, it will checkout a certain commit from this range, and require you to identify it as good or bad. After which the range will be effectively halved, and the whole search will require a lot less number of steps than the actual number of commits involved in the range. Once the first bad commit has been found, or the bisect mode needs to be ended, the following command can be used to exit the mode and reset the bisection state:

git bisect reset

Q. What are the different ways you can refer to a commit?

In Git each commit is given a unique hash. These hashes can be used to identify the corresponding commits in various scenarios (such as while trying to checkout a particular state of the code using the git checkout {hash} command).

Additionally, Git also maintains a number of aliases to certain commits, known as refs. Also, every tag that you create in the repository effectively becomes a ref (and that is exactly why you can use tags instead of commit hashes in various git commands). Git also maintains a number of special aliases that change based on the state of the repository, such as HEAD, FETCH_HEAD, MERGE_HEAD, etc.

Git also allows commits to be referred as relative to one another. For example, HEAD~1 refers to the commit parent to HEAD, HEAD~2 refers to the grandparent of HEAD, and so on. In case of merge commits, where the commit has two parents, ^ can be used to select one of the two parents, e.g. HEAD^2 can be used to follow the second parent.

And finally, refspecs. These are used to map local and remote branches together. However, these can be used to refer to commits that reside on remote branches allowing one to control and manipulate them from a local Git environment.

Q. What is git rebase and how can it be used to resolve conflicts in a feature branch before merge?

In simple words, git rebase allows one to move the first commit of a branch to a new starting location. For example, if a feature branch was created from master, and since then the master branch has received new commits, git rebase can be used to move the feature branch to the tip of master. The command effectively will replay the changes made in the feature branch at the tip of master, allowing conflicts to be resolved in the process. When done with care, this will allow the feature branch to be merged into master with relative ease and sometimes as a simple fast-forward operation.

Q. How do you configure a Git repository to run code sanity checking tools right before making commits, and preventing them if the test fails?

This can be done with a simple script bound to the pre-commit hook of the repository. The pre-commit hook is triggered right before a commit is made, even before you are required to enter a commit message. In this script one can run other tools, such as linters and perform sanity checks on the changes being committed into the repository. For example, the following script:

files=$(git diff –cached –name-only –diff-filter=ACM | grep ‘.go$’)
if [ -z files ]; then
exit 0
unfmtd=$(gofmt -l $files)
if [ -z unfmtd ]; then
exit 0
echo “Some .go files are not fmt’d”
exit 1

… checks to see if any .go file that is about to be commited needs to be passed through the standard Go source code formatting tool gofmt. By exiting with a non-zero status, the script effectively prevents the commit from being applied to the repository.

Tagged : / / / / / / / / / / /

Top 20 DevOps Questions you must prepare before Interview | scmGalaxy


  1. What do you understand about DevOps? Can you please define it in your terminologies?

  2. What are the ways, DevOps will help the Software Projects and Team?

  3. What is Continuous Integration? Share your approach which you applied in your projects in order to implement CI.

  4. What is difference between Continuous Delivery and Continuous Deployment?

  5. How Jenkins will help to implement CI and what are the capabilities what Jenkins has so we call Jenkins is a CI tool?

  6. How is DevOps different from Agile / SDLC?

  7. What are the advantages of DevOps for the organization?

  8. Whether DevOps can be implemented only by DevOps Engineer in a project? If not, Why we should hire you?

  9. How would you deploy a software to 5000 systems? Do you know how you would go about large-scale deployments?

  10. How would you trace a binary deployment back to the source code ? How would you structure such a build ?How do you plan capacity for your CI/CD servers ?

  11. Which are the top DevOps tools? Which tools have you worked on? How do all these tools work together?

  12. Explain your understanding and expertise on both the software development side and the technical operations side of an organization you have worked with in the past.

  13. What is agile development and Scrum ?

  14. Can we consider DevOps as an agile methodology ?

  15. What is DevOps engineer’s duty with regards to Agile development ?

  16. How people communicate or the tools that you choose to deploy?

  17. How would you make software deployable?

  18. How do you manage dependencies ?

  19. What are the branching strategy you follow and why?

  20. Discuss your experience building bridges between IT Ops, QA and development.

Tagged : / / / / / / / / /

Top 25 TFS Interview Questions and Answers


TFS Interview Questions

1) What is Team  Foundation Server? What does it cover – version control? build processes? bug tracking? task management?

Team Foundation Server is defined in the documentation as:

Team Foundation is a collection of collaborative technologies that support a team effort to deliver a product. While the Team Foundation technologies are typically employed by a software team to build a software product, they can also be used on other types of projects.

As the customer already noted three of the core deliverables of Team Foundation Server:

1. Build Process

2. List/Work item Tracking

3. Source Control

This is leaving off probably the two most import features of Team Foundation Server. By integrating the build process, source control,policy and work item tracking you can get a deep insight into what teams are doing and some analytics for future trends which leads to the 4th core deliverable of Team Foundation Server

4. Reporting

Having insight into how a team is tracking is really only half the answer their also needs to a mechanism to share this information which brings us to the last feature of Team Foundation Server:

5. Collaboration (Typically enabled through the Team Portal, Team Project and Process Guidance)

Interestingly it is the two missing categories that set Team Foundations Server apart from other offerings.

2) List out the functionalities provided by team foundation server?

– Project Management

– Tracking work items

– Version Control

– Test case management

– Build Automation

– Reporting

– Virtual Lab Management

3) Explain TFS in respect to GIT?


4) Explain how you can create a Git-TFS in Visual Studio 2013 express?

To create a Git-TFS in Visual Studio 2013 express

– Create an account with MS TFS service if you don’t have inhouse TFS server

– After that, you will be directed to TFS page, where you will see tow option for creating project, one with new team project and another with a new team project+Git

– The account URL will be found right below “Getting Started.”

– Click on create git project and it will take you to a new window, where you specify details about the project like project name, description, the process template, version control, etc. and once completed click on create project.

– Now you can create a local project in team foundation server by creating a new project in Visual studio and do not forget to mark the check box that says “Add to source control”

– In the next window, select mark Git as your version control and click ok, and you will be able to see the alteration made in the source code

– After that, commit your code, right click a file in team explorer and you can compare version differences

5) Mention whether all of the team foundation service features are included into the Team foundation server?

TFS service is updated every 3 weeks while Team Foundation Server “on-premise” is updated every 3 months.  So, the on-premise version will always remain a little behind. However, TFS on-premise has got something that the TFS service does not.

– You can use TFS Lab

– Customize work items/process templates

6) Explain what kind or report server you can add in TFS?

TFS uses SQL for its data storage, so you have to add SQL server reporting services to provide a report server for TFS.

7) How one would know whether the report is updated in TFS?

For each report, there will be an option “Date Last Updated” in the lower light corner, when you click or select that option, it will give details about when it was last updated.

8) Explain how you can restore hidden debugger commands in Visual Studio 2013?

To restore the debugger feature that is hidden, you have to add the command back to the command

– Open your project, click on Tools menu and then click customize

– Tap the command tab in the customize dialog box

– In the menu bar, drop down, choose the debug menu for which you want to contain the restored command

– Tap on the Add command button

– In the Add command box, choose the command you want to add and click OK

– Repeat the step to add another command

9) Explain how you can track your code by customizing the scroll bar in Visual Studio 2013?

To show the annotations on the scroll bar

– You can customize the scroll bar to display code changes, breakpoints, bookmarks and errors

– Open the scroll bar options page

– Choose the option “show annotations over vertical scroll bar”, and then choose the annotations you want to see

– You can replace anything in the code that frequently appears in the file which is not meant to be

10) Can I install the TFS 2010 Build Service on my TFS 2008 build machine? 

Yes, you can. Even though they both default to the same port (9191), they can share that port without any problems.

11) Can we disable the “Override CheckIn Policy Failure” checkbox? Can that be customized based on User Login, Policy Type of File type?

No. It is designed it to be fully auditable by including policy compliance data in the changeset details and in the checkin mail that is delivered, but left it up to the developer to determine whether they have a good reason for overriding.

12) What are the different events available in the event model and is there any documentation on them?

There is really only one SCC event and that is the one that is raised on checkin. Subscription is via the general event model that is discussed in the extensibility kit.

13) Are Deletes you make in TFS 2010 Source Control physical or logical? Can accidental deletes be recovered?

Deletes are fully recoverable with the “undelete” operation. You wouldn’t want to do a SQL restore because that would roll back every change to the TFS in the time since the file was deleted.

14) Can different CheckIn Policies be applied on different branches? E.g. Can they have QA specific policies applied on CheckIn in a QA branch?


15) How do I redisplay source control explorer?

Selecting View > Other Windows > Source Control Explorer will display the Source Control Explorer window within the IDE.

16) Why doesn’t source control detect that I have deleted a file/folder on my local disk?

The main scenario here is deleting a file (by mistake or intentionally) outside of Team Foundation and then trying the get that file back from source control. If the file version has not changed the server thinks the user already has the file and does not copy it over. This is because the server keeps a list of files that the user already has and when activities are made outside of source control this list becomes out of date. Team Foundation Version Control does have a force get option which will provide the functionality needed to obtain the desired version but it is currently partially hidden under the Get Specific Version Dialog window as a check box item.

17) Can I compare directory structures in TFS Source Control?

No, you cannot compare Directory Structures in TFS Source Control

18) Can we configure SCC to not check-in the binary files? Where are such configurations done?

Team Foundation Version Control provides a way to limit check-ins by setting up check-in policies that are evaluated before a check-in can take effect. The easiest way to do this is by authoring a policy that checks if the user is trying to check-in a binary file from a given folder structure and reject or accept it in accordance.

19) How can I add non-solution items to source control?

This can be achieved by either clicking the Add icon or by going to File > Source Control and selecting the Add To Source Control menu item.

20) When a user “edits” a file in a “source controlled” project, it gets checked out automatically. Is this configurable? Can we change this behavior?

Yes it can be done by configuring TFS by going to Tools > Options > Source Control > Environment provides an option where a user can change the settings to not checkout files automatically on edit.

21) What plugin / extensibility API does it expose?

The Team Foundation Server component model for modifying both the Process Template and creating plugins is built on to be entirely open(in many cases the entry points are defined in XML configuration files). In addition to the having this the development team and community is quite active in supplying samples of this:

Brian Harry

Buck Hodges

Rob Caron

This open platform has also enabled a ecosystem of add-ons like Teamlook, Teamprise, Teamplain, Teamword, TFSPermission Manager.

22)  How does it integrate with other non-MS platforms?

Team Foundation Server uses Web Services for cross machine communication therefore the Team Foundation Server functionality can be made available to any computer. (see MSDN Team System Article on how to use these web services) This is exactly how companies likeTeamprise, Teamplain, have built their clients to run on non windows computers.

23) How does it integrate with other software (eg custom task management software etc)?

In addition to the integration methods mentioned above Team Foundation is also a popular platform for other software manufacturers to host themselves in. Examples of this is Borland with their Together and Caliber Products and Compuware Testing with DevPartner.

24) How does the version control compare to Perforce? Branching, merging, change lists etc?

Team Foundation Server supports all normally expected Source Control features such as branching, merging, exclusively locking, remote disconnected scenarios, labeling, searching on various properties high fidelity reporting (how much code churn per person per project per iteration etc) plus a couple of newer paradigms like shelving and optimization for things like branching scenarios (many version control systems do a full copy for branches). I would have some performance comparisons but most systems don’t allow this.

25)  Automated build system?

Yes Team Foundation Server includes an Automated Build System. This system is based on MSBUILD and offers the additional functionality of automatically running tests, profiling, code analysis, verifying policies, collating the changesets and workitems for reporting.

26) Any support for distributed build tools? Eg integrating our custom data build tools into the system throughout a network?

MSbuild was written to be extensible and integrate with existing tools through easy to use XML configuration files. Many of the commercial build utilities are already using and/or integrated with MSBuild –such as In addition to making these actions part of the build script I have found the generic tests set to run as part of the build to do just as good a job with a rich user interface and support for managing/filtering etc.

27) Documentation support – eg integrating documentation with code check-ins etc?

This would typically be done through an entry to a work item (to be either associated or resolved) on time of check in and linked with this work item.

The links to the documentation can exist in a couple of ways.

1. Checked in as Files (ie doc, HTML etc) Team Foundation Server makes it trivial to link all object checked in (as well as other workitems.)

2. Process guidance files that exist on the Windows Sharepoint Site – Again making it easy for linking.

3. External files once again to linked in a Workitem entry.

28) Does it send data compressed over the network?

Team Foundation uses Web Services for cross machine communication and by default automatically configures IIS use Compression.

29) Working from home / remote location?

Since cross machine communication is accomplished through web services remote access is vastly simplified.

30) Working offline? If the server is offline?

Yes, you need to change the file property to offline via a command utility called TFPT and save changes your local workspace. Any subsequent check-in does a get latest which would resolve if there are conflicts to be merged.

Tagged : / / / / / / / / / / / / /

Top 25 Chef configuration management interview questions and answers


Source –

What is a resource?
Answer- A resource represents a piece of infrastructure and its desired state, such as a package that should be installed, a service that should be running, or a file that should be generated.

Question: What is a recipe?
Answer- A recipe is a collection of resources that describes a particular configuration or policy. A recipe describes everything that is required to configure part of a system. Recipes do things such as:

install and configure software components.
manage files.
deploy applications.
execute other recipes.

Question: What happens when you don’t specify a resource’s action?
Answer- When you don’t specify a resource’s action, Chef applies the default action.

Question: Are these two recipes the same?

package 'httpd'
service 'httpd' do    action [:enable, :start]  end


service 'httpd' do    action [:enable, :start]    end
package 'httpd'

No, they are not. Remember that Chef applies resources in the order they appear. So the first recipe ensures that the httpd package is installed and then configures the service. The second recipe configures the service and then ensures the package is installed.

Question: The second recipe may not work as you’d expect because the service resource will fail if the package is not yet installed.

Are these two recipes the same?

package 'httpd'
service 'httpd' do    action [:enable, :start]    end
package 'httpd'
service 'httpd' do    action [:start, :enable]    end

No, they are not. Although both recipes ensure that the httpd package is installed before configuring its service, the first recipe enables the service when the system boots and then starts it. The second recipe starts the service and then enables it to start on reboot.

Are these two recipes the same?

file ‘/etc/motd’ do
owner ‘root’
group ‘root’
mode ‘0755’
action :create

file ‘/etc/motd’ do
action :create
mode ‘0755’
group ‘root’
owner ‘root’

Yes, they are! Order matters with a lot of things in Chef, but you can order resource attributes any way you want.

Question –
Write a service resource that stops and then disables the httpd service from starting when the system boots.

Answer –
service ‘httpd’ do
action [:stop, :disable]

How does a cookbook differ from a recipe?
A recipe is a collection of resources, and typically configures a software package or some piece of infrastructure. A cookbook groups together recipes and other information in a way that is more manageable than having just recipes alone.

For example, in this lesson you used a template resource to manage your HTML home page from an external file. The recipe stated the configuration policy for your web site, and the template file contained the data. You used a cookbook to package both parts up into a single unit that you can later deploy.

How does chef-apply differ from chef-client?

chef-apply applies a single recipe; chef-client applies a cookbook.

For learning purposes, we had you start off with chef-apply because it helps you understand the basics quickly. In practice, chef-apply is useful when you want to quickly test something out. But for production purposes, you typically run chef-client to apply one or more cookbooks.

You’ll learn in the next module how to run chef-client remotely from your workstation.

What’s the run-list?

The run-list lets you specify which recipes to run, and the order in which to run them. The run-list is important for when you have multiple cookbooks, and the order in which they run matters.

What are the two ways to set up a Chef server?

Install an instance on your own infrastructure.
Use hosted Chef.

What’s the role of the Starter Kit?
The Starter Kit provides certificates and other files that enable you to securely communicate with the Chef server.

Where can you get reusable cookbooks that are written and maintained by the Chef community?
Chef Supermarket,

What’s the command that enables you to interact with the Chef server?

What is a node?
A node represents a server and is typically a virtual machine, container instance, or physical server – basically any compute resource in your infrastructure that’s managed by Chef.

What information do you need to in order to bootstrap?
You need:

your node’s host name or public IP address.
a user name and password you can log on to your node with.
Alternatively, you can use key-based authentication instead of providing a user name and password.

What happens during the bootstrap process?
During the bootstrap process, the node downloads and installs chef-client, registers itself with the Chef server, and does an initial checkin. During this checkin, the node applies any cookbooks that are part of its run-list.

Which of the following lets you verify that your node has successfully bootstrapped?

The Chef management console.
knife node list
knife node show
You can use all three of these methods.

What is the command you use to upload a cookbook to the Chef server?
knife cookbook upload

How do you apply an updated cookbook to your node?
We mentioned two ways.

Run knife ssh from your workstation.
SSH directly into your server and run chef-client.
You can also run chef-client as a daemon, or service, to check in with the Chef server on a regular interval, say every 15 or 30 minutes.

Update your Apache cookbook to display your node’s host name, platform, total installed memory, and number of CPUs in addition to its FQDN on the home page.

Update index.html.erb like this.
<h1>hello from <%= node[‘fqdn’] %></h1>

<%= node[‘hostname’] %>
<%= node[‘platform’] %> – <%= node[‘platform_version’] %>
<%= node[‘memory’][‘total’] %> RAM
<%= node[‘cpu’][‘total’] %> CPUs

Then upload your cookbook and run it on your node.

What would you set your cookbook’s version to once it’s ready to use in production?

According to Semantic Versioning, you should set your cookbook’s version number to 1.0.0 at the point it’s ready to use in production.

What is the latest version of the haproxy community cookbook?

To know the latest version of any cookbook on Chef Supermarket, browse to its page and view the latest version from the version selection box.

Or, get the info from the knife cookbook site command, like this.

knife cookbook site show haproxy | grep latest_version

Create a second node and apply the awesome_customers cookbook to it. How long does it take?

You already accomplished the majority of the tasks that you need. You wrote the awesome_customers cookbook, uploaded it and its dependent cookbooks to the Chef server, applied the awesome_customers cookbook to your node, and verified that everything’s working.

All you need to do now is:

Bring up a second Red Hat Enterprise Linux or CentOS node.
Copy your secret key file to your second node.
Bootstrap your node the same way as before. Because you include the awesome_customers cookbook in your run-list, your node will apply that cookbook during the bootstrap process.
The result is a second node that’s configured identically to the first one. The process should take far less time because you already did most of the work.

Now when you fix an issue or add a new feature, you’ll be able to deploy and verify your update much more quickly!

What’s the value of local development using Test Kitchen?

Local development with Test Kitchen:

enables you to use a variety of virtualization providers that create virtual machine or container instances locally on your workstation or in the cloud.
enables you to run your cookbooks on servers that resemble those that you use in production.
speeds up the development cycle by automatically provisioning and tearing down temporary instances, resolving cookbook dependencies, and applying your cookbooks to your instances.

What is VirtualBox? What is Vagrant?

VirtualBox is the software that manages your virtual machine instances.

Vagrant helps Test Kitchen communicate with VirtualBox and configures things like available memory and network settings.

Verify that your motd cookbook runs on both CentOS 6.6 and CentOS 6.5.

Your motd cookbook is already configured to work on CentOS 6.6 as well as CentOS 6.5, so you don’t need to modify it.

To run it on CentOS 6.5, add an entry to the platforms section of your .kitchen.yml file like this.

---       driver:       name: vagrant
provisioner:       name: chef_zero
platforms:       - name: centos-6.6       driver:       box: opscode-centos-6.6       box_url:       - name: centos-6.5       driver:       box: opscode-centos-6.5       box_url:
suites:       - name: default       run_list:       - recipe[motd::default]       attributes:

In many cases, Test Kitchen can infer the box and box_url parameters, which specify the name and location of the base image, or box. We specify them here to show you how to use them.

Run kitchen list to see the matrix of test instances that are available. Here, we have two platforms – CentOS 6.5 and CentOS 6.6 – multiplied by one suite – default.

$kitchen list

Instance           Driver   Provisioner  Verifier  Transport  Last Action default-centos-66  Vagrant  ChefZero     Busser    Ssh        <Not Created> default-centos-65  Vagrant  ChefZero     Busser    Ssh        <Not Created>

Run kitchen converge to create the instances and apply the motd cookbook.

$kitchen converge    -----> Starting Kitchen (v1.4.0)    -----> Creating <default-centos-66>...    Bringing machine 'default' up with 'virtualbox' provider...    [...]    Running handlers:    Running handlers complete    Chef Client finished, 1/1 resources updated in 10.372334751 seconds    Finished converging <default-centos-66> (3m52.59s).    -----> Creating <default-centos-65>...    Bringing machine 'default' up with 'virtualbox' provider...    [...]    Running handlers:    Running handlers complete    Chef Client finished, 1/1 resources updated in 5.32753132 seconds    Finished converging <default-centos-65> (10m12.63s).  -----> Kitchen is finished. (19m47.71s)

Now to confirm that everything’s working, run kitchen login. But this time, you need to provide the instance name so that Test Kitchen knows which instance to connect to.

$kitchen login default-centos-66       Last login: Wed May 13 20:15:00 2015 from              hostname:  default-centos-66       fqdn:      default-centos-66       memory:    469392kB       cpu count: 1       [vagrant@default-centos-66 ~]$ logout       Connection to closed.$kitchen login default-centos-65       Last login: Wed May 13 20:28:18 2015 from              hostname:  default-centos-65       fqdn:      default-centos-65       memory:    469452kB       cpu count: 1       [vagrant@default-centos-65 ~]$ logout       Connection to closed.
Tagged : / / / / / / / / / / / / / / /