| 1 | = _F_ree_G_eek _D_ata_B_ase in _R_u_B_y |
|---|
| 2 | |
|---|
| 3 | == How stuff works |
|---|
| 4 | |
|---|
| 5 | this webapp is meant to keep track of two main areas: |
|---|
| 6 | * volunteers and the time they work |
|---|
| 7 | * gizmos and their flow through our organization |
|---|
| 8 | |
|---|
| 9 | in the near future i hope to add: |
|---|
| 10 | * classes and who has completed them |
|---|
| 11 | * projects (such as building and testing a computer) and who has worked on them |
|---|
| 12 | |
|---|
| 13 | == Install |
|---|
| 14 | |
|---|
| 15 | we made this on debian lenny systems. alteration may be needed on other distros. |
|---|
| 16 | |
|---|
| 17 | To get the mr setup: |
|---|
| 18 | |
|---|
| 19 | $> apt-get install subversion mr # or, wget http://git.kitenet.net/?p=mr.git;a=blob_plain;f=mr -O /usr/local/bin/mr |
|---|
| 20 | $> svn co http://dev.freegeek.org/svn/fgdb.rb/trunk/mr/ fgdb.rb |
|---|
| 21 | $> cd fgdb.rb |
|---|
| 22 | |
|---|
| 23 | If you are going to be doing development, you should use the latest (untested, unreleased, and possibly unusable) trunk: |
|---|
| 24 | $> touch devel |
|---|
| 25 | |
|---|
| 26 | Checkout the sources (you first need to setup mr, see above): |
|---|
| 27 | $> mr -c config update |
|---|
| 28 | |
|---|
| 29 | to setup a working environment on debian and ubuntu (skip this part on other distros): |
|---|
| 30 | |
|---|
| 31 | Add my repo (required to install thin) to your sources.list: |
|---|
| 32 | $> (wget http://packages.ryan52.info/keyring.gpg && apt-key add keyring.gpg); rm -f keyring.gpg |
|---|
| 33 | $> echo "deb http://repos.ryan52.info/thin/ sid main" >> /etc/apt/sources.list.d/ryan52.list |
|---|
| 34 | |
|---|
| 35 | Install stuff: |
|---|
| 36 | $> apt-get update |
|---|
| 37 | $> apt-get install ruby postgresql-8.1 libpgsql-ruby irb libxml-ruby xmlstarlet thin |
|---|
| 38 | $> apt-get install rails #version 2.1 |
|---|
| 39 | $> ln -s /usr/share/rails vendor/rails |
|---|
| 40 | |
|---|
| 41 | check if things are installed, and find out what you need to install: |
|---|
| 42 | |
|---|
| 43 | $> ./script/do_i_have_everything_installed_right |
|---|
| 44 | |
|---|
| 45 | you need to create and configure the databases: |
|---|
| 46 | |
|---|
| 47 | $> su - postgres -c 'createuser -P SOMEDBUSER' |
|---|
| 48 | # capable of creating databases, but nothing else |
|---|
| 49 | $> createdb -h localhost -U SOMEDBUSER fgdb_production |
|---|
| 50 | $> createdb -h localhost -U SOMEDBUSER fgdb_test |
|---|
| 51 | $> createdb -h localhost -U SOMEDBUSER fgdb_development |
|---|
| 52 | $> cd fgdb.rb/current |
|---|
| 53 | ::: edit config/database.yml-example to match and rename |
|---|
| 54 | ::: it (drop '-example') |
|---|
| 55 | $> export RAILS_ENV=production |
|---|
| 56 | $> rake db:schema:load |
|---|
| 57 | |
|---|
| 58 | choose one of the following: skeletal metadata (for production databases), or full test data (for development databases): |
|---|
| 59 | |
|---|
| 60 | $> rake db:metadata:load |
|---|
| 61 | $> ./script/make_admin # create the admin user (should only be used to create a contact for yourself, and turn yourself into an admin) |
|---|
| 62 | :OR: |
|---|
| 63 | $> wget http://dev.freegeek.org/~ryan52/devel_data.sql.gz -O db/devel_data.sql.gz && rake db:data:load # the admin user's password is 'secret' |
|---|
| 64 | |
|---|
| 65 | migrate the database: |
|---|
| 66 | |
|---|
| 67 | $> rake db:migrate |
|---|
| 68 | |
|---|
| 69 | run some tests to see if things look okay: |
|---|
| 70 | |
|---|
| 71 | $> rake db:test:purge |
|---|
| 72 | $> rake |
|---|
| 73 | |
|---|
| 74 | if you see any failures or errors, |
|---|
| 75 | something is wrong that you should fix or tell us about. |
|---|
| 76 | then start the server and browse in to see things working: |
|---|
| 77 | |
|---|
| 78 | $> thin & |
|---|
| 79 | $> iceweasel http://localhost:3000 |
|---|
| 80 | |
|---|
| 81 | for a production server running nginx and thin, |
|---|
| 82 | continue with the following: |
|---|
| 83 | |
|---|
| 84 | $> apt-get install nginx |
|---|
| 85 | $> ln -fs $(readlink -f doc/examples/web/fgdb.conf) /etc/nginx/sites-enabled/fgdb.conf |
|---|
| 86 | $> ln -fs $(readlink -f doc/examples/web/fgdb.yml) /etc/thin/ |
|---|
| 87 | $> rm /etc/nginx/sites-enabled/default |
|---|
| 88 | $> chown -R www-data:www-data tmp log public |
|---|
| 89 | $> invoke-rc.d nginx restart |
|---|
| 90 | $> invoke-rc.d thin restart |
|---|
| 91 | ::: modify configs to taste ::: |
|---|
| 92 | ::: edit config/environment.rb to say "ENV['RAILS_ENV'] ||= 'production'" ::: |
|---|
| 93 | |
|---|
| 94 | == Upgrading to newest sprint |
|---|
| 95 | |
|---|
| 96 | To upgrade to the newest sprint release: |
|---|
| 97 | $> mv current/public/_release.html current/public/release.html |
|---|
| 98 | $> invoke-rc.d thin stop |
|---|
| 99 | $> mr -c config update |
|---|
| 100 | $> cd current |
|---|
| 101 | $> RAILS_ENV=production rake db:migrate |
|---|
| 102 | $> invoke-rc.d thin start |
|---|
| 103 | $> mv public/release.html public/_release.html |
|---|
| 104 | |
|---|
| 105 | == THANKS |
|---|
| 106 | |
|---|
| 107 | in chronological order of svn commits: |
|---|
| 108 | |
|---|
| 109 | * Martin Chase <mchase@freegeek.org> |
|---|
| 110 | * Jeff Schwaber |
|---|
| 111 | * Gordon Pederson |
|---|
| 112 | * Richard Seymour <rfs@freegeek.org> |
|---|
| 113 | * Tim Bauman |
|---|
| 114 | * Eric Davis |
|---|
| 115 | * Lantz Moore |
|---|
| 116 | * Ryan Niebur <RyanRyan52@gmail.com> |
|---|