Saturday, September 30, 2017

Nginx + Passenger + Ruby: Getting it to Work the First Time

Getting Ruby App Working for the First Time

Getting Nginx to run your Ruby app for the first time may be easy, but it likely will run into some difficulties. A very common problem from what I can see on the web is that some gem won't install. After quite a bit of digging and a little guessing I finally got it work. And in particular, I solved the common "bundle install" error. Since I could not find any reference to my particular solution on the web, I'm sharing it here.


Nginx is install as is Fusion using the "setup and deploy" reference below. Worked well.

Run in Development Mode

Passenger was failing, but it was not telling me much because it was running in production mode. I wanted more detail right in the browser. I could have found a lot of detail either in /tmp (there were passenger logs there) and /var/log/nginx. But instead I set "rails_env" to "development" in /etc/nginx/sites-enabled/default and then I saw lots of details in the browser.

Error #1

I configured Nginx to run my app, and the first issue I ran into was found in /etc/nginx/passenger.conf: the "passenger_ruby" setting was set to some ruby that didn't exist. So, I set that value to the output of the "which ruby" command which happens for me to be /usr/local/bin/ruby.

Error #2

In one of the passenger log files in /tmp, I saw reference to a failure to run "make" This, it turns out, was not a fatal error, but I fixed it anyway by:

mkdir -p /home/<my user>/.passenger/native_support/5.1.8/ruby-1.9.3-x86_64-linux
cd /home/<my user>/.passenger/native_support/5.1.8/ruby-1.9.3-x86_64-linux
/usr/local/bin/ruby /usr/share/passenger/ruby_extension_source/extconf.rb

And then running "make" which produced the following files:


Error #3 and Final Solution

Now I was getting a bit further and hitting the seemingly typical "It looks like Bundler could not find a gem." error. I reviewed:
but so far no joy. I looked closer at the error:

"git:// (at master@b5e7da2) is not yet checked out. Run `bundle install` first. (Bundler::GitError)"

I had run "bundle install" and "bundle update" many names for my application, and I looked in the "Gemfile" ans saw the following line:

gem 'activerecord-session_store', github: 'rails/activerecord-session_store'

Well, "bundle install" and even "bundle update" ran for me at a command line with no issue, but my application was still reporting the same bundle error. 

I happened to see something in "bundle help" and guessed it might help, so I ran:

bundle package --all

And that was the solution! App would finally come up.

What "bundle package --all" does

"bundle package" bundless all the .gem files needed to run the application in th the "vendor/cache" directory. Since my error involved "git" I included "--all" which also packages git and path directories. That didn't seem to be necessary, but I did it just in case.

For more information, run the "bundle help" or "bundle package --help" command.

Most helpful References

Most helpful trouble shooting reference:

Most specifically to my issue:

Sunday, April 16, 2017

Elementary OS: Free Installation

Don't be Intimidated

