Archives September 2019

Devops In and Out

DevOps Journey

What is DevOps ?

DevOps is a software engineering culture and practice that aims to unify software development (Dev) and software Operation (Opps). It is a culture of collaboration between development and operational people.-

It is also important to understand what is NOT DevOps.

  • Set of Tools
    There is huge list of tools used in DevOps world, the list is exhaustive but are these tools DevOps , answer is no.
  • DevOps is a standard answer is no it is not a standard similar to ISO standards or a framework similar to ITIL , DevOps is just a cultural movement, designed to provide delivery and stability at the same time.
  • DevOps is not a product , it is just a culture that is practice by an entire organization that is performing software development / operation.
  • DevOps as a job title , yes though it is one of in demand jobs currently there is no such title as DevOps, it is simply a culture practiced by Developers and Operation teams to collaborate and any one with the right experience and knowledge can fit into this role.

DevOps culture change

In the past the developers and operational team were working in silos and each process follow in a serial fashion, this design was very successful in the past decade considering the size of the software and the complexity it brings. SDLC (software development life cycle) models such as WaterFall were used to create and maintain. In today’s 4G world software application are mostly mobile / web-based, updates are very frequent infact some are even updated daily or weekly, and that is where the challenge to manage both development and operation collide. Teams on either end would try to push ends to perform better, this is totally in contrast to the model followed in the past decade.

To overcome this challenge Development and Operation teams were merged a change in the team culture was brought in by applying agile principals to deliver short and fast updates / rollouts to the customer keeping in mind both speed of delivery and operational stability in mind.

Goals of a DevOps culture
  • Fast time-to-market (TTM)
  • Few production failures
  • Immediate recovery from failures

DevOps practices and tools

DevOps performs both Operational and Developer tasks , below are the list of practices that are considered part of Devops practices.

  • Build Automation
  • Continuous Integration
  • Continuous Deployment & Delivery
  • Infrastructure as Code
  • Configuration Management
  • Orchestration
  • Monitoring
  • Orchestration

CentOS 8 Released

centos

Highly anticipated CentOS version 8 was released on 24th September 2019.

Get the torrent now :

http://mirror.centos.org/centos/8/isos/x86_64/CentOS-8-x86_64-1905-dvd1.torrent

SHA256 707a66357f72eb822ca113991f3bb86a1ac1ed5fbc2fa5d968ed25fb48ee985c


http://mirror.centos.org/centos/8-stream/isos/x86_64/CentOS-Stream-x86_64-dvd1.torrent
SHA256: 88604a95189f91162d1f89f0ac7436f3413812506a41b8ec286baeaa833b1e91

Linux Boot Series – SystemD

boot process SystemD

Though SystemD will be compared to its predecessor SystemV for a long time , it has much more to offer in terms of System Management. It is a new way how Linux interact with the underline Objects such as hardware , sockets , application processes and many more.

Understand How SystemD works

systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts.

Features
  1. Contrary to its predecessor SystemD handles processes parallel
  2. socket and D-Bus activation
    traditionally services will be configured to start on boot, but with systemd it is more event driven and you can configure to start when something connects to a specific port or a device get connected , this is called socket and d-bus activation.
  3. Offers on-demand starting of daemons, also keeps track of processes using Linux cgroups
  4. Supports snapshot and restoring of the system state
  5. Maintains mount and automount points
  6. Implements an elaborate transactional dependency-based service control logic.

systemD working

Concept of Units in SystemD

SystemD manages units, which are representations of system resources and services.

Type of Units in SystemD
  1. Service
    A Service unit is used to manage service, the unit file include instruction to start , stop , restart the service.
  2. Socket A network socket associated with a service.
  3. Device
    Unit file related to Device is used to manage Device , start , stop , auto etc.
  4. Mount Unit manages the Mount points via SystemD
  5. Automount Unit file mounts the file system on system boot. This feature might replace traditional fstab files in the near future.
  6. Swap Mounts swap space on the system
  7. Target Targets are much like Runlevel used previously to manage different services to start and stop at different
  8. Path
    A path for path-based activation. For example, you can start services based on the state of a certain path, such as whether it exists or not.
  9. Timer Timer unit is used similar to Crontab to schedule other units.
  10. Snapshot
    A snapshot of the current systemd state. Usually used to rollback after making temporary changes to systemd.
  11. Slice Restriction of resources through Linux Control Group nodes (cgroups).
  12. Scope Information from systemd bus interfaces. Usually used to manage external system processes.
systemctlcommand

is the primary tool to manage SystemD. It can be used for starting , stopping of services as well as enabling and disabling , this was previously performed with service and chkconfig commands in the previous versions.

Basic Service Management Syntax
Description: Command
Start the Service systemctl start foo
Stop the Service systemctl stop foo
Restart the Service systemctl restart foo
Status of the Service systemctl status foo
Enable Service to start at bootime systemctl enable foo
Disable the Service systemctl disable foo
Check if service is enabled
?
systemctl is-enabled foo

Mask
the Service
systemctl mask foo
Reload the updated unit file systemctl daemon-reload
Show Failed Services systemctl -failed
Reset any failed service systemctl reset-failed
Show properties of the Unit systemctl show < service >
Edit the Service Unit systemctl edit < service >
Edit the Full Service Unit systemctl edit --full < service >
Run on remote host systemctl -H < host_name > status network
Changing System State
Reboot host systemctl reboot
Poweroff host systemctl poweroff
Switch to Emergency mode systemctl emergency
Log back to default mode (Multi-User) systemctl default
Viewing Log Messages
Show all log messages journalctl
Show only kernel log messages journalctl -k
Show log for specific service journalctl -u network.service
Follow messages as they appear journalctl -f

Besides services, most systemd commands can work with these unit types: paths,
slices, snapshots, sockets, swaps, targets, and timers

Linux Boot Series – Part 2

linux boot process 2

Once the Hardware check POST “Power On Self Test” is completed and boot devices are identified , the last step by UEFI / BIOS was to identify the first boot device read the  <abbr title=”Master boot record”>MBR</abbr>. Its a 512 byte in the storage device that stores boot loader information, this can be considered as an index location that refer to other sectors for loading the Operating System. In most of the Linux distributions GRUB V2 is used as a bootloader as of this writeup.

GRUB V2 stands for “Grand Unified Bootloader, version 2” , it is the program that identifies and loads system kernel. At this point we should be clear why we use GRUB2 / GRUB V2 rather then just simply calling it GRUB ? that is because GRUB V2 is the rewrite of a legacy bootloader GRUB2 with many new features and a modular design. It is designed for multi-OS boot running multiple Linux, Unix and other proprietary Operating systems such as MS Windows. It can even identify multiple kernel for the Same Linux distribution and allow to boot from older version if required.

The default configuration file is
Ubuntu /boot/grub/grub.conf
RHEL 7 /boot/grub/grub.conf

Grub in itself is a complete topic to be discussed along with its configuration and management options which is discussed in GRUB section.

Once the Kernel is selected, Kernel along with initramfs is loaded in main memory and root file system gets mounted, the first process in legacy SystemV was the init process which will initiate the OS processes , but this has changed with Canonical Upstart and more recently SystemD. Both these systems have been designed to overcome what was previously the shortcomings of SystemV INIT system, both of these have comparatively similar features but do differ in design and architecture. As of now SystemD seems to lead with many big distribution such as Redhat , Fedora , CentOS , Debian and last but not least Ubuntu have given up Upstart in favor of SystemD, one of the reason was both of these system were causing more confusion for the software developers community.

To keep things simple i have divided the working of these three system in separate links below.

  1. System V Init (Legacy)
  2. Upstart
  3. SystemD

manage docker images

docker add remove

Once you have installed docker its time to manage , pull , remove docker images.

What is an Image

Image is a file that comprise of multiple layers used to execute code in a docker. It is built from the instruction for a complete and executable version of an application.

Note it does rely on the OS kernel

There are more then 1500 images created by different application teams such as by apache , ngnix , mysql , mariadb , these are called official docker images. One of the biggest repositories for these official docker images is

https://hub.docker.com

.

Installing Images

Downloading and installing an image on docker in Linux is a very straight forward way with a single command,example ngnix

docker pull <package_name>

To pull a particular version of an image

docker pull <package_name>:package_version_detail

by default pull will grab the latest version of the package and same goes for removing the version with docker rmi <package_name>

To see all the images that are downloaded on your machine use the command

docker images 

To delete an image you can type

docker rmi <package_name>:package_version_details

if no package version details are added it will delete the latest version of the package.

Copyright © 2021 | SaitCare Hub SDN BHD