- Download and install ElasticSearch
- Install Ruby 1.9.3
- Install Rails
- Be sure that Rails is not trying to use Ruby 1.8, it will not work
- Install Bundle
- Run
bundle
- May need
sudo apt-get install libpq-dev
- May need
sudo apt-get install libsqlite3-dev
- Start Elastic Search with
sudo service elasticsearch start
- Set up the database credentials (see below)
- rake db:migrate
- Load stop data into postgres
rake mspbus:load_stops
- Index GeoData
rake environment tire:import CLASS='Stop' FORCE=true
- Set up the configuration variables in
app/assets/javascripts/config.js
- Set your own
config.google_maps_api_key
inside development.rb, production.rb and test.rb located inconfig/environments
- Run
rails s
in the project's base directory to start the server
Database credentials are not part of the distribution for obvious
reasons. The included config/database.yml
uses the bcdatabase
package to retrieve the credentials from elsewhere on your Rails
server. To set up these credentials:
sudo mkdir -p /etc/nubic/db
- Create the file
/etc/nubic/db/mspbus.yml
The file mspbus.yml
may look something like the following.
defaults: adapter: postgresql encoding: utf8 host: localhost dev: database: mspbus-dev username: yourdevusername password: yourdevpassword test: database: mspbus-test username: yourtestusername password: yourtestpassword prod: database: mspbus username: yourprodusername password: yourprodpassword
You should secure mspbus.yml
so that it can only be read by the server.
You can optionally encrypt the file as well. For more information, see
the bcdatabase project.
Column | Type | Modifiers ---------------------+------------------------+----------- stop_id | character varying(500) | not null stop_code | character varying(500) | stop_name | character varying(500) | not null stop_desc | character varying(500) | stop_lat | numeric(9,6) | not null stop_lon | numeric(9,6) | not null zone_id | character varying(100) | stop_url | character varying(500) | location_type | integer | parent_station | character varying(500) | stop_timezone | character varying(500) | wheelchair_boarding | integer | stop_street | character varying(500) | stop_city | character varying(500) | stop_region | character varying(500) | stop_postcode | character varying(50) | stop_country | character varying(100) | Indexes: "stops_pkey" PRIMARY KEY, btree (stop_id)
Example output
1000 | | 50 St W & Upton Av S | Near side E | 44.912365 | -93.315178 | | http://www.metrotransit.org/NexTripBadge.aspx?stopnumber=1000 | | | | 1 | 50 St W | MINNEAPOLIS | | | 10000 | | Carmen Av & Claude Way E #2 | Across from S | 44.857449 | -93.040977 | | http://www.metrotransit.org/NexTripBadge.aspx?stopnumber=10000 | | | | 1 | Carmen Av | INVER GROVE HEIGHTS | | | 10001 | | Carmen Av & 65 St E | Far side S | 44.855103 | -93.042496 | | http://www.metrotransit.org/NexTripBadge.aspx?stopnumber=10001 | | | | 1 | Carmen Av | INVER GROVE HEIGHTS | | |