Skip to content

Latest commit

 

History

History
95 lines (66 loc) · 1.94 KB

README.md

File metadata and controls

95 lines (66 loc) · 1.94 KB

Development Locally

Get permission to use API KEY

Contact DataCommons team to get permission for access of secret manager.

Set Google Application Credential

Contact DataCommons team to get permission for GCP application credential. Then run the following command once

gcloud config set project datcom-browser-staging && \
gcloud auth application-default login

This will generate a json file in your local machine, record the path and set the environment variable in your ~/.bash_profile or ~/.bashrc file

export GOOGLE_APPLICATION_CREDENTIALS=<JSON_CREDENTIAL_PATH>

Run all the tests

./run_test.sh

Package javascript and static assets

./run_npm.sh

This will watch static files change and re-build on code edit.

Start the Flask Server

Start the flask webserver locally at localhost:8080

./run_server.sh

Start the server using Docker

Another way to start the server locally is to use Docker.

Make sure you have installed Docker Desktop.

Build Docker image

docker build -t datacommonsorg-website .

Run it locally

docker run \
-p 8080:8080 \
-e GOOGLE_APPLICATION_CREDENTIALS=<JSON_CREDENTIAL_PATH> \
-v $GOOGLE_APPLICATION_CREDENTIALS:<JSON_CREDENTIAL_PATH>:ro \
datacommonsorg-website

Deploy to AppEngine

  • Build compiled asset bundle:

    cd static
    npm run-script build
    cd ..
  • Deploy to Staging:

    cd server && \
    gcloud app deploy app_staging.yaml -q --project=datcom-browser-staging
  • Deploy to Prod:

    cd server && \
    gcloud app deploy app_prod.yaml -q --no-promote --project=datcom-browser-prod

Update resource files

placeid2dcid.json

This file is stored in GCS bucket: datcom-browser-prod.appspot.com (for prod) and datcom-browser-prod.appspot.com (for local and staging). For updating this file, please contact DataCommons team.