This solution implements the same functionality in multiple different programming languages:
- Python: Flask and Python Cloud Client Libraries
- Node: Express and Node.js Cloud Client Libraries
- Java: Spring Boot and Java Cloud Client Libraries.
Each implementation has two main features:
- A processing script that takes initial raw data (.csv file) and produces aggregate information, and
- A web page that uses the aggregate information to serve a Chart.js radar graph.
The index page for each implementation is served by a generated template.
Use Google Cloud Shell, or a local development installation of the programming language of choice (see this configuration for language versions currently in use).
Each language includes a makefile file that includes common development steps:
make install: install the package dependenciesmake dev: run a local development web servermake process: run the processing job locallymake test: run unit testsmake lint: run linting checksmake format: apply linting fixes
Each implementation contains a custom Procfile that defines multiple entrypoints:
web(default): a production web serverprocess: a script to run the aggregate processing
This image built using Google Cloud's buildpacks in Cloud Build configurations, and deployed as both a Cloud Run service and a Cloud Run job using Terraform.
- For Node.js, direct commands are encoded into the
package.json, and referenced by bothmakefileandProcfile. - For Java, we leverage two different Spring Boot Profiles —
defaultandlocallogging. ThedefaultProfile pushes logs to Cloud Logging whilelocalloggingsimply pushes logs to standard output. ThelocalloggingProfile is used for local development and unit tests whiledefaultis used for production and integration tests.