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

chore(server): fake gcs server for local development #1372

Merged
merged 3 commits into from
Jan 27, 2025

Conversation

soneda-yuya
Copy link
Contributor

@soneda-yuya soneda-yuya commented Jan 24, 2025

Overview

want to use gcs emulator on local

What I've done

  • add docker compose service (gcs) for local gcs emulator
  • add Makefile command for up added docker compose service
  • add README about using storage.

What I haven't done

How I tested

Which point I want you to review particularly

Memo

Summary by CodeRabbit

  • New Features

    • Added a new GCS service to the Docker Compose configuration.
    • Introduced new Makefile targets for managing the GCS service.
  • Configuration Changes

    • Renamed Google Cloud-related environment variables to use REEARTH_ prefix in .env.example.

Copy link

coderabbitai bot commented Jan 24, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces a new service named gcs to the project's Docker Compose configuration. This service utilizes the fsouza/fake-gcs-server image, exposing port 4443 and mounting a volume from the host. Additionally, the environment variable declarations in the .env.example file are updated to include a REEARTH_ prefix for better organization. The Makefile is also modified to add new targets for managing the gcs service, facilitating easier control over the service's lifecycle.

Changes

File Change Summary
docker-compose.yml Added new gcs service with fsouza/fake-gcs-server image, exposing port 4443 and mounting /tmp/gcs volume
server/.env.example Renamed Google Cloud-related environment variables to use REEARTH_ prefix
server/Makefile Added up-gcs and down-gcs targets for managing the GCS service

Possibly related PRs

  • chore(server): Download debug #1171: Enhances the gcs package, which is directly related to the new gcs service added in the main PR, as both involve Google Cloud Storage functionality.
  • ci: remove GCS upload for nightly releases #1360: This PR involves changes related to Google Cloud Storage (GCS) uploads, which may connect to the overall context of managing GCS services, including the new gcs service introduced in the main PR.

Poem

🐰 In the cloud where bunnies play,
A GCS service joins the fray.
With ports and volumes set just right,
Our storage dreams take joyful flight.
Env vars renamed, all neat and spry,
Hopping high, we reach the sky! 🌈


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da67633 and 77698dd.

⛔ Files ignored due to path filters (1)
  • server/README.md is excluded by !**/*.md
📒 Files selected for processing (3)
  • docker-compose.yml (1 hunks)
  • server/.env.example (1 hunks)
  • server/Makefile (2 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Jan 24, 2025

Deploy Preview for reearth-web canceled.

Name Link
🔨 Latest commit 77698dd
🔍 Latest deploy log https://app.netlify.com/sites/reearth-web/deploys/67974e3fcf9c3b00085fc14d

@soneda-yuya soneda-yuya force-pushed the chore/gcs_emulator branch 3 times, most recently from 3f66a22 to aadec33 Compare January 24, 2025 10:21
@soneda-yuya soneda-yuya marked this pull request as ready for review January 24, 2025 10:26
@soneda-yuya soneda-yuya requested a review from pyshx as a code owner January 24, 2025 10:26
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
server/Makefile (1)

63-68: Add help text for new GCS targets.

The new targets should be documented in the help section for discoverability.

Add help text by applying this diff:

 @echo "  run-app           Run the application"
 @echo "  run-db            Run the MongoDB database using Docker Compose"
+@echo "  up-gcs            Start the GCS emulator for local development"
+@echo "  down-gcs          Stop the GCS emulator"
 @echo "  gql               Generate GraphQL code include dataloader"

Also update the .PHONY list:

-.PHONY: lint test failcheck e2e build dev-install dev run-app run-db gql mockuser schematyper
+.PHONY: lint test failcheck e2e build dev-install dev run-app run-db up-gcs down-gcs gql mockuser schematyper
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 11d841b and aadec33.

⛔ Files ignored due to path filters (1)
  • server/README.md is excluded by !**/*.md
📒 Files selected for processing (3)
  • docker-compose.yml (1 hunks)
  • server/.env.example (1 hunks)
  • server/Makefile (1 hunks)
🔇 Additional comments (1)
docker-compose.yml (1)

23-29: Ensure tmp/gcs directory exists before starting the service.

The service configuration looks good, but the mounted volume directory needs to exist before starting the service.

Add directory creation to the Makefile's up-gcs target to prevent startup issues:

 up-gcs:
+    mkdir -p tmp/gcs
     docker compose -f ../docker-compose.yml up -d gcs
✅ Verification successful

Review comment is valid - directory creation is needed

The tmp/gcs directory is not created anywhere in the codebase, and the suggested Makefile change is necessary to prevent service startup issues.

🏁 Scripts executed

The following scripts were executed for the analysis:

Error: No shell scripts found


Script:

#!/bin/bash
# Find Makefile and show its contents
fd Makefile --type f --exec cat {}

# Look for any setup scripts that might handle directory creation
fd -e sh -e bash --type f --exec grep -l "mkdir.*tmp/gcs" {} \;

# Check if tmp/gcs directory is referenced anywhere else
rg "tmp/gcs" -l

Length of output: 2362

server/.env.example Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
server/Makefile (1)

22-23: Enhance help text descriptions for GCS commands.

While the help text is functional, consider making it more descriptive to better explain the purpose of the fake-gcs-server for local development.

-	@echo "  up-gcs            Run the fake-gcs-server using Docker Compose"
-	@echo "  down-gcs          Stop the fake-gcs-server using Docker Compose"
+	@echo "  up-gcs            Start the GCS emulator for local development using Docker Compose"
+	@echo "  down-gcs          Stop the GCS emulator container"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aadec33 and da67633.

⛔ Files ignored due to path filters (1)
  • server/README.md is excluded by !**/*.md
📒 Files selected for processing (3)
  • docker-compose.yml (1 hunks)
  • server/.env.example (1 hunks)
  • server/Makefile (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • docker-compose.yml
  • server/.env.example
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: ci-server / ci-server-lint
  • GitHub Check: ci-server / ci-server-test
🔇 Additional comments (2)
server/Makefile (2)

78-78: LGTM!

The .PHONY declaration is correctly updated to include the new targets.


65-70: Verify the GCS emulator setup works as expected.

Please ensure that:

  1. The GCS emulator can be started successfully with make up-gcs
  2. The service is accessible on port 4443 as configured in the Docker Compose file
  3. The emulator can be stopped cleanly with make down-gcs

server/Makefile Outdated Show resolved Hide resolved
Comment on lines 12 to 14
REEARTH_GOOGLE_CLOUD_PROJECT=
REEARTH_GCS_BUCKETNAME=
REEARTH_GCS_PUBLICATIONCACHECONTROL=
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make sure to edit envconfig from server/internal/app/config/config.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pyshx
thanks for comment.
I fixed.

REEARTH_GOOGLE_CLOUD_PROJECT => GOOGLE_CLOUD_PROJECT
Other is OK.

@soneda-yuya soneda-yuya changed the title chore(server): fack gcs server for local development chore(server): fake gcs server for local development Jan 24, 2025
@soneda-yuya soneda-yuya requested a review from pyshx January 25, 2025 04:13
@soneda-yuya soneda-yuya merged commit 267cfbd into main Jan 27, 2025
17 checks passed
@soneda-yuya soneda-yuya deleted the chore/gcs_emulator branch January 27, 2025 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants