Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Peter Lyons' notes on installing fgdb (Free Geek Database) from the trunk:
Note that after running into some problems with that, we tried using the one at github which is close to version 1.0.30 of the main project, and that has been working better.
But for the record, here is the procedure we tried for the trunk version (about version 1.0.50):
-Installed Ubuntu Server 10.04 amd64 (Lucid)
-selected OpenSSH server and PostgreSQL server
-user is bococo/bococo
-after boot did the following as root
apt-get update && apt-get upgrade
-to get the latest bits
apt-get install git-core ruby libpgsql-ruby libxml-ruby xmlstarlet thin irb
build-essential rubygems unzip libnokogiri-ruby timeout libgnuplot-ruby
libbarby-ruby socat librmagick-ruby libjson-ruby lynx
sudo dpkg -i libbytes-ruby1.8_0.2.38_all.deb
cd /opt
sudo unzip -q /home/bococo/
cd /home/bococo/fgdb.rb
ln -s /opt/rails/vendor/rails vendor/rails
gem install rails #This installed rails 2.3.8
export PATH=$PATH:/var/lib/gems/1.8/bin
-then I did the following as user "bococo"
cd $HOME
git clone git://
cd fgdb.rb
ln -s /var/lib/gems/1.8/gems/rails-2.3.8 vendor/rails
sudo su -
su - postgres -c 'createuser -P fgdb'
#Put in fgdb as password
#Capable of creating databases but nothing else
setup /home/bococo/fgdb.rb/config/database.yml by copying
database.yml.example and editing with fgdb password
The librmagic-ruby bug is here:
See Comment #17
All did to fix this locally was rebuild against the newer imagemagick
packages in lucid, no need to apply any patches
$ cd /usr/src
$ sudo apt-get build-dep librmagick-ruby
$ sudo apt-get source librmagick-ruby
$ cd librmagick-ruby-2.11.1
$ sudo dch -i
(add changelog entry)
$ sudo dpkg-buildpackage
$ cd ..
$ sudo dpkg -i librmagick-ruby*.deb
That installed a BUNCH of packages I'd rather not have. Once bug 518122 is
fixed or if someone publishes a fixed amd64 deb, this workaround won't be
-OK, now back as bococo in /home/bococo/fgdb.rb
sudo su - postgres
createdb fgdb_production
createdb fgdb_test
createdb fgdb_development
postgres=# alter database fgdb_production owner to fgdb;
postgres=# alter database fgdb_test owner to fgdb;
postgres=# alter database fgdb_development owner to fgdb;
-back as bococo
cd /home/bococo/fgdb.rb
rake db:schema:load
-Woo Hoo, that worked.
rake db:migrate
-OK, that errored out since the "jobs" table had an existing row
-deleted that row like this:
sudo su - postgres
psql fgdb_production
Sat Jul 10 01:56:33 MDT 2010
-OK, getting some of this figured out.
-clear and recreate all the databases as user postgres
for DB in production development test;do dropdb "fgdb_${DB}";createdb
Then as user bococo
cd /home/bococo/fgdb.rb
rake db:schema:load #This works fine
OK, here's the first bug. scripts/make_admin doesn't work
This is because it assumes the ADMIN role is there, but it isn't
-Here's how to manually add the admin role, then make_admin will work.
-We could just fix the make_admin script
rb(main):001:0> require 'config/environment.rb'
=> true
irb(main):002:0> Role.find_by_name("ADMIN")
=> nil
irb(main):003:0> r =
=> #<Role id: nil, name: nil, created_at: nil, updated_at: nil>
=> 1
=> "ADMIN"
irb(main):006:0> r.save_without_validation!
=> true
Now the rake db:migrate is failing in this one because PayPeriod class
doesn't have an end_date
mv db/migrate/20100213202627_make_a_lot_of_pay_periods.rb
bococo@bococo-fgdb1:~/fgdb.rb$ irb
irb(main):001:0> require 'config/environment.rb'
=> true
irb(main):002:0> require 'db/migrate/20091017192151_create_worked_shifts.rb'
=> ["CreateWorkedShifts"]
irb(main):010:0> CreateWorkedShifts.up
== CreateWorkedShifts: migrating
-- create_table(:worked_shifts)
NOTICE: CREATE TABLE will create implicit sequence "worked_shifts_id_seq"
for serial column ""
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"worked_shifts_pkey" for table "worked_shifts"
-> 0.0474s
== CreateWorkedShifts: migrated (0.0476s)
=> nil
-OK, now this one is failing because table "system" doesn't have a column
ess db/migrate/20100622184857_clean_up_covered.rb
class CleanUpCovered < ActiveRecord::Migration
def self.up
DB.exec("UPDATE systems
SET covered = 'f'
WHERE contract_id = 2;")
DB.exec("UPDATE gizmo_events
SET covered = 'f'
FROM systems
WHERE = gizmo_events.system_id
AND system_id IS NOT NULL
AND systems.contract_id = 2
AND gizmo_events.covered = 't';")
DB.exec("UPDATE gizmo_events
SET covered = 'f'
FROM donations
WHERE donation_id IS NOT NULL
AND = gizmo_events.donation_id
AND donations.contract_id != 1;")
def self.down
OK, now I think I have the DB schema fully loaded and migrated
thin -e production start
That starts the app. Some pages are throwing 500 .errors. See
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.