Tuesday, November 8, 2016

Docker notes

To start a service when a container starts,

use entrypoint

ENTRYPOINT service elasticsearch start && bash

Tuesday, March 15, 2016

A sample knife.rb file with exception for ssl mode

current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                'rajagopalan'
client_key               '/root/chef-repo/.chef/rajagopalan.pem'
validation_client_name   'hexaware'
validation_key           '/root/chef-repo/.chef/hexaware-validator.pem'
chef_server_url          'https://api.chef.io/organizations/ORG_NAME'
cache_type               'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path            ['#{current_dir}/../cookbooks']


Vi  ~/.gemrc

Add this line to bypass ssl check
:ssl_verify_mode: 0

Add this line to knife.rb to exclude ssl check while executing knife ec2 server create

Excon.defaults[:ssl_verify_peer] = false

Sunday, February 14, 2016

Fix - ERROR: Server returned error 500 for https://127.0.0.1/users/ - Chef

If the following error is faced in chef-server, version 12, then do the following to fix the issue.


ERROR: Server returned error 500 for https://127.0.0.1/users

open the file /opt/opscode/embedded/cookbooks/private-chef/templates/default/oc_erchef.config.erb in vi editor and go to line 220.

Replace the following line :

{s3_url, "<%= node['private_chef']['nginx']['x_forwarded_proto'] %>://<%= @helper.vip_for_uri('bookshelf') %>"},

with

{s3_url, "https://private-chef.opscode.piab:4000"},

and then run chef-server-ctl reconfigure.

Reason and Solution:

nginx will listen on port 4000 for HTTPS connections and not the default port of 443.

During cookbook uploads, the opscode-erchef service talks to bookshelf via the s3_url in its configuration file (/var/opt/opscode/opscode-erchef/etc/app.config). This configuration file is rendered via a template(opscode-omnibus/files/private-chef-cookbooks/private-chef/templates/default/oc_erchef.config.erb), a portion of which looks like:

{s3_url, "<%= node['private_chef']['nginx']['x_forwarded_proto'] %>://<%= @helper.vip_for_uri('bookshelf') %>"},
Thus, the rendered configuration file will have an s3_url like:

{s3_url, "https://private-chef.opscode.piab"},
Given this configuration, erchef will attempt to contact erchef on port 443, the default HTTPS port. Unfortunately, nothing is listening on 443, the request to bookshelf fails and erchef returns a 500 to the user.

An astute user may attempt to set bookshelf['vip'] in private-chef.rb to something like:

bookshelf['vip'] = 'private-chef.opscode.piab:4000'

Reference : https://github.com/chef/chef-server/issues/50

Wednesday, January 20, 2016

Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused

run mongod process with the dbpath parameter

mongod --dbpath /home/mongo/data/db

create the path if it does not exits.

Sunday, January 17, 2016

Jenkins scp plugin - can't connect to server issue, Jenkins scp repositories - can't connect to server, SEVERE: Algorithm negotiation fail

The issue can be resolve, by opening the /etc/ssh/sshd_config file and add the following line:

KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1

save and then restart ssh server: service ssh restart.

The problem is fixed.