Setting up puppet board with Apache

PuppetDB appears to be the way of the future. By leveraging PuppetDB, some enterprising individuals have written a web interface that knocks the socks off of the regular puppet dashboard. It is called puppetboard

Clean and elegant – puppetboard

View of a node

Puppetboard with Apache

Normally puppet board requires Passenger. Here is how to configure puppet board to work with Apache instead.

You can install puppet board on cent with apache using the mod_wsgi plugin

Clone & install  puppetboard

git clone https://github.com/nedap/puppetboard.git /var/www/puppetboard
sudo yum install python-pip
Install mod_wsgi yum install mod_wsgi.x86_64

(You can see what was installed with the following)
rpm –query –list mod_wsgi.x86_64

Verify that /etc/httpd/confi.d/wdgi.conf exists and has the following content

LoadModule wsgi_module modules/mod_wsgi.so

Add a vhost to /etc/httpd/

$sudo vim /etc/httpd/conf/httpd.conf
<VirtualHost *>
 ServerName foo.bar
WSGIDaemonProcess puppetboard user=apache group=apache threads=5
 WSGIScriptAlias / /var/www/puppetboard/wsgi.py
<Directory /var/www/puppetboard>
 WSGIProcessGroup puppetboard
 WSGIApplicationGroup %{GLOBAL}
 Order deny,allow
 Allow from all
 </Directory>
 </VirtualHost>

 Restart Apache
 sudo apachectl -k stop
 sudo /etc/init.d/httpd start

If you are running CentOS/RHEL You get the following errors, it is because the WSGI root path is incorrect.

[Fri Jan 03 16:53:13 2014] [error] [client 10.1.5.231] (13)Permission denied: mod_wsgi (pid=2029): Unable to connect to WSGI daemon process 'puppetboard' on '/etc/httpd/logs/wsgi.2024.0.1.sock' after multiple attempts.

Solution
Add this to /etc/httpd/conf/httpd.conf *before* the vhost

WSGISocketPrefix ../../var/run/wsgi

Restart Apache and puppet board should be installed

Additional Resources

https://uwsgi.readthedocs.org/en/latest/Configuration.html
https://groups.google.com/forum/#!topic/modwsgi/UmNPV-2nQMM
https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-centos-6
https://code.google.com/p/modwsgi/wiki/ConfigurationIssues
https://code.google.com/p/modwsgi/issues/detail?id=291

Simplifying git workflows with hub

There is a fantastic application called ‘hub’ which can save a ton of time off of your git workflow.

https://github.com/github/hub

Normally to clone a git repo, you would enter the following

cd /tmp

git clone https://github.com/adaptivecomputing/torque.git -b 4.2-dev

With hub the same command could be executed with the following

cd /tmp

hub clone adaptivecomputing/torque -b 4.2-dev

Since most of the available options for hub match the commands for git, you could even create an alias from hub to replace git.

Just one tip to make your git workflow simpler

Install Gitlab with puppet

Once you have used a professional git hosting service like github, you’ll never be satisfied going back to a plane jane git server like git-web.

git-web is just so darn ugly!

wpid-googlechrome-2013-10-30-12-457.png

A necessity arose at my company for a way to create pull requests on our main software, so I started investigating how we could migrate our codebase to github.

Unfortunately, github enterprise is $5,000 per 20 users per year. If you have 100 users, thats $25,000 per year!

There are other projects such as gitorious, however their pricing is close to github’s.

Introduce gitlab. Gitlab is an enterprise level git server comparable to gitorious and github enterprise, however costs 1/10th what the competitors charge. They also have a community edition. The only limitations in the community edition being; LDAP group synchronization, and project group invites. Both things a smaller company can live without. See the full feature list here.

Gitlab is light-years ahead of git-web

wpid-1____googlechrome-2013-10-30-12-457.png

Installing Gitlab with Puppet

The biggest obstacle to adopting a server like gitlab, is the heavy install. The average time for me to install the community edition of gitlab was 6 hours. So I leveraged puppet to install gitlab automatically.

Using my puppet module, it is now possible to install gitlab in about 15 minutes.

Step by step video tutorial is located below.

Note: You may see the following errors when installing gitlab inside vagrant. This is because dependencies are not resolved when installing a module locally (opposed to from the puppet forge).

vagrant@gitlab:/vagrant$ puppet apply /vagrant/tests/init.pp --debug Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class mysql::server at /vagrant/tests/init.pp:12 on node gitlab.localdomain Wrapped exception: Could not find declared class mysql::server Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class mysql::server at /vagrant/tests/init.pp:12 on node gitlab.localdomain

Solution: Manually install dependencies

puppet module install puppetlabs-mysql

puppet module install puppetlabs-apt

puppet module install example42-postfix

puppet module install puppetlabs-ruby

The spuder-gitlab module can be found on the puppet forge

https://forge.puppetlabs.com/spuder/gitlab

And the module’s source is on github

https://github.com/spuder/puppet-gitlab

Uninstalling Puppet from Mac Os X

Recent on the StackExchange site Super User, the following question came up which seemed pretty straight forward.

How to uninstall puppet on Mac OS X ?

I naturally assumed that puppet labs would include an uninstaller with the .dmg package. It turns out, that is not the case. You must uninstall puppet manually.

Problem

I first identified where puppet was installed.

 which puppet 

/usr/bin/puppet

I assumed that there was also a puppet binary in the /usr/sbin directory which turned out to be correct

ls /usr/bin|grep puppet

puppet

Removing the puppet user was not as easy. I assumed it would be in /etc/shadow, however Mac does not use the shadow file. Nor does Mac have the userdel command.

wpid-screenshot2013-08-15at10-53-01am-2013-08-15-10-246.png

I discovered the following blog post which elaborates on the dscl command.

You will need to reboot the machine for the puppet user to be deleted.

To be thorough, I ran the following command to look for any additional puppet files

 sudo find / -iname 'puppet' -type d 

Sure enough, there are two other folders to delete

Solution

To uninstall puppet, delete the following files

/usr/bin/puppet
/usr/sbin/puppet

Remove the following directories
/private/etc/puppet
/usr/share/doc/puppet

To get rid of the puppet user that appears on the login screen
sudo dscl . delete /Users/puppet

Reboot the machine and puppet will be uninstalled.

Note that facter will still be present. Uninstalling facter is not in the scope of this post.

Macjournal, using code blocks 

Mac journal can be setup to create code blocks that look like this:

some code here

To enable this feature, you must turn off escaping of < characters.

wpid-screenshot2013-07-24at10-26-19pm-2013-07-24-22-261.png

wpid-screenshot2013-07-24at10-26-25pm-2013-07-24-22-261.png

Remove the check box from “Escape ‘’

wpid-screenshot2013-07-24at10-26-39pm-2013-07-24-22-261.png

The next time you push a blog entry to your blog, you should see the pretty pre formatted text box.

(Tested on WordPress)

Linux Swap Files

While setting up an Oracle database to troubleshoot an ODBC connector for work, I ran into a strange error:

rpm -i oracle-xe-11.2.0-1.0.x86_64.rpm

 This system does not meet the minimum requirements for swap space.  Based on
the amount of physical memory available on the system, Oracle Database 11g
Express Edition requires 2048 MB of swap space. 

diff: command not found

While attempting to diff two files on my Cent 6.4 test system, I ran into a strange error

[root@mongo-test3 tmp]# diff

-bash: diff: command not found

[root@mongo-test3 tmp]# which diff

/usr/bin/which: no diff in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin)

Attempting to install diff via yum did not solve the problem

[root@mongo-test3 tmp]# yum install diff

Loaded plugins: fastest mirror, security, version lock

Loading mirror speeds from cached hostile

* epel: mirrors.kernel.org

Setting up Install Process

No package diff available.

Error: Nothing to do

I tried using an alternative to diff, such as zdiff, or vimdiff. However both of those have dependencies on diff, and thus would not run.

Solution

yum install diffutils

Resources

http://codenice.com/diff-command-not-found/