Created
July 20, 2010 22:53
-
-
Save nealmcb/483721 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Peter Lyons' notes on installing fgdb (Free Geek Database) from the trunk: | |
git://git.freegeek.org:/git/fgdb.rb | |
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. | |
http://wiki.github.com/markstos/fgdb.rb/ | |
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 | |
wget | |
http://apt.freegeek.org/debian/pool/main/f/fgdiag/libbytes-ruby1.8_0.2.38_all.deb | |
sudo dpkg -i libbytes-ruby1.8_0.2.38_all.deb | |
wget http://rubyforge.org/frs/download.php/37770/rails-2.1.0.zip | |
cd /opt | |
sudo unzip -q /home/bococo/rails-2.1.0.zip | |
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://git.freegeek.org:/git/fgdb.rb | |
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: | |
https://bugs.launchpad.net/ubuntu/+source/librmagick-ruby/+bug/518122 | |
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 | |
necessary | |
-OK, now back as bococo in /home/bococo/fgdb.rb | |
sudo su - postgres | |
createdb fgdb_production | |
createdb fgdb_test | |
createdb fgdb_development | |
psql | |
postgres=# alter database fgdb_production owner to fgdb; | |
postgres=# alter database fgdb_test owner to fgdb; | |
postgres=# alter database fgdb_development owner to fgdb; | |
postgres=#\q | |
-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 | |
DELETE FROM jobs; | |
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 | |
"fgdb_${DB}";done | |
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.new | |
=> #<Role id: nil, name: nil, created_at: nil, updated_at: nil> | |
irb(main):004:0> r.id=1 | |
=> 1 | |
irb(main):005:0> r.name="ADMIN" | |
=> "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 | |
db/migrate/20100213202627_make_a_lot_of_pay_periods.rb.OFF | |
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 "worked_shifts.id" | |
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 | |
"covered" | |
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 systems.id = 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 donations.id = gizmo_events.donation_id | |
AND donations.contract_id != 1;") | |
end | |
def self.down | |
end | |
end | |
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 | |
log/production.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment