Ruby in Goa! – Part 2

The Event Day
~~~~~~~~~~~

IMG_20190120_093926

Right after the wonderful Golang workshop by William Kennedy, it was now time to celebrate the 10th year of Ruby Conference India on the 20th and 21st of January, 2019.

RubyConf India is a global event complementing other RubyConf events across the world. This year the event was a 2 day, single track event focused on Ruby Language, Framework and Tools.

IMG_20190120_135542.jpg

“Matz is Nice So We Are Nice”

The conference took off with Matz keynote (those of you who don’t know Matz need to know that he is the creator of Ruby language and an awesome human being!), he spoke about:

  • Ruby as a programming language.
  • The past, present and future of the programming language.
  • He also told us that he is going to work on concurrency in ruby in 2019.
  • The power of the community.

One more interesting talk that I would like to mention is The Ultimate Ruby Developer’s Command Line Toolkit – by Brad Urani. Basically, he has given a bunch of  “dot” file scripts that might help one to fasten his/her daily work. If you just go through his slide deck, you will get the entire gist of his talk. You can find his slide deck here.

Another great talk that one must look for was Using Tests as a Tool to Wrangle Legacy Projects – by Jason Swett. Jason is fairly a cool Rubyist and a trainer for Ruby testing. To get the gist of his talk you can read an article written by him here.

 

Conversations
~~~~~~~~~~~

An evening party was held at the end of the first day of the conference where I had some interesting conversations which I would like to share:

Goutum Rege: We spoke about how important it is to set goals in life. Speaking of which he said that it is very important that all our goals are time specific.

Matz: I was very curious about how new features are added to Ruby. When I asked Matz about the same, he said that he used to speak with the core developers of Ruby and used to visit many conferences where he met various Ruby users. He also added that once he has collected all the views from the developers and the users, he chooses what could possibly go in the next version of Ruby.

When I asked him about his opinion on learning new languages, he said every programming language is created to solve a specific set of problems and that learning new languages help in understanding a different perspective. So it is good to know other languages too.

Anshul Khandelwal: He is the founder of difference-engine.ai, a company in Mumbai that works on AI to solve problems faced by lawyers while creating documentation. So at present, they are using Teraform for provisioning the machines in their infrastructure but were looking for a change! Considering how Teraform and Foreman are pretty similar applications 😛 , I thought it was the right time to tell him that I work on Foreman. If things go as per plan, we might soon have a Foreman session in Mumbai.

Bilal Budhani: We spoke about how GraphQL has grown through the years. Last year when I met Bilal he was writing a book about GraphQL and Ruby. The reason why he couldn’t finish his book yet is that too many features are getting introduced with each version of GraphQL and that many quick changes taking place with each release.

I also spoke to a group of people who were talking about whether there should be informal/non-technical talks in a technical conference like Ruby Conf.

 

Conclusion
~~~~~~~~

Ruby Conf India has been one of the exceptionally awesome conferences where I keep meeting some new like-minded people every year.

Advertisements

Golanging in Goa! – Part 1

Prelude
~~~~~~~

Goa is a state in the western India with coastlines stretching along the Arabian Sea. Goa is known for its beaches, ranging from popular stretches at Baga and Palolem to those in laid-back fishing villages such as Agonda. But my reason for being in Goa this time was a lttle different.

I visited Goa for two reasons:

  1. Golang Workshop by William Kennedy(“Bill”).
  2. Ruby Conf India 2019.

Golang Workshop
~~~~~~~~~~~~~~

The Golang workshop was a two-day event, which was meant for a naive or new to Golang audience. It aimed at learning the specifications, implementation and idioms to help one be a better Go developer.

Bill is a very enthusiastic teacher and has many years of experience in teaching Golang. In his words “this workshop is about teaching enough Go so people can read as much code as possible. I throw in a lot of the why and reasoning behind the language.”

IMG_20190116_174039.jpg

The workshop covered many topics right from language syntax, methods, interfaces, concurrency to Go routines and channels. Bill focused a lot on explaining the history of Golang and why things are the way they are in Golang.

Quotes :
~~~~~~~

I would like to share some beautiful, informative and inspiring quotes that Bill shared while he was talking about the history of Golang:

Engineering is all about understanding the cost of your decision.

He said that every decision that you make comes with a cost. There is a benefit of that decision and there is a cost. If the benefit is worth the cost then you have made the right engineering decision.

