Skip to content

Commit ec48d60

Browse files
author
Landon Reed
authored
Merge pull request #50 from catalogueglobal/dev
v3.0.0
2 parents cd4ee1c + 5b005d7 commit ec48d60

File tree

35 files changed

+1747
-454
lines changed

35 files changed

+1747
-454
lines changed

docs/dev/deployment.md

Lines changed: 90 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22

33
## Prerequisites
44

5-
The application consists of two repositories: a [Spark-powered Java backend](https://github.com/conveyal/datatools-server) and a [Javascript frontend written with React and Redux](https://github.com/conveyal/datatools-ui). To install and deploy the application, you will need Java 8, Maven, Node/npm, yarn, and [mastarm](https://github.com/conveyal/mastarm).
5+
The application consists of two repositories: a [Spark-powered Java backend](https://github.com/conveyal/datatools-server)
6+
and a [Javascript frontend written with React and Redux](https://github.com/conveyal/datatools-ui).
7+
To install and deploy the application, you will need Java 8, Maven, Node/npm,
8+
yarn, and [mastarm](https://github.com/conveyal/mastarm).
69

7-
User authentication is done via [Auth0](http://auth0.com). You will need an Auth0 account and application to use the Data Manager.
10+
User authentication is done via [Auth0](http://auth0.com). You will need an
11+
Auth0 account and application to use the Data Manager.
12+
13+
Two databases are required for the application: [MongoDB](https://www.mongodb.com/)
14+
and a SQL database ([PostgreSQL](https://www.postgresql.org/) is recommended).
815

916
## Installation and Basic Configuration
1017

@@ -22,9 +29,13 @@ $ cp datatools-ui/configurations/default/env.yml.tmp datatools-ui/configurations
2229
$ cp datatools-server/configurations/default/env.yml.tmp datatools-server/configurations/default/env.yml
2330
```
2431

25-
You'll then need to supply Auth0 account information (see below) and API keys for various services used in the application.
32+
You'll then need to supply Auth0 account information (see below) and API keys
33+
for various services used in the application.
2634

27-
The default `server.yml` (for `datatools-server`) and `settings.yml` (for `datatools-ui`) should work out of the box, but you may want to specify alternative settings files outside of these repositories. These can be specified as a directory during `datatools-ui` build with mastarm:
35+
The default `server.yml` (for `datatools-server`) and `settings.yml` (for
36+
`datatools-ui`) should work out of the box, but you may want to specify
37+
alternative settings files outside of these repositories. These can be specified
38+
as a directory during `datatools-ui` build with mastarm:
2839

2940
```bash
3041
$ mastarm build --config /path/to/configurations/dir
@@ -35,24 +46,56 @@ AND as individual file args for `datatools-server`:
3546
```bash
3647
$ java -jar target/dt-v1.0.0.jar /path/to/env.yml /path/to/server.yml
3748
```
38-
In `datatools-server:server.yml`, be sure to update the paths for where the databases will be stored:
49+
In `datatools-server:server.yml`, be sure to update the paths for where the
50+
databases will be stored:
3951

4052
```yaml
4153
application:
4254
data:
43-
mapdb: /path/to/mapdb
44-
gtfs: /path/to/gtfs
45-
editor_mapdb: /path/to/editor
46-
regions: /path/to/regions/geojson
55+
gtfs: /path/to/gtfs/storage
4756
```
57+
58+
### Database setup
59+
60+
#### GTFS data storage
61+
GTFS data storage is handled by whichever standard RDBMS you prefer. However,
62+
the application has been significantly tuned and optimized for PostgreSQL 9, so
63+
we highly recommend using PostgreSQL.
64+
65+
Once PostgreSQL is installed and the service has been started, create the
66+
database:
67+
```bash
68+
$ createdb gtfs_storage_db
69+
```
70+
Pass the URL of the database in the server's `env.yml` (and optionally add
71+
additional connection variables):
72+
```yaml
73+
GTFS_DATABASE_URL: jdbc:postgresql://localhost/gtfs_storage_db
74+
# GTFS_DATABASE_USER:
75+
# GTFS_DATABASE_PASSWORD:
76+
```
77+
78+
#### Application data storage
79+
Application data storage (i.e., where projects, feed sources, and feed versions
80+
are stored) is handled by MongoDB. There is no need to manually initialize a
81+
database in MongoDB (MongoDB will handle this automatically if you prefer).
82+
Connection details for MongoDB are also set in the server's `env.yml`:
83+
```yaml
84+
MONGO_URI: # defaults to localhost:27017 (MongoDB default) if empty
85+
MONGO_DB_NAME: application_db
86+
```
87+
4888
### Setting up Auth0
4989
5090
#### Creating account and application (client)
5191
1. Create an [Auth0](https://auth0.com) account (free).
52-
2. Once you've created an Auth0 account, create an application (client) in Auth0 to use with the Data Manager with the following settings:
53-
- enable only `Username-Password-Authentication` connections (i.e., turn off Google)
92+
2. Once you've created an Auth0 account, create an application (client) in Auth0
93+
to use with the Data Manager with the following settings:
94+
- enable only `Username-Password-Authentication` connections (i.e., turn off
95+
Google)
5496
- set `Use Auth0 instead of the IdP to do Single Sign On` to true
55-
- update the following application- and account-level settings to include `http://localhost:9000` (or the domain where the application will be hosted):
97+
- update the following application- and account-level settings to include
98+
`http://localhost:9000` (or the domain where the application will be hosted):
5699
- Account level (Account Settings > Advanced)
57100
- Allowed logout URLs
58101
- Application level
@@ -61,7 +104,10 @@ application:
61104
- keep all other default settings
62105

63106
#### Creating your first user
64-
Create your first Auth0 user through Auth0 web console (Users > Create User). In addition to an email and password, you'll need to supply the user with the following default application admin `app_metadata` (`user_metadata` should remain empty):
107+
Create your first Auth0 user through Auth0 web console (Users > Create User). In
108+
addition to an email and password, you'll need to supply the user with the
109+
following default application admin `app_metadata` (`user_metadata` should
110+
remain empty):
65111

66112
```json
67113
{
@@ -78,7 +124,7 @@ Create your first Auth0 user through Auth0 web console (Users > Create User). In
78124
}
79125
```
80126

81-
#### Update `env.yml` for both
127+
#### Update `env.yml` for server and UI repos
82128
Update the following properties in **both** `env.yml` files to reflect the public Auth0 application settings:
83129

84130
```yaml
@@ -116,7 +162,6 @@ Build and deploy the frontend to s3 using npm script (which calls [mastarm](http
116162

117163
```bash
118164
$ npm run deploy -- s3://$S3_BUCKET_NAME/dist
119-
>>>>>>> Stashed changes
120165
```
121166

122167
Package the application using Maven:
@@ -132,12 +177,21 @@ $ java -jar target/dt-v1.0.0.jar /path/to/env.yml /path/to/server.yml
132177
```
133178

134179

135-
The application back-end should now be running at `http://localhost:9000` (or whatever port you specified in `server.yml`).
136-
The front-end assets are pointed to by the back end at whatever s3 bucket name is specified in `server.yml` at `application.assets_bucket`.
180+
The application back-end should now be running at `http://localhost:9000` (or
181+
whatever port you specified in `server.yml`). The front-end assets are pointed
182+
to by the back end at whatever s3 bucket name is specified in `server.yml` at
183+
`application.assets_bucket`.
137184

138185
## Configuring Modules
139186

140-
The application contains a number of optional modules that each require their own configuration settings and resources. At minimum, each module must be set to `enabled: true` and may require additional configuration.
187+
The application contains a number of optional modules that each require their
188+
own configuration settings and resources. At minimum, each module must be set to
189+
`enabled: true` and may require additional configuration.
190+
191+
**Note:** for `datatools-server` `v3.0.0`, the `editor` and `r5_network` should be
192+
disabled because they have not been refactored to handle updates to the loading
193+
of GTFS data into an RDBMS. Please use `v2.0.0` or wait for releases following
194+
`v3.0.0`.
141195

142196
### Editor
143197

@@ -150,13 +204,16 @@ Enables the GTFS Editor module.
150204
- `MAPBOX_ACCESS_TOKEN`
151205
- `R5_URL` (optional parameter for r5 routing in editor pattern drawing)
152206

153-
### Validator
207+
### R5 network validation
154208

155-
While the application handles basic validation even without the validator module enabled, the validator allows for enhanced accessibility- and map-based validation.
209+
While the application handles basic validation even without the `r5_network`
210+
module enabled, this module allows for enhanced accessibility- and map-based
211+
validation.
156212

157213
#### List of configuration settings
158214

159-
- `OSM_VEX` - `datatools-server:env.yml` the validator requires the URL of a running instance of the [OSM vex server](https://github.com/conveyal/vanilla-extract).
215+
- `OSM_VEX` - `datatools-server:env.yml` the validator requires the URL of a
216+
running instance of the [OSM vex server](https://github.com/conveyal/vanilla-extract).
160217

161218

162219
### Sign Configurations
@@ -189,26 +246,31 @@ Enables the OTP automated deployments module.
189246

190247
#### List of configuration settings
191248

192-
- `OSM_VEX` - `datatools-server:env.yml` the validator requires the URL of a running instance of the [OSM vex server](https://github.com/conveyal/vanilla-extract).
249+
- `OSM_VEX` - `datatools-server:env.yml` the validator requires the URL of a
250+
running instance of the [OSM vex server](https://github.com/conveyal/vanilla-extract).
193251

194252
### GTFS API
195253

196-
Supports other modules with API endpoints for getting GTFS entities (routes, stops, etc.)
254+
Supports other modules with API endpoints for getting GTFS entities (routes,
255+
stops, etc.)
197256

198257
#### List of configuration settings
199258

200259
- `load_on_fetch` - whether to load GTFS feeds when new feed is detected
201260
- `load_on_startup` - whether to load GTFS feeds on application startup
202261
- `use_extension` - which extension to connect to
203-
- `update_frequency` - update frequency for GTFS API (in seconds). Comment out to disable updates.
262+
- `update_frequency` - update frequency for GTFS API (in seconds). Comment
263+
out to disable updates.
204264

205265
## Configuring Extensions
206266

207-
The application supports integration with several third-party resources for retrieving feeds.
267+
The application supports integration with several third-party resources for
268+
retrieving feeds.
208269

209270
### Integration with [transit.land](https://transit.land/)
210271

211-
Ensure that the `extensions:transitland:enabled` flag is set to `true` in `config.yml`:
272+
Ensure that the `extensions:transitland:enabled` flag is set to `true` in
273+
`config.yml`:
212274

213275
```yaml
214276
extensions:
@@ -219,7 +281,8 @@ extensions:
219281

220282
### Integration with [TransitFeeds](http://transitfeeds.com/)
221283

222-
Ensure that the `extensions:transitfeeds:enabled` flag is set to `true` in `config.yml`, and provide your API key:
284+
Ensure that the `extensions:transitfeeds:enabled` flag is set to `true` in
285+
`config.yml`, and provide your API key:
223286

224287
```yaml
225288
extensions:

lib/alerts/actions/alerts.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import fetch from 'isomorphic-fetch'
33
import { fetchStopsAndRoutes } from '../../gtfs/actions/general'
44

55
import { secureFetch } from '../../common/actions'
6+
import {GTFS_API_PREFIX} from '../../common/constants'
67
import { getAlertsUrl, getFeedId } from '../../common/util/modules'
78
import { setErrorMessage } from '../../manager/actions/status'
89
import {getActiveProject} from '../../manager/selectors'
@@ -129,7 +130,9 @@ export function editAlert (alert) {
129130
export function fetchEntity (entity, activeProject) {
130131
const feed = activeProject.feedSources.find(f => getFeedId(f) === entity.entity.AgencyId)
131132
const feedId = getFeedId(feed)
132-
const url = entity.type === 'stop' ? `/api/manager/stops/${entity.entity.StopId}?feed=${feedId}` : `/api/manager/routes/${entity.entity.RouteId}?feed=${feedId}`
133+
const url = entity.type === 'stop'
134+
? `${GTFS_API_PREFIX}stops/${entity.entity.StopId}?feed=${feedId}`
135+
: `${GTFS_API_PREFIX}routes/${entity.entity.RouteId}?feed=${feedId}`
133136
return fetch(url)
134137
.then((response) => {
135138
return response.json()

0 commit comments

Comments
 (0)