open-austin / pet-finder

An application to quickly and easily help owners find lost pets.
7 stars 5 forks source link

Pet Alerts

Part of ATX Hack for Change 2014

Problem: Currently, real-time online information on lost / found pets is difficult to find and use, prolonging pet and owner separation and taking up valuable shelter space in Austin, a no-kill city.

Project: Create a tool that periodically scrapes pet recovery postings and saves them to a database that can be searched via a web tool and will push notifications to interested parties.

Details

Pet Harbor and the Austin Animal Center are the sole datasources of the app as of now - we are retrieving data by performing regular API requests against the Austin data portal for new found animals, and running constant reconciliations with our database. The feeder is not part of the Rails application (this repository) - instead, the Rails app has an API that provides access to update our database of missing animals, and external scripts are handling the nasty business of scraping external sources. The current Pet Harbor feeder is a Ruby script using soda to access the data.

Notifications are being sent to subscribers via email and text message for any new animals logged on AAC.

Installation

NOTE: We temporarily discourage the use of vagrant for this project - it's too slow to be feasible.

Local

  1. Make sure you have Ruby 2.1.3 installed (RVM or rubyenv make this easy)
  2. Make sure you have Bundler installed
  3. $ git clone git@github.com:open-austin/pet-finder.git
  4. $ bundle install
  5. $ rake db:migrate
  6. $ rails server
  7. Visit localhost:3000 to view the site in the browser.

Vagrant

  1. Make sure you have VirtualBox installed.

  2. Make sure you have vagrant installed.

  3. $ git clone git@github.com:open-austin/pet-finder.git

  4. $ vagrant up

    • Note that you will likely have to enter your password at some point to enable NFS - this is bypassable by sourceing the following from vagrant's docs:

      Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
      Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
      Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports
      %admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE
  5. Visit localhost:3000 to view the site in the browser.

Configuration

We are using Figaro to manage secret configuration settings - all this means for you is that you should create an application.yml file in config/ that looks like the following:

GMAIL_USERNAME: [working gmail address]
GMAIL_PASSWORD: [working gmail password]

http_username: username
http_password: password

aws_key: [request a key]
aws_secret: [request a secret]
s3_bucket: pet-alert-dev

plivo_auth_id: auth-id
plivo_auth_token: auth-token
plivo_number: 1231231234

Email services

All emails are sent from a background service called Sidekiq that will be installed alongside the rest of the gems - however, Sidekiq requires redis in order to function properly.

  1. Install redis
  2. $ redis-server
  3. $ bundle exec sidekiq -q notifier -q default

SMS services

We are using Plivo to send SMS messages - if you need to test this locally, you will need to request an auth id and token from us. Generally, this shouldn't be necessary - the message sending part of the app is taken care of.

Contributing

To contribute, fork this repo and submit pull requests for merges. All updates should have accompanying tests (we use RSpec), and should ensure that all existing tests are passing. We are still establishing coding standards and practices, so do your best to contribute code that is as consistent as possible with things now.