Elementary OS ( has received a reasonable amount of press. It's a Linux distro with a pretty face and has been getting positive reviews. BUT: it wants to know how much $$ you're going to pay before you proceed to download it. What? A Linux distro that costs $$? Well, that's the way it appears. And, if you download it and love it, you should consider contributing with a donation. But what if you just want to check it out first? Click on download and up pops a dialog to collect some money. Is there a free alternative? Yep:

BEFORE you click on download, click into the "Custom Amount" field and type 0.00 and then click on the Download button. The next dialog will let you click another Download button to get the download started. Once downloaded, if you run the .ISO file line any other distribution, you can "try" it (live CD) or "install" it. One way to both install and try it out of course it to create a new Virtual Machine using something like Oracle Virtual Box. You can install Elementary OS as well as Oracle Virtual Box without spending a dime.

For a nice introduction to this distro, see: Note that it's built on Ubuntu LTS.

Wednesday, April 27, 2016

Getting Started with Virtual Machines and Linux

If you're looking for some simple instructions for getting a Linux Virtual Machine up and running, here are some I created for a friend of mine:

Getting Started with Virtual Machines

Monday, April 4, 2016

Defecting to Linux Mint

Back in 1998 I was at a Perl conference in San Jose, California. The SUSE folks were there and handed me a copy of OpenSUSE. I installed it, loved it, and have used it ever since -- until now. Over the past couple of years, I've kept my eye on Linux Mint. I liked what I saw. Recently I was in the mood to upgrade my trusty Linux VM running in Oracle VirtualBox. I finally settled on Linux Mint and had everything up and running fairly quickly: CrashPlan, MySQL, Ruby on Rails, Guake Terminal.

I ran this for a couple of weeks and decided to give the latest OpenSUSE a try: Leap 42.1. Well, as usual, it was much more laborious. For instance, I had to refresh my memory on how to get CrashPlan to start automatically. I worked long and hard to get all the various Ruby on Rails libraries compiled. And MySQL? Well, MariaDB is pretty good, but MySQL Workbench, while it works, just doesn't work as well and constantly nags about certain features not being available.

But, after working all day, I had most everything I needed. Except one thing: Linux Mint just looked better. The fonts were more appealing, and in general, everything was crisper and better looking. So, I thought: must be the Cinnamon desktop. I did really like it. So, I installed Cinnamon in OpenSUSE and gave it a try instead of KDE Plasma. Nope. Still did not look as nice.

So, I went back to my Linux Mint instance, despite it still complaining about running in "rendering mode" (OpenSUSE when running in Cinnamon has the same issue on my laptop under VirtualBox). Guess I'm here to stay for a while. Nice distro. Still favor OpenSUSE in some ways. It's a bit more industrial quality, but Linux Mint is far more appealing -- and it was far easier and faster to get all my favorite stuff up and running.

Friday, October 30, 2015

From Android to iPhone: a Few Notes

After six years of Android phones (HTC was by far the best!), I'm now using an iPhone. But I'm still Google-centric. Here are a few notes:

  • The Google Calendar app for the iPhone is awesome. Love the scheduler view.
  • Google Maps works fine.
  • "Google" itself is ok. Seems to have trouble finding things at times. Fortunately, Siri is getting better.
  • Google Contacts: finally tamed this as follows:
    • Log into iCould on a PC
    • Click on one contact
    • Use ctrl-A to select all
    • Hit the delete key
    • Wait! (Takes a while)
    • When prompted to delete, delete all the contacts
    • Use ContactSync to manually sync from Gmail to iCloud
    • From that point on you can use a two-way sync if you like
My transition to the iPhone was made easy by several years of using an iPad. Android is getting so very good, that it's a toss up which OS you prefer. The key with Android is to get a phone you're happy with. 

For me the iPhone is the Cadillac of phones. Android is the Chevrolet. Both are nice, iPhone is a bit more luxurious -- and most of the time that's good, sometimes not so.

Sunday, March 22, 2015

Software Licensing

"I'm not inclined to make grand pronouncements about the future of software, but if anything kills off commercial software, let me tell you, it won't be open source software. They needn't bother. Commercial software will gleefully strangle itself to death on its own licensing terms." Jeff Atwood

Recently we went through an exercise at work in which we tracked down every use of the Oracle database for licensing audit purposes. In particular when I found out that a web app must now be tied directly to an end user I was incredulous. Why? On the back end we had a licensed "service account" accessing Oracle. We were in a sense simply providing a report view to whomever came along to use the application. Seemed reasonable to me, but I was very naive.

So I second guessed IT management as I so very often do and looked into the issue myself. Unfortunately I found out that management has a right to be concerned. Even our company with its in-house lawyers was right to bring in high paid consultants to navigate Oracle's licensing. Suddenly all the Microsoft SQL Server fans were gloating. Gloating that is until they found out that Microsoft was moving in the same direction as Oracle and our existing licensing would expire at the end of the year.

So, I agree with Mr. Atwood: licensing could kill commercial software. It made me glad that my prejudice for personal projects has always been in the direction of free and open software development tools.

Friday, March 20, 2015

iPad: A Bit Less Impressed these Days

When I got my iPad4 a few years ago I was amazed at the battery life and rapid boot -- though most of the time it was just waking up from sleep. I hardly ever shut it off.

These days I've seen what an Ultrabook with lots of RAM, a decent CPU, and a solid state drive can do running Windows 7. Now I understand my iPad better. It's always had a solid state drive and a reasonable about of RAM.

For too many years I compared Apples and Oranges. Now that Ultrabooks have similar hardware to iPads in the form of solid state drives they are very comparable, much more useful, and if you put them to sleep as frequently as my iPad sleeps, their battery life is just as amazing as that of the iPad's.