There are two kinds of software projects: those that fail and those that turn into legacy horrors – Peter Weinberger.

Debuggers don’t remove bugs, they only show them in slow motion – William Kennedy

What he meant by this was that he doesn’t believe in fixing his issues using debuggers because debuggers are not meant for doing that. This was a new thing for me though! According to Bill, one should use their logs extensively rather than the debuggers.

The one that I like the most and can surely agree to is:

We think awful code is written by awful developers. But in reality, its written by reasonable developers in awful circumstances – Sarah Mei

Some of the specific take-aways from the Golang workshop are:

  • Nothing is free! every engineering decision comes with a cost.
  • Golang is a data-oriented programming language.
  • Everything in Golang is a “pass by value”. What you see is what you get!
  • There are only types of semantics – value semantics and pointer semantics. In value semantics, every piece of code operates on its own copy of data while in pointer semantics data is shared between the resources.
  • When we define a piece of data in Golang, we must think about the semantics and make it consistent throughout the application for that data.
  • Don’t guess anything!
  • Go promises not to take more than 25% of the CPU capacity.
  • Remove non-productive allocations!
  • Don’t hide sharing of data(meaning ), it hides the cost!
  • SMALL == FAST !
  • Use comments when you are taking an exception.
  • Always use pass by value for slice and map.
  • Never to go from pointer semantics to value semantics.
  • You don’t always need interfaces in Go. It’s called interface pollution.
  • You cannot design your project with interfaces, you need to discover them.
  • Interface values are valueless. It is used for data storage.
  • In your program, the main function is the only function that talk configuration!
  • Don’t treat Go channels as queue’s, treat them as signals.

 

Conclusions
~~~~~~~~~~~

The workshop seemed to revise a lot of things that I had once studied theoretically in college. I loved to learn about the reasoning that Bill gives for Golang to be the way it is. I really enjoyed the Golang workshop, thanks to William Kenedy for that.

RootConf’18

Prelude
~~~~~~~

The ###rootconf India is one of the most renowned conferences on DevOps and IT Infrastructure. The conference attracts a huge amount of contributors and DevOps enthusiasts throughout India. RootConf’18 was held on 10th and 11th May at Bangalore.

  • The aim of the conference:
    1. Learn how to avoid expensive mistakes when designing and maintaining your infrastructure.
    2. To network with some of the best system engineers and DevOps programmers in India and South Asia.
    3. To talk to decision-makers and IT managers on how they plan infrastructure for their companies.

This slideshow requires JavaScript.

The Event
~~~~~~~~~

Day 1: Ansible Workshop
~~~~~~~~~~~~~~~~~~~~~

I was invited to ###rootconf for conducting a workshop on Automation with Ansible: beginner to advanced

  • Topic covered in the workshop were:
    1. Introduction to configuration management.
    2. DevOps concepts like infrastructure as code, idempotency, and build/deployments.
    3. Ansible requirements, installation, and configuration.
    4. Ansible inventory, playbooks, modules, variables and conditionals, roles and galaxy.
    5. Lastly, how Ansible fits in as a perfect configuration management tool in the DevOps world.

The workshop was held on 9th May, one day prior to the main conference, I had created a GitHub repository which consisted of multiple questionnaires, exercises, and quizzes for the attendees. Multiple pull requests were received for the quiz and exercises.

 

 

Day 2 and Day 3: Main Conference Days
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

IMG_20180510_154007_HHT

 

It was a two-day conference and all the talks mainly focused on DevOps and Securing Systems. The first day of the main conference was mostly about Securing Systems while the second day consisted of the DevOps related talks.

I presented a lightning/flash talk about the Foreman project at the conference which can be found on youtube.

At around 6 pm in the evening, when the conference was about to end…the screens were shutting down…we were packing up to head home, Bangalore rains decided to give us a surprise. Stuck in the rain, when we were just starting to wonder on finding ways to pass the time, we accidentally ended up meeting @_riddhishree and attending an awesome session on application security. Well, that’s the thing about tech conferences. The most interesting conversations mostly are the ones not on the schedule.

 

This slideshow requires JavaScript.

 

Conclusion
~~~~~~~~~

If I had to summarize RootConf in a single sentence, it would be – “interesting talks, workshops and super enthusiastic people!”

 

 

My talk at TheDevTheory Conference’18

Prelude
~~~~~~~

TheDevTheory Conference was a developer community based, one-day technical conference. The conference was held at hotel Le Meridien, Gurgaon on 14th April, 2018. It had two dedicated tracks, covering various topics on DevOps and modern web development. The conference aimed to present a perfect opportunity to network with delegates and explore the modern trends and solutions in the industry. Connecting developers, discussing & debating on latest technologies were one of the main focus areas of the conference.

The Event
~~~~~~~~~

The event started with a keynote by Lee Faus(@leefaus) where he pointed out the importance of software economy and how software economy is shaping the way we use information, make decisions and collaborate on best practices.

This slideshow requires JavaScript.

Soon after the keynote the conference room was divided into two tracks, one with the DevOps theme and the other with the modern web development theme. My talk was for the DevOps theme and I spoke about the Foreman project.

I covered  the “Configuration Management at its peak with Foreman” topic, where I addressed the following:

  1. What is the need for configuration management?
  2. Forms of configuration management.
  3. Puppet: a configuration management tool.
  4. What is Foreman?
  5. How does it add up to the big picture?
  6. Key features and architecture of Foreman.
  7. Demo: Puppet integration with Foreman.

This slideshow requires JavaScript.

You can find the slides for my talk here.

This was one crazy crowd…way beyond my expectations! Such knowledge and enthusiasm on the Foreman project is not something a speaker gets to experience everyday. The session was a highly interactive one. Many questions were asked, few of them were:

  1. If I am using Cobbler, well integrated with Ansible, and it seems to work perfectly fine then why should I use foreman instead?
  2. There are APIs that Puppet, Ansible and other configuration management tools provide for reporting related work, then what is so special about Foreman’s API?
  3. Does Foreman support Ansible as a configuration management tool?
  4. I have some Ansible playbooks as part of my source code repository and I do not want to do all these tasks in Foreman UI. Rather I would like to configure Foreman in such a way that it can pick these playbooks and inventory files from my git repository and run them on the managed host. Is this feature available?

 

Conclusion
~~~~~~~~~

The talk being so interactive and people asking a lot of questions signifies the popularity and curiosity of people towards Foreman. I also met an attendee who had bought the ticket of the conference just becasue there was a talk submitted on Foreman. It was really great to hear that and made me so proud to be a part of this awesome project.

This slideshow requires JavaScript.

 

 

A day at the hackathon!

Prelude
~~~~~~~

This Hackathon I am going to tell you about was held on 16th February, 2018 at the Maharashtra Institute of Technology(MIT) College of Engineering, Pune. The 30 hours Hackathon was made a part of the Persona Fest.,2018 which was organized by the MIT college. The Hackathon focused on building a smart application that would automate tasks that are usually done manually in a university, such as – hostel management system, smart laboratory system, announcements portal, etc.

The Event
~~~~~~~~~

16th February
~~~~~~~~~~~~~

Under the Red Hat’s University Outreach program, I and Poojarani Chopra were invited to mentor the Hackathon.  The Hackathon had around 16 teams, including 2 teams from Bangalore and 1 from Mumbai. A total of 70 students participated in the Hackathon.

The event began with a ceremony where the Dean of the MIT college, Prof. Dr. Kishore Ravande, felicitated us with a bouquet of roses and introduced us to the participants.

This slideshow requires JavaScript.

Soon after the ceremony, the Hackathon began! Since students were going to build their project from scratch, I thought it would be great if I could explain them the importance of an Open Source License in their project.

I spoke about “How to choose an Open Source License“, where I addressed the following topics:

  1. What is Copyright?
  2. Why do we write software?
  3. Why use an Open Source License?
  4. Types of Open Source Licences.
  5. How to decide what type of open-source license to use?

This slideshow requires JavaScript.

You can find the slides for my talk here.

Throughout the hackathon, a lot of interesting questions came up. I don’t really remember all..but a few interesting ones were:

  1. Which open-source database is the most appropriate to use in a web application?
  2. One should use Django or Ruby on Rails for the given problem statement?
  3. How to contribute to Open Source?

Students also asked many questions related to their code as and when they got stuck. A lot of students were trying to deploy their applications on Heroku but were facing problems doing so. That’s when I decided to demonstrate Openshift to them. I explained how they can deploy their small application for free on Openshipt online. One of the students literally thought of Openshift as magic! Well, it is 🙂

