Configuration management chef tools projects to test your skills?

rajeshkumar created the topic: Configuration management chef tools projects to test your skills?

Project 1 – Write a cookbook which can add your bash script in crontab on your nodes.

Project 2 – Perforce the following workflow of chef configuration management tools?

— create a new cookbook and add a recipe to it
— upload your cookbook to the Chef server
— configure your node’s run list
— run chef-client to trigger the configuration process on your target node

Project 3 – Write a cookbook with external cookbook_files in Chef?

Project 4 – Write a cookbook which can Set Chef Cookbook Dependencies in metadata file and use it?

Project 5 – Write a cookbook add jenkins slave nodes in jenkins master server using Chef cookbook?

Project 6 – Write a cookbook to configure nginx with chef solo on vagrant?

Project 7 – Write a cookbook to Setting up a MySQL database with a user with Vagrant and chef-solo?

Project 8 – Write a cookbook to track changes made to systems via knife in chef?

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

AWT is not properly configured on this server

rajeshkumar created the topic: AWT is not properly configured on this server

Problem
AWT is not properly configured on this server. Perhaps you need to run your container with “-Djava.awt.headless=true”? See also: wiki.jenkins-ci.org/display/JENKINS/Jenk…awt.headless+problem

Mixlib::ShellOut::ShellCommandFailed
Expected process to exit with [0], but received '2'
---- Begin output of /opt/opscode/embedded/bin/chpst -u opscode -U opscode /opt/opscode/embedded/bin/rabbitmqctl wait /var/opt/opscode/rabbitmq/db/rabbit@localhost.pid
[2016-08-31T22:10:34-04:00] FATAL:
BOOT007: The secrets file (/etc/opscode/private-chef-secrets.json) is present
but the file /etc/opscode/pivotal.pem is missing.

Ensure that private-chef-secrets.json is copied into /etc/opscode from the
first Chef Server node that you brought online, then run
‘chef-server-ctl reconfigure’ again.
FIX1:

your code here

To fix it, I deleted /etc/opscode/private-chef-secrets.json and run again chef-server-ctl reconfigure

FIX2:

cp /opt/opscode/embedded/service/omnibus-ctl/spec/fixtures/pivotal.pem /etc/opscode/

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Error executing action `run` on resource ‘execute[/opt/opscode/embedded/bin/chps

rajeshkumar created the topic: Error executing action `run` on resource ‘execute[/opt/opscode/embedded/bin/chps

Error executing action `run` on resource ‘execute[/opt/opscode/embedded/bin/chpst -u opscode -U opscode /opt/opscode/embedded/bin/rabbitmqctl wait /var/opt/opscode/rabbitmq/db/rabbit@localhost.pid]’

Fix 1
So obviously RabbitMq is running, on port 5672, which can be verified through
> netstat -ltnp
tcp 0 0 127.0.0.1:5672 0.0.0.0:* LISTEN 1111/beam.smp

Fix 2
> /etc/init.d/rabbitmq-server stop

Fix 3:
Check your /etc/hosts file. That is not defined well.

Reference
discourse.chef.io/t/chef-server-missing-…and-pivotal-pem/7756
serverfault.com/questions/663310/chef-se…-fails-with-rabbitmq
discourse.chef.io/t/chef-12-server-dead-…nfigure-bombs/7435/7

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Error: Failed to authenticate to https://api.chef.io/organizations

rajeshkumar created the topic: ERROR: Failed to authenticate to https://api.chef.io/organizations

Error
ERROR: Failed to authenticate to api.chef.io/organizations/ravitestorg as ravidaur with key /root/chefrepo/.chef/ravidaur.pem
Response: Failed to authenticate as ravidaur. Synchronize the clock on your host.

docs.chef.io/errors.html

Solution

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Error: SSL Validation failure connecting to host

rajeshkumar created the topic: ERROR: SSL Validation failure connecting to host

Problem

[root@sv-chef-server mychefrepo]# sudo knife node list
ERROR: SSL Validation failure connecting to host: 10.0.0.134 - SSL_connect returned=1 errno=0 state=error: certificate verify failed
ERROR: Could not establish a secure connection to the server.
Use `knife ssl check` to troubleshoot your SSL configuration.
If your Chef Server uses a self-signed certificate, you can use
`knife ssl fetch` to make knife trust the server's certificates.

Original Exception: OpenSSL::SSL::SSLError: SSL Error connecting to https://10.0.0.134/organizations/mysvhcl/nodes - SSL_connect returned=1 errno=0 state=error: certificate verify failed

Solution

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Jira Installation Issues and troubleshooting

rajeshkumar created the topic: Jira Installation Issues and troubleshooting

Error creating project, 401This resource requires WebSudo.

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Getting Error while executing Che recipe

rajbazar created the topic: Getting Error while executing Che recipe

Hi! Rajesh !
Installed Chef successfully on my Mac.
=================

Rajs-MacBook-Pro:~ Raj$ which chef
/usr/local/bin/chef
Rajs-MacBook-Pro:~ Raj$ chef -v
Chef Development Kit Version: 2.0.28
chef-client version: 13.2.20
delivery version: master (17c1b0fed9be4c70f69091a6d21a4cbf0df60a23)
berks version: 6.2.0
kitchen version: 1.16.0
inspec version: 1.31.1

====================
My Issue I’am not able to execute first and initial recipe .

Issue:
Raj$ vi server.rb
Rajs-MacBook-Pro:~ Raj$ chef-apply server.rb
Recipe: (chef-apply cookbook)::(chef-apply recipe)
* homebrew_package[httpd] action install

================================================================================
Error executing action `install` on resource ‘homebrew_package[httpd]’
================================================================================

Mixlib::ShellOut::ShellCommandFailed
Expected process to exit with [0], but received '1'
---- Begin output of ["brew", "info", "--json=v1", "httpd"] ----
STDOUT:
STDERR: Error: No available formula with the name "httpd"
---- End output of ["brew", "info", "--json=v1", "httpd"] ----
Ran ["brew", "info", "--json=v1", "httpd"] returned 1

Resource Declaration:

# In server.rb

1: package 'httpd'
2: service 'httpd' do

Compiled Resource:

# Declared in server.rb:1:in `run_chef_recipe'

homebrew_package("httpd") do
package_name "httpd"
action [:install]
default_guard_interpreter :default
declared_type :package
cookbook_name "(chef-apply cookbook)"
recipe_name "(chef-apply recipe)"
end

System Info:

chef_version=13.2.20
platform=mac_os_x
platform_version=10.12.6
ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin14]
program_name=/usr/local/bin/chef-apply
executable=/opt/chefdk/bin/chef-apply

[2017-07-24T10:46:03+01:00] FATAL: Stacktrace dumped to /Users/Raj/.chef/cache/chef-stacktrace.out
[2017-07-24T10:46:03+01:00] FATAL: Stacktrace dumped to /Users/Raj/.chef/cache/chef-stacktrace.out
[2017-07-24T10:46:03+01:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-07-24T10:46:03+01:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-07-24T10:46:03+01:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: homebrew_package[httpd] ((chef-apply cookbook)::(chef-apply recipe) line 1) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of ["brew", "info", "--json=v1", "httpd"] ----
STDOUT:
STDERR: Error: No available formula with the name "httpd"
---- End output of ["brew", "info", "--json=v1", "httpd"] ----
Ran ["brew", "info", "--json=v1", "httpd"] returned 1
[2017-07-24T10:46:03+01:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: homebrew_package[httpd] ((chef-apply cookbook)::(chef-apply recipe) line 1) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of ["brew", "info", "--json=v1", "httpd"] ----
STDOUT:
STDERR: Error: No available formula with the name "httpd"
---- End output of ["brew", "info", "--json=v1", "httpd"] ----

rajeshkumar replied the topic: Getting Error while executing Che recipe

I guess you are running this script in Mac

“Error executing action `install` on resource ‘homebrew_package[httpd]'”

Check the name of apache http package name in Mac. I guess its “httpd24” but need to verify first.
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

How to automatically recover Tomcat from crashes

rajeshkumar created the topic: How to automatically recover Tomcat from crashes

How to automatically recover Tomcat from crashes

Tomcat occasionally crashes if you do frequent hot-deploys or if you are running it on a machine with low memory. Every time tomcat crashes someone has to manually restart it, so I wrote a script which automatically detects that tomcat has crashed and restarts it.

Here’s the pseudo logic:

1. every few minutes {  
   2.   check tomcat status;  
   3.   
   4.   if (status is "not running") {  
   5.     start tomcat;  
   6.   }  
   7. }

Here’s a shell script to implement the above logic. It assumes that you are running on a unix/linux system and have /etc/init.d/tomcat* script setup to manage tomcat.

Adjust the path to “/etc/init.d/tomcat” in the script below to reflect the correct path on your computer. Sometimes it is called /etc/init.d/tomcat5 or /etc/init.d/tomcat6 depending on your tomcat version. Also make sure that the message “Tomcat Servlet Container is not running.” matches with the message that you get when you run the script when tomcat is stopped.

# #! /bin/sh  
# SERVICE=/etc/init.d/tomcat  
# STOPPED_MESSAGE="Tomcat Servlet Container is not running."  
#   
# if [ "`$SERVICE status`" == "$STOPPED_MESSAGE"];  
# then  
# {  
#   $SERVICE start  
# }  
# fi

To run the script every 10 minutes:

1. Save the above script to “/root/bin/recover-tomcat.sh”.

2. Add execute permission:

1. chmod +x /root/bin/recover-tomcat.sh

chmod +x /root/bin/recover-tomcat.sh

3. Add this to root’s crontab, type the following as root:

1. crontab -e

crontab -e

4. Add the following lines to the crontab:

1. # monitor tomcat every 10 minutes
2. */10 * * * * /root/bin/recover-tomcat.sh

What if I don’t have /etc/init.d/tomcat* script on my computer?

Tomcat creates a pid file, typically in the TOMCAT_HOME/bin directory. This file contains the process id of the tomcat process running on the machine. The pseudo logic in that case would be:

1. if (the PID file does not exist) {  
   2.   // conclude that tomcat is not running  
   3.   start tomcat  
   4. }  
   5. else {  
   6.   read the process id from the PID file  
   7.   if (no process that id is running) {  
   8.     // conclude that tomcat has crashed  
   9.     start tomcat  
  10.   }  
  11. }

You can implement the above logic as follows. The following is experimental and is merely a suggested way, test it on your computer before using it.

   1. # adjust this to reflect tomcat home on your computer  
   2. TOMCAT_HOME=/opt/tomcat5  
   3.   
   4. if [ -f $TOMCAT_HOME/bin/tomcat.pid ]  
   5. then  
   6.   echo "PID file exists"  
   7.   pid="`cat $TOMCAT_HOME/bin/tomcat.pid`"  
   8.   if [ "X`ps -p $pid | awk '{print $1}' | tail -1`" = "X"]  
   9.   then  
  10.     echo "Tomcat is running"  
  11.   else  
  12.     echo "Tomcat had crashed"  
  13.     $TOMCAT_HOME/bin/startup.sh  
  14.   fi  
  15. else  
  16.   echo "PID file does not exist. Restarting..."  
  17.   $TOMCAT_HOME/bin/startup.sh  
  18. fi

Why would tomcat crash?

The most common reason is low memory. For example, if you have allocated 1024MB of max memory to tomcat and enough memory is not available on that machine. Other reasons may involve repeated hot-deploys causing memory leaks, rare JVM bugs causing the JVM to crash.

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :

Setup SSL with Apache2

rajeshkumar created the topic: Setup SSL with Apache2

Hi,

I am trying to setting up a SSL with apache2 so application can be run on https instead of http. Any body has got any live experience with step by step instructions?

help me out?

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :