OpenFoodNetwork Deployment Back to Basic Install Script

I had made so many updates – well – not that terribly many – but it seemed prudent to just check out the basic ofn_deployment Ansible script, transfer in my vars.yml file and see what happened.

I had named the location of our Localization repository wrong so fixed that.

Now Ansible and Vagrant run through all the provisioning without complaint, but Bundle doesn’t seem to be installed on the guest server:

$ cd /home/openfoodnetwork/apps/openfoodnetwork/current
$ bundle exec rails server -b
The program 'bundle' is currently not installed.  To run 'bundle' please ask your administrator to install the package 'ruby-bundler'


$ logout
jamaaladeen:ofn_deployment mikekilmer
$ vagrant reload --provision

As a side note:

TASK [language : install language package(s)] **********************************
[DEPRECATION WARNING]: Using bare variables is deprecated. Update your 
playbooks so that the environment value uses the full variable syntax 
This feature will be removed in a future release. 
Deprecation warnings can be disabled by setting deprecation_warnings=False in 

No complaint here:

TASK [bundler : install bundler] ***********************************************
changed: [default]

TASK [bundler : reload rbenv] **************************************************
changed: [default]

What’s happening here:

--- # Bundler - here separately as it needs to load after the rbenv role.

  • name: install bundler

    This needs to be run inside a bash shell to initialise rbenv


    command: bash -lc "gem install bundler --no-ri --no-rdoc"

  • name: reload rbenv
    command: bash -lc "rbenv rehash"


$ bash -lc "gem install bundler --no-ri --no-rdoc"
Fetching: bundler-1.12.3.gem (100%)
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /var/lib/gems

Hmmm. Permissions issue.
I wonder if this is an issue with rbenv.

Let’s see what, if any gems are installed:

$ gem list

*** LOCAL GEMS ***

It looks like rbenv is installed by zzet.rbenv, which is insatalled in the host computer when we ran the ansible-galaxy install command.

Based on contents of

$ ls -la /home/ubuntu/
total 24
drwxr-xr-x 3 ubuntu ubuntu 4096 May 6 19:58 .
drwxr-xr-x 5 root root 4096 May 6 20:05 ..
-rw-r--r-- 1 ubuntu ubuntu 220 Apr 3 2012 .bash_logout
-rw-r--r-- 1 ubuntu ubuntu 3486 Apr 3 2012 .bashrc
-rw-r--r-- 1 ubuntu ubuntu 675 Apr 3 2012 .profile
drwx------ 2 ubuntu ubuntu 4096 May 6 19:58 .ssh

We’re installing a pretty old version in update_ruby.yml:

– role: zzet.rbenv # Install ruby. If missing run: ansible-galaxy install zzet.rbenv
sudo: yes
env: user
version: v0.4.0
ruby_version: “{{ ruby }}”
– { name: “{{ unicorn_user }}”, home: “{{ unicorn_home_path }}”, comment: “Main user”}
tags: ruby

Looks like current version is v1.0.0.

rbenv is installed in /home/openfoodnetwork/, as configured in ruby_update.yml:

- { name: "{{ unicorn_user }}", home: "{{ unicorn_home_path }}", comment: "Main user"}

So do I want to assume that user role to poke around? Is unicorn supposed to run the rails server?

I’m logged in as vagrant user, but I see .rbenv is installed at /home/openfoodnetwork (unicorn user).

Also noticing that in this commit message it states “Using zzet.rbenv version 2.1.6”, but on line 23 it says v0.4.0.

I can $ sudo -i -u openfoodnetwork, then gem list returns a few gems but not many:

*** LOCAL GEMS ***

bigdecimal (1.2.4)
bundler (1.12.3, 1.12.2)
io-console (0.4.2)
json (1.8.1)
minitest (4.7.5)
psych (2.0.5)
rake (10.1.0)
rdoc (4.1.0)
test-unit (

I could try running bundle install from here, but would like to see if can make the deployment script do it.

I’m also not quite understanding why provision.yml and ruby_update.yml have duplicate zzet.rbenv roles. It makes sense in a way if we’re using rbenv to install Ruby, but seems wet and error-prone. I need to revisit some Ansible docs.


Is the server meant to be run directly from the CLI by unicorn user:

$ bundle exec rails server -b
=> Booting Unicorn
=> Rails 3.2.21 application starting in development on
=> Call with -d to detach
=> Ctrl-C to shutdown server
(eval):1: warning: encountered \r in middle of line, treated as a mere space
listening on addr= fd=14
worker=0 spawning...
master process ready
worker=0 spawned pid=8147
worker=0 ready

Or do we want to run it in the CLI via unicorn like:

$ bundle exec unicorn -E development -c config/unicorn.rb?

Or are we running rails via unicorn via monit:

sudo service monit start

Came back after a day or two away, vagrant up, started server with monit and we’re up and running. The same issue I was having six months ago is back, where there are certain links that are pointing towards and not Not sure what the deal with that is.

Apparently the ofn-install script isn’t configured to deploy and provision OFN on a vagrant box so I made a vagrantbox script.