Conclusion
~~~~~~~~~

Meeting enthusiastic students and spending some fun time coding is something I totally love doing. I would like to take this opportunity to thank Rupali and Varsha for giving me this chance of being at such a fun event. The University Connect program is not only helping a lot of students meet Red Hatters and learn more about Open Source and Red Hat…it is also helping a lot of us get more opportunity of working with students and also delivering interesting sessions.

The one great feeling thats worth sharing here was that when I was distributing some feebies at the college, the students loved it so much that they ended up calling me Santa Clause! I totally loved being one 😛

end

My talk at December Pune Ansible Meetup.

The December Pune Ansible meetup was conducted on 9th December, 2017 at Red Hat, Pune. The meetup was scheduled at 10:30am, and by 10:45am, it was already house-full:-).

I spoke about “Implementing Ansible with vagrant machines“, where I addressed the following topics:

  1. What is Vagrant?
  2. What are the advantages of using Vagrant?
  3. How to write  Ansible playbooks?
  4. How to perform Vagrant provisioning using Ansible?

This slideshow requires JavaScript.

The talk was targeted for both beginners and experienced Ansible users. There were two objectives of this session. First, to enable the beginners to set up their local environment with Vagrant machines so that they can play with Ansible. And second, to enable the experienced Ansible users to provision Vagrant machine using Ansible playbooks.

One of the interesting part of this session was, when I was almost about to conclude my talk and was sharing about how we use Ansible in Forklift(deployment scripts for Foreman and Katello), audience got immensely interested in knowing more about Foreman and we ended up having a good 40 minute discussion around Foreman and what is my role in the development of Foreman at Red Hat.

I addressed the following topics:

  1. What is Foreman?
  2. What is Katello?
  3. What is Foreman Discovery?
  4. What is auto-provisioning?
  5. What are Discovery Rules? How to create one?

This slideshow requires JavaScript.

To make it even more interesting, I demonstrated the workflow to create a Discovered Host. You can find the slide-deck for my talk here.

Lastly, I would like to thank the organizer of Ansible meetup Ganesh Nalawade for providing me with the opportunity to speak at the Ansible meetup.

Linux Boot Process

In this blog post we are going to talk about all that happens right from booting of your linux system till a bash prompt appears on your screen. So tighten your seat belts as this might be a long journey altogether 🙂

It all starts from the UEFI/BIOS, which is a firmware interface that enables your computer to understand the hardware. Its sole purpose is find a bootable disk, it might be a CD/ROM, a USB pen drive or may be even your hard drive.

Next, if you wish to boot a linux distribution then all you require is a boot loader. The task of a boot loader is to load the operating system, which means it is going to basically initiate the kernel.

To get initiated, the kernel requires drivers to be present. In order to get these drivers, there is initramfs. The initramfs is a initial ram file system which has been compiled to contain the root file system as well as some drivers that helps kernel in the booting process.

Once we have the drivers loaded, we are now ready to load the init .  Init is the very first process your kernel is going to look for. The init on the previous linux systems was an process with the name /sbin/init but now in the newer distributions it has been re-directed to the systemd.

Systemd is basically the modern system manager, it is responsible to start “everything” 🙂

LinuxBootProcess

That was a brief introduction to the boot process, lets dive deep now into each of the aspects mentioned above :

UEFI or BIOS ?

BIOS and UEFI are nothing but interfaces that were developed to provide a platform that resides between the hardware/firmware and operating system.

BIOS is an older version of the interface, with the increase in development of hardware there was an emerging need to upgrade the interface and that is when UEFI came into the picture.

Booting from BIOS or UEFI disks:

On a BIOS system, the Master Boot Record(MBR) is read from disk and the stage1 boot loader is activated. The stage1 boot loader is only 446 bytes and its task is to load the larger stage2 boot loader that resides in the first MB of the disk. The first MB of the disk is the meta-data area. So, everything that is needed to load the kernel is completely present in this first MB of the disk.

This is how the MBR looks:

MBR_

This is stored in the hexa-decimal format, so i can’t quite explain it to you :-p but there are some interesting facts to this. If you see on the lower right-hand side of the screen, you will be able to see something like ” GRUB .. Geom.Hard Disk.Read. Error”, this signifies that you shall enter a rescue shell mood if there are any errors while initiating the grub.

