What to set passenger_root and passenger_ruby paths when using RVM or rbenv

If you’re using Rails, Nginx, Passenger and RVM or rbenv and wondering what to set the passenger_root and passenger_ruby paths to in nginx.conf, here’s how to get them. Keep in mind, you’ll have to do this by reconfiguring Nginx if you switch from RVM to rbenv or vice-versa. First you must install the passenger gem […]

How to build a tar from a list of files from STDIN

For example, if you want to take the last 7 most recent .txt files and build a tar out of it, do the following:

How to replace the init.d chef-client service with a cron

To disable chef-client from init.d (be sure you really want to do this!) Then add something like this to your crontab:

rsync copy while displaying progress

To copy a file where source and destination are on the same host: To copy a file where source is on a server and destination is on your local host:

Having issues installing gem ‘pg’ (postgresql)?

If you run into the “Can’t find the ‘libpq-fe.h header” error, see below if you want to know how I solved the problem: I was able to solve the problem by executing the following before doing a ‘bundle install’:

Installing specific version of chef-client in case you want to downgrade

In case you want to downgrade the version of chef-client on your machine using the omnibus installer, read below. I found that version 11.4.0 had a memory leak. We had 8 GB ram and it was taking 18% of the total available memory! That’s almost 1.5 GB ram wasted! Before deciding to set up a […]

How to add the request parameters along with in lograge outputted files

Here is how to include the request parameters n lograge formatted log files. Lograge is a RubyGem that modifies the rails log format for you so it’s easier to parse by parsers like Logstash, for example. Here is what needs to be added to each file: Gemfile: config/environments/production.rb app/controllers/application_controller.rb

How to Create Self-Signed Client and Web Server Certificates using openssl

Use CSRs and Keys you got developers for each client, if there are more than one. Get it from them if you don’t have them or create the client key(s). They should do something like this and send you the csr and key: openssl genrsa -out client1.key 1024 # /C=US/ST=California/L=San Francisco/O=Your_Company_Name/OU=IT/CN=client1 Create the Certificate Signing […]

Setting up Cron jobs that call Ruby (RVM) or Shell Scripts via Bash

If you are on a unix system and want to set up a crontab (cron job) and you are using RVM, you must make sure to make bash act as if it had been invoked as a login shell by using the bash -l option. So if you were going to have a script run […]

How to modify the maximum Java Heap Size in TorqueBox gem

In order to modify the maximum Java Heap Size (or any other JAVA_OPTS) when using the TorqueBox gem, start torquebox by doing a: Look for the default JAVA_OPTS settings and set your JAVA_OPTS path. Be sure you aren’t overriding your current settings first. In my case, for TorqueBox 2.3.0, I wanted to modify the maximum […]