How Do You Use a Dockerfile with Reserved Words ENTRYPOINT and CMD to Create an Image and Test It Out?

Problem scenario
You want to use the ENTRYPOINT and CMD keywords in a Dockerfile.  You know that the value of CMD amounts to a parameter for the ENTRYPOINT value which is executed.  You want to verify that the value of ENDPOINT is used in an execution.  You want the Dockerfile to be simple to illustrate these reserved words.  What do you do?

Solution
Prerequisite
Install Docker.  See this posting if you need directions.

Procedures
1.  Create a file called Dockerfile.  Have these three lines be the content:

FROM ubuntu:latest
ENTRYPOINT ["echo"]
CMD ["parameter1 parameter2"]

2.  Run this command:  docker build .

3.  The above command should say something like this:  "Successfully build abcd1234"
The "abcd1234" is the image ID.  Run this next command, but replace "abcd1234" with the image ID that you just created:

docker run abcd1234

# This command above should print "parameter1 parameter2".  

You are done.  That should demonstrate how ENTRYPOINT values use the CMD values as parameters.  In the Dockerfile when you use "docker run" with an image that was the result of a Dockerfile with ENTRYPOINT and CMD stanzas, there will be execution of ENTRYPOINT with one or more additional parameters if CMD is also used.  

How Do You Configure Oracle 12 to Work with JIRA 7.x when Writing a dbconfig.xml File for JIRA?

Problem scenario
You have configured dbconfig.xml for JIRA 7.x to use Oracle 12.  But JIRA is not working correctly when you try to start it.  What should you do with your dbconfig.xml file?

Solution
Atlassian's website, as of 8/30/18, recommends having "oracle10g", an unsupported version, in the dbconfig.xml file.  This is despite the fact that Oracle 10 and Oracle 11 are not supported for JIRA 7.x according to Atlassian's site here.

The XML tag for the database type in dbconfig.xml (a file for JIRA) should specify version 10 -- even though it is not supported!  Atlassian's website shows the correct tag in the dbconfig.xml file on their website as this:

<database-type>oracle10g</database-type>

The tag should not say "oracle11g" or "oracle12g".  It should say a version that is not supporte: "oracle10g".

How Do You Monitor The Disk Activity of a Linux Server with a Command Similar to top?

Problem scenario
You think that there is disk contention with the various processes on your Linux server.  You think that the I/O activity is too high and potentially creating a bottleneck.  What do you do to learn more about disk utilization?

Solution
1.  To learn the names of the underlying disks on your Linux system, run this command:

ls -lh /dev/disk/by-path

2.  Now run this command:

ls -lh /dev/disk/by-path | awk '{print $11}'

3.  Then based on the output of the above command, mentally replace the "../../" with "/dev/" when you compose the next command.  (So instead of using "../../sda1" use "/dev/sda1".)

To find the activity with five-second intervals of each disk found in the above command, compose a command such as this:

iostat -dz /dev/sda /dev/sda1 /dev/sda2 5

# The arguments between the "-dz" and "5" are the names of the disks.  Run the command you compose in the format above (e.g., with the interval you want and the disks you want).  The "z" flag omits disks that have no activity during the reporting period.

Using Ansible How Do You Search The Contents of a File on Linux for “{{” or “}}”?

Problem scenario
You want to see if an Ansible playbook is injecting (or leaving) two braces, "{{" or "}}", in a specific file on Linux.  These symbols can be injected accidentally with little notification.  Variable substitution could fail during the course of a playbook run.  This is a subtle problem that may have no alert.  You want some debugging to check for these symbols.  How do you know a file on a managed node does not have a "{{" or "}}"?

Solution
Root cause

What makes the double braces difficult to place into a shell module in Ansible is that Ansible views them (as a pair) as a reserved symbol; variable expansion in Ansible is done via these very symbols in quotes.  

Procedure
You need to re-write the playbook to use the "shell" module. To search for lines that have both types of double braces, "{{" and "}}", with no quotes, put these two lines in your playbook.
shell:  /usr/bin/cat /path/to/file.txt | grep "\{\{" | grep "\}\}"
register: foundplaceholder

The backslash "\" (without quotes) acts as an escape character.  The variable foundplaceholder will have a value if a single line had both types of double braces, "{{" and "}}" (with no quotes).

How Do You Use a Jenkinsfile?

Problem scenario
You read about what Jenkinsfiles are.  Coveros.com defines them as "Jenkinsfiles, using a domain specific language based on the Groovy programming language, are persistent files that model delivery pipelines “as code", containing the complete set of encoded steps (steps, nodes, and stages) necessary to define the entire application life-cycle."

How do you use a Jenkinsfile with Declarative pipeline syntax?

Solution
Overview

A Declarative pipeline syntax has four mandatory sections with each of these reserved words: agent, stages, stage and step.  For more information about this, you may want to view this Blazemeter.com site.

Prerequisites
i.  You must have Jenkins installed.  See the posting for your type of Linux below for assistance installing Jenkins:

CentOS/RHEL/Fedora
Debian/Ubuntu