Another interesting thing we can observe is the highlighted ’83’ which signifies the code number for Linux partition type.  So you can also identify the partitions from the MBR. Also, 55aa is kinda the magic code which signifies the completion of the MBR. One important thing to note here is that, logical partitions are not stored in the MRB so we do not find the ‘8e’ code in the block.

Enough about BIOS, lets check out some facts about UEFI too!

On a UEFI system, a GUID PArtition Table(GPT) is always used, although a MBR is maintained for the backward compatibility. The GPT partition table contains an EFI System Partition(ESP) which contains a directory with name EFI. In this directory, each boot loader has its own identifier and corresponding  sub-directory. The amazing thing is that, the boot loader itself has the .efi extension and resides in these subdirectories along with its supporting files.

From BIOS/UEFI to the boot loader:

The boot loader is responsible for loading the OS kernel. Different boot loaders are available(such as GRUB, SYSLINUX, LILO, etc) but currently GRUB 2 is the most commonly used boot loader.

  • Also, it provides other options like:
    1. Select a kernel from the boot manual.
    2. Pass kernel parameters
    3. Support other operating systems such as windows.

Now that we understand a little more, lets look into the boot process closely:

boot_process

You can find the GRUB2 in your /boot/grub2/ directory:

Screenshot from 2017-09-24 21-06-15

Out of the above files shown, the most interesting content is present in the grub.cfg file. The grub.cfg file contains almost everything that the grub should execute.  The grub.cfg file is a key configuration file of your system, you will know that as soon as you try to open that file it tells you not to update this file.

Quite interesting! isn’t it?

Lets check out some of the important content of the grub.cfg:

Function load_video:

Screenshot from 2017-09-24 21-08-18

Above shown is the function load video, in this function you shall be able to see the insmod. You must have probably heard of insmod before, that pretty much what we do in a kernel environment. Different modules for the video card are present here, so depending on your specific video hardware, chances are that the right configurations will be loaded.

What is /etc/grub.d/10_linux?

Screenshot from 2017-09-24 21-18-35

Let us now understand, what exactly is in 10_linux block? The /etc/grub.d/10_linux  is the input file which is providing the system which all the drivers that are needed like:

  1. load_video: video loader must be loaded.
  2. gzio: which helps in reading the initramfs.
  3. part_msdos: which provides the system with MBR partition table.
  4. ext2: it allows grub to read the contents of the /boot directory.

Screenshot from 2017-09-24 21-20-58

The above highlighted line set root=’hd0,msdos1′ indicates the first partition on the hard drive. We normally call the sd1 partition to indicate the first partition but given that sda is the kernel name and since the kernel has not been loaded yet, we cannot refer the partition as sda.

Screenshot from 2017-09-24 21-23-42

The above highlighted lines of shell scripts are basically the parameters that are passed to the kernel while the booting process. You shall find similar kind of code if you press e while your system boots.

Screenshot from 2017-09-24 21-27-14

If you scroll towards the end of the file(grub.cfg), you shall notice grub.d being mentioned many time. So what is grub.d? It is nothing but simply a file that reads all the kernels that are installed in the /boot directory and will provide menu entries. Menu entries are visible while the booting process.

The /etc/defaults/grub:

The interface for the administrators is present in /etc/defaults/grub:

Screenshot from 2017-09-24 21-30-58

Some of the interesting statements are:

GRUB_TIMEOUT=5: this specifies how much time the grub should wait before it automatically selects the option for booting.

GRUB_CMDLINE_LINUX=: specifies the command line options, these are the options that are passed to the kernel that is loading.

We can remove rhgb which is the Red Hat graphical boot and quite makes the user see nothing while the system is booting, from the options. If we want the changes to be persistent then, we can use grub2 commands like grub2-mkconfig and so on.

initramfs:

So the reason why we need the initramfs is that, the linux kernel is modular, it is not compiled with all the possible disk drivers inside.

Screenshot from 2017-09-26 01-39-13

If you are using some proprietary drivers to access the hardware in your machine, which is required for booting, then the proprietary drivers cannot be in the kernel as they are proprietary and that is why it makes sense writing them to an initramfs.

Last is the systemd, i guess systemd is a huge topic itself. Lets talk about it in my next blog 🙂

Hope you enjoyed reading, happy hacking 🙂