Skip to content

Conversation

@taiphanvan2k3
Copy link
Member

@taiphanvan2k3 taiphanvan2k3 commented Nov 14, 2025

… appsettings

Summary by CodeRabbit

  • Chores
    • Increased resource allocations for production and staging deployments for improved performance.
    • Deployment workflow updated to use a configurable PORT and to only tag/push images on push or manual runs.
    • Added production environment configuration including base URL, database connection settings, and SMTP/email settings.

@taiphanvan2k3 taiphanvan2k3 self-assigned this Nov 14, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Walkthrough

Updated the GitHub Actions Cloud Run deployment workflow to add a PORT env (10000), conditionally gate Docker tag/push steps, and increase Cloud Run resources (memory 512Mi→4Gi, CPU 1→2). Added appsettings.Production.json with logging, DB connection, BaseUrl (http://localhost:10000), and SMTP settings.

Changes

Cohort / File(s) Summary
Deployment Workflow Configuration
\.github/workflows/deploy-gcloud.yml
Added PORT environment variable (10000); gated Docker tag and push steps with `if: github.event_name == 'push'
Production Settings
src/Web.Api/appsettings.Production.json
New production configuration file adding logging levels, a PostgreSQL DefaultConnection (host, database, username, password, port), AppSettings:BaseUrl set to http://localhost:10000, and SMTP/email configuration fields.

Sequence Diagram(s)

sequenceDiagram
    participant GH as GitHub Actions
    participant Registry as Container Registry
    participant CloudRun as Cloud Run (Prod/Staging)

    note over GH: Workflow starts
    GH->>GH: Build Docker image
    alt On push or workflow_dispatch
        GH->>Registry: Tag image
        GH->>Registry: Push image
    else Other events
        note right of GH: Tag/push skipped
    end
    GH->>CloudRun: Deploy image (uses env PORT=10000, memory=4Gi, cpu=2)
    CloudRun-->>GH: Deployment result
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Mostly configuration changes; low logic density.
  • Quick checks recommended:
    • Verify PORT usage and any callers expecting 8080.
    • Confirm secrets/credentials are not hard-coded in repo (appsettings contains placeholders).
    • Ensure conditional expression for tag/push matches intended CI triggers.

Possibly related PRs

Poem

🐰 I hopped into YAML, set PORT to ten-thousand bright,
I gave the runners extra fuel for every flight,
Production got a coat of four‑gig grace,
SMTP hums softly in its new place,
I nibble configs and dance — deploys take flight! 🚀

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: updating Google Cloud deployment configuration and adding production appsettings, both of which are clearly reflected in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-ci-cd-scripts-for-google-cloud-deployment

Comment @coderabbitai help to get the list of available commands and usage tips.

@taiphanvan2k3 taiphanvan2k3 changed the title feat: Update Google Cloud deployment configuration and add production… feat: Update Google Cloud deployment configuration and add production appsettings Nov 14, 2025
Copy link
Contributor

@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: 3

🧹 Nitpick comments (1)
.github/workflows/deploy-gcloud.yml (1)

104-105: Document the rationale for 8x memory and 2x CPU resource increase.

Memory has been increased from the default 512Mi to 4Gi (8x) and CPU from 1 to 2 (2x) for both production and staging. This is a significant resource escalation with substantial cost implications.

Ensure this increase is justified by:

  • Performance bottleneck analysis
  • Load testing results
  • Memory/CPU profiling of the application
  • Cost impact assessment

Consider adding a comment in the workflow or PR description explaining the reason for this allocation.

Also applies to: 120-121

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9de8b85 and d5a1cb9.

📒 Files selected for processing (2)
  • .github/workflows/deploy-gcloud.yml (3 hunks)
  • src/Web.Api/appsettings.Production.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-deploy
🔇 Additional comments (1)
.github/workflows/deploy-gcloud.yml (1)

35-35: Verify that the application is configured to listen on the PORT environment variable.

The workflow now sets --port 10000 in Cloud Run deployment (lines 108, 124), but the ASP.NET Core application must be explicitly configured to listen on this port. While the appsettings.Production.json references port 10000, there's no visible Kestrel or ASPNETCORE_URLS configuration to ensure the application actually binds to the PORT environment variable.

Ensure your application (typically in Program.cs or startup configuration) is set up to listen on the PORT environment variable:

// Example for ASP.NET Core
builder.WebHost.ConfigureKestrel(options => 
{
    var port = int.Parse(Environment.GetEnvironmentVariable("PORT") ?? "5000");
    options.ListenAnyIPHttps(port);
});

Or via environment variable in Cloud Run deployment:

--set-env-vars "ASPNETCORE_URLS=http://+:10000"

Also applies to: 108-108, 124-124

Copy link
Contributor

@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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d5a1cb9 and 002f45c.

📒 Files selected for processing (1)
  • .github/workflows/deploy-gcloud.yml (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-deploy
🔇 Additional comments (1)
.github/workflows/deploy-gcloud.yml (1)

106-107: Justify the substantial resource scaling.

Memory increased from 512Mi to 4Gi (8x) and CPU from 1 to 2 (2x). While increased resources can improve performance, this represents a significant cost increase. Please document the rationale—whether this was driven by performance testing, scaling requirements, or memory leak fixes.

This will also impact your GCP billing considerably. Confirm this aligns with project requirements and budget.

Also applies to: 122-123

@taiphanvan2k3 taiphanvan2k3 merged commit 81b95bd into main Nov 14, 2025
3 checks passed
@taiphanvan2k3 taiphanvan2k3 deleted the feat/add-ci-cd-scripts-for-google-cloud-deployment branch November 14, 2025 06:52
taiphanvan2k3 added a commit that referenced this pull request Dec 22, 2025
… appsettings (#43)

* feat: Update Google Cloud deployment configuration and add production appsettings

* feat: Add conditional checks for Docker image tagging and pushing in CI/CD workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants