Skip to content

Instantly share code, notes, and snippets.

@clarkdave
Created July 17, 2013 14:55
Show Gist options
  • Select an option

  • Save clarkdave/6021315 to your computer and use it in GitHub Desktop.

Select an option

Save clarkdave/6021315 to your computer and use it in GitHub Desktop.
(CHEF) Install PostgreSQL json_enhancements & hstore
package 'postgresql-server-dev-9.2'
package 'postgresql-contrib-9.2'
# without hstore this won't build without fiddling, so it's easiest just to install hstore too
bash 'build_json_enhancements' do
code <<-CODE
cd /var/cache/chef
wget https://bitbucket.org/qooleot/json_enhancements/get/master.tar.gz
tar -xvzf master.tar.gz
cd qooleot-json_enhancements*
make
make install
CODE
not_if { ::FileTest.exist?("/usr/share/postgresql/9.2/extension/json_enhancements.control") }
notifies :run, 'bash[install_json_enhancements]', :immediately
end
bash 'install_json_enhancements' do
user 'postgres'
code <<-CODE
psql template1 -c "CREATE EXTENSION hstore;"
psql template1 -c "CREATE EXTENSION json_enhancements;"
CODE
action :nothing
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment