public
Description: Free Geek database software
Homepage: http://dev.freegeek.org/projects/fgdb.rb
Clone URL: git://github.com/markstos/fgdb.rb.git
commit  8eed86ea36da6b16bd32ecbd5e644c47ea31085c
tree    b970480d21e61195c17919246797d64fc209d558
parent  5c5c1eb4c4650984af98db6c0c44bbfc4b33015f
fgdb.rb / doc / README_FOR_APP
100644 169 lines (124 sloc) 5.479 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
= _F_ree_G_eek _D_ata_B_ase in _R_u_B_y
 
== Introduction
 
This webapp is meant to keep track of two main areas:
* volunteers and the time they work
* gizmos and their flow through our organization
 
In the near future we hope to add:
* classes and who has completed them
* projects (such as building and testing a computer) and who has worked on them
 
== Dependencies
 
* git-core
* libjs-prototype
* rails (2.1)
* postgresql
* libpgsql-ruby
* irb
* libxml-ruby
* xmlstarlet
* thin
* ruby1.8-dev
* rubygems
* build-essential
* libgnuplot-ruby
 
== Installing dependencies on Ubuntu Hardy
 
The following process works to install the dependencies on Ubuntu Hardy:
 
    sudo apt-get install rubygems git-core postgresql irb libxml-ruby xmlstarlet build-essential libgnuplot-ruby
 
    # It's also necessary install a package from Intrepid:
    wget http://mirrors.kernel.org/ubuntu/pool/universe/libp/libpgsql-ruby/libpgsql-ruby1.8_0.7.9.2008.03.18-1_i386.deb
    sudo dpkg -i libpgsql-ruby1.8_0.7.9.2008.03.18-1_i386.deb
 
    sudo gem install thin
    ( Select thin 1.0.0 and eventmachine 0.12.6 )
    sudo gem install -v=2.1.0 rails
    sudo thin install
    sudo /usr/sbin/update-rc.d -f thin defaults
 
== Installing dependencies on Debian Lenny.
 
 Add my repo (required to install thin) to your sources.list:
 $> (wget http://packages.ryan52.info/keyring.gpg && sudo apt-key add keyring.gpg); rm -f keyring.gpg
 $> echo "deb http://repos.ryan52.info/thin/ sid main" >> /etc/apt/sources.list.d/ryan52.list
 
 $> apt-get update
 $> apt-get install git-core ruby postgresql libpgsql-ruby irb libxml-ruby xmlstarlet thin libgnuplot-ruby
 $> apt-get install rails #version 2.1
 $> ln -s /usr/share/rails vendor/rails
 
== Downloading fgdb.rb
 
 $> git clone git://git.ryan52.info/git/fgdb.rb
 $> cd fgdb.rb
 
== Reality Check
 
check if things are installed, and find out what you need to install:
 
 $> ./script/do_i_have_everything_installed_right
 
== Database Setup
 
you need to create and configure the databases:
 
 $> sudo su - postgres -c psql
 # now you are in a psql prompt:
 =# create user fgdb;
 =# create database fgdb_production with owner fgdb;
 =# create database fgdb_test with owner fgdb;
 =# create database fgdb_development with owner fgdb;
 =# \q
 
 # edit config/database.yml-example to your database settings
 $> cp config/database.yml-sample config/database.yml
 
 At this point you need to make sure the current Linux has access to databases
 you just set up. Considerations for database security are beyond the scope of this document,
 but here's how you could set up PostgreSQL to trust any connections made over a local connection
 using the fgdb or postgres PostgreSQL user and connecting to one of these database.
 Open your "pg_hba.conf" as root and add these lines as the first uncommented lines.
 
  local fgdb_test postgres trust
  local fgdb_development postgres trust
  local fgdb_production postgres trust
  local fgdb_test fgdb trust
  local fgdb_development fgdb trust
  local fgdb_production fgdb trust
 
Then reload the database:
 
 sudo /etc/init.d/postgresql-8.3 reload
 
 $> export RAILS_ENV=production
 $> export PGUSER=fgdb
 $> rake db:schema:load
 
choose one of the following: skeletal metadata (for production databases), or full test data (for development databases):
 
 $> PGUSER=postgres rake db:metadata:load
 $> ./script/make_admin # create the admin user (should only be used to create a contact for yourself, and turn yourself into an admin)
   :OR:
 $> wget http://dev.freegeek.org/~ryan52/devel_data.sql.gz -O db/devel_data.sql.gz && ./script/load_devel_data # the admin user's password is 'secret'
 
migrate the database:
 
 $> rake db:migrate
 
run some tests to see if things look okay:
 
 $> rake db:test:purge
 $> rake
 
if you see any failures or errors,
something is wrong that you should fix or tell us about.
then start the server and browse in to see things working:
 
 # Enter your RAILS_ENV here
 $> thin -e production &
 $> x-www-browser http://localhost:3000
 
for a production server running nginx and thin,
continue with the following:
 
 $> apt-get install nginx
 $> ln -fs $(readlink -f doc/examples/web/fgdb.conf) /etc/nginx/sites-enabled/fgdb.conf
 $> ln -fs $(readlink -f doc/examples/web/fgdb.yml) /etc/thin/
 $> rm /etc/nginx/sites-enabled/default
 $> chown -R www-data:www-data tmp log public
 $> invoke-rc.d nginx restart
 $> invoke-rc.d thin restart
   ::: modify configs to taste :::
   ::: edit config/environment.rb to say "ENV['RAILS_ENV'] ||= 'production'" :::
 
== Customizing defaults for new Free Geek locations
 
The database table 'defaults' holds details which identify a Free Geek location.
These details are initially automatically loaded from the file: db/metadata/defaults.sql
 
== Upgrading to newest sprint
 
To upgrade to the newest sprint release:
 $> mv current/public/_release.html current/public/release.html
 $> invoke-rc.d thin stop
 $> mr -c config update
 $> cd current
 $> RAILS_ENV=production rake db:migrate
 $> invoke-rc.d thin start
 $> mv public/release.html public/_release.html
 
== THANKS
 
in chronological order of commits:
 
* Martin Chase <mchase@freegeek.org>
* Jeff Schwaber
* Gordon Pederson
* Richard Seymour <rfs@freegeek.org>
* Tim Bauman
* Eric Davis
* Lantz Moore
* Mark Stosberg
* Ryan Niebur <RyanRyan52@gmail.com>