- 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 postgresql
- Install PostGIS (
sudo apt-get install postgresql-9.1-postgis
) - Install Bundle
- Install Redis (
sudo apt-get install redis-server
) - Run
bundle
- May need
sudo apt-get install libpq-dev
- Start Elastic Search with
sudo service elasticsearch start
- 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
- Create a PostGRES database
- Log in to the server using
sudo -u postgres psql
CREATE USER user WITH PASSWORD 'password';
CREATE DATABASE omgtransit;
GRANT ALL PRIVILEGES ON DATABASE omgtransit TO user;
- Load the PostGIS extension
sudo -u postgres createlang plpgsql omgtransit;
sudo -u postgres psql -d omgtransit -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
sudo -u postgres psql -d omgtransit -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
- Run
sudo mkdir -p /etc/nubic/db
- Create the file
/etc/nubic/db/omgtransit.yml
- Set up
/etc/nubic/db/omgtransit.yml
according to Setting up Database Credentials
We get the location of stops and route paths from General Transit Feed Specification (GTFS) files. More information on these files is available here.
GTFS data is available at the GTFS Exchange.
Download these data files and put them in appropriately named folders in setup/
.
For instance, you can download the Minneapolis Metro Transit feed from
here. And unzip this into
the folder setup/msp_gtfs
.
- Run
rake db:migrate
- Run
rake db:seed
- Run
rake omgtransit:load_msp_gtfs
(Or what have you, this draws from thesetup/
folders).
- Run
rake omgtransit:load_mn_bikes
- Run
rake omgtransit:load_umn_stops
- Repeat Step 3 as needed
- Run
rake omgtransit:reset_stops
- Index GeoData
rake environment tire:import CLASS='Stop' FORCE=true
- Occasionally, it may useful to force the environment with
rake environment tire:import CLASS='Stop' FORCE=true RAILS_ENV=production
- 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. The credentials are store in /etc/nubic/db/omgtransit.yml
.
This file may look something like the following.
defaults: adapter: postgresql encoding: utf8 host: localhost development: database: omgtransit-dev username: yourdevusername password: yourdevpassword test: database: omgtransit-test username: yourtestusername password: yourtestpassword prod: database: omgtransit username: yourprodusername password: yourprodpassword
You should secure omgtransit.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 | | |