Pipeline jobs require more memory than typical Jenkins jobs.  If you need to resize your server (i.e., give it more RAM), click here if you have a server in AWS, and click here if you have a server in GCP.

If you are not using a public cloud, you may want to add physical RAM.  You may want to create virtual memory to help with performance.  To do that, see this posting.

ii.  Install the Pipeline plugin.  Log into the web UI of Jenkins as an administrator.  Go to Manage Jenkins -> Manage Plugins -> Available.  Search for "Build Plugin."  Check the box and click "Install without restart".  Next, click the option for "Restart Jenkins..." at the bottom of the screen.

Procedures
1.  Log into the web UI for Jenkins as an administrator.
2.a.  If you see "New Item" do 2.b, otherwise do 2.c.
2.b.  Click on "New Item".
2.c.  Click on "Dashboard" if you do not see "New Item."  Then click "New Item".
3.  Enter a name in the field and the top, then click on "Pipeline".  Then click "OK".
4.a.  Scroll down to the "Pipeline" section.  For a very simple choice go to step 4.b., but if you want something slightly more complex, go to option 4.c.
4.b.  In the upper righthand portion of the "Script" click on the drop down menu that says "try sample pipeline...", and click "Hello World."  Skip step 4.c. and go to step 5.
4.c.  Enter this text (which is declarative syntax according to this external site):

pipeline {
    agent any

    stages {
        stage('Build') {
            steps {
                echo 'Building..'
            }
        }
        stage('Test') {
            steps {
                echo 'Testing..'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploying....'
            }
        }
    }
}

5.  (You can uncheck the "Use Groovy Sandbox" or leave it checked.)  Click "Save".

6.a.  You can test it by clicking on "Build Now."

6.b.  You are done.  The Jenkinsfile should be checked into a source control repository.

6.c.  Here is optional reading if you want to learn more.

How Do You Clone Down a Specific Branch of a Repository from Git?

Problem scenario
You want to clone a specific branch from Git.  But you do not want to clone the master branch.  How do you clone the branch named "develop"?

Solution
1.  Clone down the repository as normal with a command like this (but replace <SSH or HTTP constructor of repo> with the remote repository):
git clone <SSH or HTTP constructor of repo>

2.  Run this command (you could replace "develop" with the name of the branch you created):  git checkout -b develop

3.  Run this command (you could replace "develop" with the name of the branch you created):  git pull origin develop

How Do You Troubleshoot the Message “pycurl error 22”?

Problem scenario
You are trying to install a new package or apply yum updates on a CentOS/RHEL/Fedora server.  But you get 404 errors or "pycurl error 22" as the result of your yum commands.  How do you use yum to install a new package or apply a new update?

Solution
Run this command:  sudo yum clean all

Now your yum commands should work.

What Is The Difference between a Kubernetes Service, the Kubelet, and the Kubernetes API?

Question
You know of different Kubernetes components: the Kubernetes Service, the Kubelet, and the Kubernetes API.  What do these components do and how are they different?

Answer
A Kubernetes service is an entity, that may span nodes, that keeps a group of Pods functional and coherent (paraphrased from this site).  A "[s]ervice will get its own IP address and port" as quoted from page 339 of Kubernetes in Action.  The IP address that they get is not actually pingable; this was also taken from page 339 of Kubernetes in Action. To learn more about a service, you can see this posting.

The Kubelet manages the Pods and the underlying containers running on the worker nodes (as contradistinguished from the master nodes).  (To read more, see page 326 of Kubernetes in Action.)

"The kubelet is the primary “node agent” that runs on each node. The kubelet works in terms of a PodSpec. A PodSpec is a YAML or JSON object that describes a pod. The kubelet takes a set of PodSpecs that are provided through various mechanisms (primarily through the apiserver) and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn’t manage containers which were not created by Kubernetes." This quote was taken from Kubernetes.io.

The Kubernetes API resides on the master node(s) to interact with the Kubelet on various nodes.  If you run programs that invoke the Kubernetes API, it will execute operations via the Kubelet running on the nodes.  (To read more, see page 326 of Kubernetes in Action.)

To learn more about Kubernetes, you may want to purchase a book on the subject other than the one cited above.

What Is The Difference between kubeadm and kubectl?

Problem scenario
Both kubeadm and kubectl are tools and commands for Kubernetes.  What are the differences between them?

Answer
kubeadm is for creating new Kubernetes clusters (as paraphrased from this Kubernetes.io page).  The command can be used to create both master nodes as well as worker nodes (taken from pg 575 Kubernetes in Action).

kubectl is for running operations on one or more existing Kubernetes clusters (as paraphrased from this Kubernetes.io page).

If you want to learn more about Kubernetes, you may want to purchase a book on the subject.

How Do You Pronounce Nagios?

Problem scenario
You have heard different pronunciations of Nagios.  How do you pronounce it?

Solution
Four of the first seven pronunciations found here support the pronunciation of Nagios with a hard "g" not a soft "g" (like a "j" sound).

This external link suggests the hard "g" is correct.

We believe that Ethan Galstad pronounces it with a hard "g."