This repository contains Terraform infrastructure configuration for the GBFS Validator service, intended for internal use at MobilityData.
Access to any MobilityData-managed Google Cloud environment is restricted unless explicitly authorized.
"All roads lead to Rome!"
There are many paths to reach the same destination. Use the following steps as a guideline and adapt them to your local or organizational requirements.
For more information, refer to the Google Cloud Platform documentation and the Terraform documentation.
These instructions apply when creating a new environment.
For illustration purposes, the examples below assume the GCP project isgbfs-validator-staging
and the application environment isdev
.
gcloud projects create gbfs-validator-staging --name="GBFS Validator Staging"
Link your billing account to the new project via GCP Console or CLI.
Create a Firebase project and link it to the GCP project.
Create OAuth client credentials via the APIs & Services > Credentials page.
These credentials will be passed as Terraform variables.
Configure Google-managed or self-managed certificates for the HTTPS Load Balancer.
Enable Identity Platform in the project and configure authentication providers as needed.
gcloud auth application-default login
gcloud config set project gbfs-validator-staging
gcloud storage buckets create gs://mobilitydata-gbfs-validator-state-staging \
--project=gbfs-validator-staging \
--location=northamerica-northeast1 \
--uniform-bucket-level-access
Copy the file backend.conf.rename_me
and rename it to:
backend-dev.conf
Populate it with valid values matching the GCP project and bucket.
gcloud iam service-accounts create gbfs-deployer-service-account \
--display-name="GBFS Terraform Deployer"
../scripts/setup-environment.sh gbfs-validator-staging dev
terraform init -backend-config=backend-dev.conf
../scripts/docker-build-validator.sh --push -version dev-$(($(date +%s)/60))
terraform apply -var="environment=dev" -var=-"gbfs_api_image_version=<<TAG from previous step>>"
Happy coding!
- Locate the service list in the
.scripts/setup-environment.s
script - Execute the script,
./scripts/setup-environment.sh gbfs-validator-staging dev