Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(memorystore): added valkey leaderboard demo application #10007

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

dackers86
Copy link

@dackers86 dackers86 commented Jan 31, 2025

Description

Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@dackers86 dackers86 requested review from yoshi-approver and a team as code owners January 31, 2025 18:41
@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: memorystore labels Jan 31, 2025
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dackers86 and reviewers,

I'm currently reviewing this pull request and will post my feedback in a few minutes. In the meantime, here's a summary of the changes for you and other reviewers to quickly get up to speed:

This pull request adds a leaderboard demo application that uses Valkey as an in-memory cache to accelerate data retrieval. The application allows users to add or update their scores, and retrieve the top entries from the leaderboard. The application is built using Spring Boot and connects to a PostgreSQL database.

Here's a breakdown of the changes:

  • memorystore/valkey/leaderboard/README.md: This file was updated to include instructions on how to run the application locally, via Docker, and how to deploy it to Google Cloud. The instructions cover setting up PostgreSQL and Valkey, creating database tables, building and running the application, and deploying to Google Cloud Run using Terraform. The file also describes the API endpoints for interacting with the leaderboard.
  • memorystore/valkey/leaderboard/app/.gitignore: This file was added to ignore various files and directories generated by the build process, IDEs, and other tools.
  • memorystore/valkey/leaderboard/app/Dockerfile: This file was added to define the Docker image for the application. It uses an OpenJDK base image, installs Maven, copies the project files, builds the application, copies the JAR file, exposes port 8080, and runs the application.
  • memorystore/valkey/leaderboard/app/docker-compose.yaml: This file was added to define the Docker Compose configuration for running the application, Valkey, and PostgreSQL together.
  • memorystore/valkey/leaderboard/app/init.sql: This file was added to create the leaderboard table in the PostgreSQL database, including indexes for efficient sorting.
  • memorystore/valkey/leaderboard/app/main.tf: This Terraform configuration file was added to deploy the application's infrastructure to Google Cloud, including a Cloud Run service, a Valkey instance, and a Cloud SQL instance.
  • memorystore/valkey/leaderboard/app/pom.xml: This file was updated to include the necessary dependencies for the application, including Spring Boot, Jedis (Redis client), PostgreSQL JDBC driver, and Thymeleaf.
  • memorystore/valkey/leaderboard/app/src/main/java/*: Several Java files were added or modified to implement the application's logic, including controllers, repositories, data models, and configuration classes. These files handle API requests, database interactions, caching with Valkey, and rendering the leaderboard.
  • memorystore/valkey/leaderboard/sample-data/.gitignore: This file was added to ignore various files and directories generated by the build process, IDEs, and other tools for the sample data application.
  • memorystore/valkey/leaderboard/sample-data/Dockerfile: This file was added to define the Docker image for the sample data application.
  • memorystore/valkey/leaderboard/sample-data/docker-compose.yaml: This file was added to define the Docker Compose configuration for running the sample data application, Valkey, and PostgreSQL together.
  • memorystore/valkey/leaderboard/sample-data/pom.xml: This file contains the project dependencies for the sample data application.
  • memorystore/valkey/leaderboard/sample-data/src/main/java/app/Main.java: This file contains the main application logic for the sample data application, which populates the database with sample leaderboard entries.

The author has also completed the checklist provided in the pull request description.

Let me know if you have any questions.


Small code, big impact,
Leaderboard's shining bright,
Data flows so fast!

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request adds a Valkey leaderboard demo application. The documentation is comprehensive and covers running locally, with Docker, and deploying to Google Cloud. The code appears functional and well-structured. Here are a few suggestions for improvement:

Summary of Google Java Style Guide elements referenced:

  • Javadoc comments should be present for public classes and methods.
  • Constants should be named in UPPER_SNAKE_CASE.
  • Braces should be used even for single-line if statements.
  • Indentation should be 4 spaces.

Copy link
Contributor

@minherz minherz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repository is not intended for storing demo applications. Please close this PR and migrate the code to another repo. We will be happy to collaborate and help you to find the correct repository for this demo app or create a new one.

cabljac and others added 4 commits February 5, 2025 09:36
chore(memorystore-valkey-leaderboard): lint fixes for LeaderboardController

chore(memorystore-valkey-leaderboard): lint fixes for DataController.java

chore(memorystore-valkey-leaderboard): lint fixes for JedisConfig.java

chore(memorystore-valkey-leaderboard): lint fixes for LeaderboardEntry.java

chore(memorystore-valkey-leaderboard): lint fixes for FromCacheType.java

chore(memorystore-valkey-leaderboard): lint fixes for OrderByType, LeaderboardResponse

chore(memorystore-valkey-leaderboard): lint fixes for LeaderboardRepository

chore(memorystore-valkey-leaderboard): lint fixes for JdpcConfig

chore(memorystore-valkey-leaderboard): lint fixes for WebConfig

chore(memorystore-valkey-leaderboard): lint fixes for remaining files

chore(memorystore-valkey-leaderboard): lint fixes for sample-data

chore(memorystore-valkey-leaderboard): more lint fixes
@cabljac cabljac force-pushed the @invertase/memorystore-valkey-leaderboard-demo-application branch from d9b5d84 to 240804e Compare February 5, 2025 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: memorystore samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants