Parent page: Raleigh Adopta App

Project communication and details


2012 Race for Reuse metrics and marketing to-do's


  • Drive awareness of the program; reduced staff time of 3-5 minutes per phone call explainging program
  • Host an awareness event on our around December 1, 2012
  • 20 new adoptions by December 6, 2012
  • Create a TriangleWiki page for each adopted bus shelter by December 6, 2012


  • Raleigh public affairs (by end of week -- Jason)
  • Raleigh Public Record (Jason)
  • News & Observer (Jason)
  • Send email to RCAC list; suggest to have CACs  (Jason)
  • Presentation to City Council?
  • Mayor challenge/declaration?
  • Draft press release (Jason)
    • Re-purpose to CityCamp blog
  • Note: 4-5 shelters are typically adopted per press mention

Configure/Install app notes

  • notes to be added to GitHub and forked adopta code base for Raleigh

    [[email protected] adopt-a-hydrant]$ sudo yum groupinstall 'development tools'

    [[email protected] adopt-a-hydrant]$ curl -L | bash -s stable    #installs rvm

    [[email protected] adopt-a-hydrant]$ source /home/CORALEIGH/foleyc/.rvm/scripts/rvm

    [[email protected] adopt-a-hydrant]$ rvm install 1.9.3

    [[email protected] adopt-a-hydrant]$ rvm pkg install libyaml

    [[email protected] adopt-a-hydrant]$ rvm reinstall all --force

    [[email protected] adopt-a-hydrant]$ rvm requirements

    [[email protected] adopt-a-hydrant]$ sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-

    devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel


    [[email protected] adopt-a-hydrant]$ rvm reinstall 1.9.3

    [[email protected] adopt-a-hydrant]$ gem install rails --no-rdoc --no-ri

    [[email protected] adopt-a-hydrant]$ sudo yum install postgresql-server


    #must be root

    $sudo su -

    $service postgresql initdb

    $service postgresql start

    $chkconfig postgresql on


    #To connect to your postgres server simply do this (as root):

    $su postgres

    $psql -p 5432


    #exit out back to foleyc shell

    [[email protected] adopt-a-hydrant]$ sudo yum install -y libxml2 libxml2-devel libxslt libxslt-devel

    [[email protected] adopt-a-hydrant]$ sudo yum install postgresql-devel

    [[email protected] adopt-a-hydrant]$ sudo yum install sqlite-devel


    [[email protected] adopt-a-hydrant]$ git clone git://

    [[email protected] adopt-a-hydrant]$ cd adopt-a-hydrant

    [[email protected] adopt-a-hydrant]$ bundle install


    #must be root

    $sudo su -

    edit /var/lib/pgsql/data/pg_hba.conf and change all to trusted


    cd /var/lib/pgsql/data/

    $sudo nano postgresql.conf    !uncomment listen_addresses = 'localhost'

    $/etc/init.d/postgresql restart


    "simply connect to db"



    -bash-4.1$ psql adopt_a_thing_development  //then you can run your queries etc.



    //not working for me -bash-4.1$ sudo -u postgres psql postgres


  • postgres=#su postgres

  • postgres=#create role foleyc login createdb;

    postgres=#\du #lists all users

    postgres=#\list #lists all databases

    postgres=#\q #quits


    #exit out back to foleyc

    [[email protected] adopt-a-hydrant]$bundle exec rake db:create

    [[email protected] adopt-a-hydrant]$bundle exec rake db:schema:load


    #install passenger

    [[email protected] adopt-a-hydrant]$gem install rails passenger

    [[email protected] adopt-a-hydrant]$passenger-install-apache2-module #failed b/c of dependencies, install dependencies from the prompt

    [[email protected] adopt-a-hydrant]$sudo yum install curl-devel

    [[email protected] adopt-a-hydrant]$sudo yum install httpd

    [[email protected] adopt-a-hydrant]$ sudo yum install httpd-devel

    [[email protected] adopt-a-hydrant]$ sudo yum install apr-devel

    [[email protected] adopt-a-hydrant]$ sudo yum install apr-util-devel

    [[email protected] adopt-a-hydrant]$passenger-install-apache2-module


    edit /etc/httpd/conf/httpd.conf and add the following lines to the bottom of the file

    # CHF - COR - 11/03/2012 Adding Passenger config - do not remove -

    LoadModule passenger_module /home/CORALEIGH/foleyc/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18/ext/apache2/

    PassengerRoot /home/CORALEIGH/foleyc/.rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.18

    PassengerRuby /home/CORALEIGH/foleyc/.rvm/wrappers/ruby-1.9.3-p286/ruby


    # CHF - COR - 11/03/2012 Adding virtual host config - do not remove -

       <VirtualHost *:80>


          # !!! Be sure to point DocumentRoot to 'public'!

          DocumentRoot /home/CORALEIGH/foleyc/adopt-a-hydrant/public

          <Directory /home/CORALEIGH/foleyc/adopt-a-hydrant/public>

             # This relaxes Apache security settings.

             AllowOverride all

             # MultiViews must be turned off.

             Options -MultiViews




    #restart apache

    sudo /etc/init.d/httpd restart


    browse to http://rordevapp1 and the app should come up.


    todo:  seed lat/lng coordinates, change graphics, center map on Raleigh, config email server, get a decent url name

  • Also see buglist for adding city_id, lat, lng to attr in things.rb model
  • edited /home/xfinger/adopt-a-hydrant/app/mailers/thing_mailer.rb to make the from address a cor address
  • edit /home/xfinger/adopt-a-hydrant/app/views/thing_mailer/reminder.text.erb
  • configure email (smtp) in config/environments/production.rb
  • center map on Raleigh - inside main.js.erb in /assets/javascripts


--Become an admin of the site

app/assets/javascripts/main.js.erb  -  edit line 2 to LatLng(35.7719, -78.6389);  to center your map in raleigh.
config/initializers/locals/en.yml  -  edit the defaults info to change address city state ... these show up on the left hand info panel
the app uses rails_admin gem ( for administration stuff.  It's at url/admin but you have to be an admin to access it. To become an admin, open a rails console (just type 'rails console' at command line) and do User.find(:all). Find your user id (probably 1 if you are the first or only user in the db). Now type a=User.find(1). Then a.admin = true. Then You should now be an admin.
If you look at the admin panel there is a place to create reminders and send them to users but I couldn't get it to work. It requires a from user field but the drop down selector did not show up on mine so it kept throwing an error. I will look into it. That didn't work so I wasn't able to test out the email stuff. The app didn't have mailer.yml file in the config directory -  seems to me that you need it but they may have set things up differently.
If you have trouble seeding in production let me know, I had to tweak the model to get it to work.





[[email protected] sidebar]$ vim _combo_form.html.haml


Update the tos.

you can search for terms to find where to make edits using this command

$grep –iR keyword-to-search ./

postgres become super user


backup database:

(on source db)  -bash-4.1$ pg_dump adopt_a_thing_development --clean > 711prdClean

restore db (blows away existing db objects and recreates them.  db must exist.

(on destination db) -bash-4.1$ psql adopt_a_thing_development < 711prdClean