Skip to content

Latest commit

 

History

History
131 lines (93 loc) · 3.15 KB

README.md

File metadata and controls

131 lines (93 loc) · 3.15 KB

GTFS Validator Web Service

Setup

  • Create GCP Account
  • Create Google Cloud bucket for uploads
  • Create Google Cloud bucket for reports/results

The current instance is currnetly configured with the following:

  • Upload Bucket: gs://gtfs-validator-user-uploads
  • Results Bucket: gs://gs://gtfs-validator-results
  • Set default region
gcloud config set run/region us-east1
  • Service account for invoker
gcloud iam service-accounts create invoker-gtfs-web \
   --display-name "Invoker for gtfs web pub/sub"
  • Grant permissions
gcloud run services add-iam-policy-binding gtfs-validator-web \
   --member=serviceAccount:invoker-gtfs-web@web-based-gtfs-validator.iam.gserviceaccount.com \
   --role=roles/run.invoker
  • Create pub/sub topic
gcloud pubsub topics create GTFS-WEB-VALIDATOR
  • Create a push subscription and associate it with the service account
gcloud projects add-iam-policy-binding web-based-gtfs-validator \
     --member=serviceAccount:[email protected] \
     --role=roles/iam.serviceAccountTokenCreator
  • Create a Pub/Sub subscription with the service account
gcloud pubsub subscriptions create GTFS-WEB-VALIDATOR-SUBSCRIPTION --topic GTFS-WEB-VALIDATOR \
--ack-deadline=600 \
--push-endpoint=https://gtfs-validator-web-mbzoxaljzq-ue.a.run.app/run-validator \
--push-auth-service-account=invoker-gtfs-web@web-based-gtfs-validator.iam.gserviceaccount.com
  • Test
gcloud pubsub topics publish GTFS-WEB-VALIDATOR --message "hello"
  • Apply notification configuration
gcloud storage buckets notifications create gs://gtfs-validator-user-uploads --topic=GTFS-WEB-VALIDATOR --event-types=OBJECT_FINALIZE

CORS setup for upload bucket

[
  {
    "origin": ["*"],
    "method": ["PUT"],
    "responseHeader": ["content-type", "access-control-allow-origin"],
    "maxAgeSeconds": 3600
  }
]
gcloud storage buckets update gs://gtfs-validator-user-uploads --cors-file=cors.json

CORS setup for reports bucket

[
  {
    "origin": ["*"],
    "method": ["HEAD", "GET"],
    "responseHeader": ["content-type", "access-control-allow-origin"],
    "maxAgeSeconds": 3600
  }
]
gcloud storage buckets update gs://gtfs-validator-results --cors-file=cors.json

Google Cloud Storage Bucket Lifecycle

Both gtfs-validator-user-uploads and gtfs-validator-results have been configured so that all files older than 30 days are deleted. This can be manually configured via the Google Cloud Storage Console or via the CLI.

Run It

Start the web service (from project root directory):

./gradlew bootRun

Start the client (from the web/client directory):

npm run dev

Deploying Updates

gcloud builds submit