Skip to content

feat: update sync server action#2030

Merged
benjamin-747 merged 1 commit intoweb3infra-foundation:mainfrom
benjamin-747:main
Mar 19, 2026
Merged

feat: update sync server action#2030
benjamin-747 merged 1 commit intoweb3infra-foundation:mainfrom
benjamin-747:main

Conversation

@benjamin-747
Copy link
Copy Markdown
Collaborator

No description provided.

Comment on lines +80 to +103
needs: build-and-push
if: ${{ github.repository == 'web3infra-foundation/mega' }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- cluster: gitmega-com
service: mega-web-sync-server-dev-service-v3hdlyk8
# TODO: update service name to actual gitmono sync server ECS service
- cluster: gitmono-com-mega-app
service: mega-web-sync-service
steps:
- name: Force ECS redeploy
run: |
aws ecs update-service \
--cluster gitmega-com \
--service mega-web-sync-server-dev-service-v3hdlyk8 \
--cluster ${{ matrix.cluster }} \
--service ${{ matrix.service }} \
--force-new-deployment
env:
AWS_REGION: ap-southeast-2
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

deploy-gcp:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Comment on lines +104 to +131
needs: build-and-push
if: ${{ github.repository == 'web3infra-foundation/mega' }}
runs-on: ubuntu-latest
steps:
- name: Auth to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: Deploy to Cloud Run (force new revision)
env:
REGION: asia-east1
SERVICE_NAME: buck2hub-notesync
run: |
set -euo pipefail

IMAGE=$(gcloud run services describe "$SERVICE_NAME" \
--project "$GCP_PROJECT_ID" \
--region "$REGION" \
--format="value(spec.template.spec.containers[0].image)")

echo "Current image: $IMAGE"

gcloud run deploy "$SERVICE_NAME" \
--image "$IMAGE" \
--region "$REGION" \
--project "$GCP_PROJECT_ID" \
--quiet

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
@genedna genedna requested a review from Copilot March 19, 2026 12:14
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a49d99ed1e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

export const API_URL = process.env.API_URL || 'https://api.gitmega.com'

// Server Configuration
export const API_URL = process.env.API_URL
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore a guaranteed API_URL value

API_URL is now exported directly from process.env.API_URL without any fallback, while this commit also removes the checked-in sync-server .env.* files; in any environment where API_URL is not explicitly injected, the generated client will run with an empty base URL and issue relative fetches, which breaks sync/auth requests at runtime in Node. Please keep a safe default or fail fast during startup when API_URL is missing.

Useful? React with 👍 / 👎.

Comment on lines +88 to +90
# TODO: update service name to actual gitmono sync server ECS service
- cluster: gitmono-com-mega-app
service: mega-web-sync-service
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Replace placeholder gitmono ECS service name

The matrix includes a TODO stating the gitmono service name is not the actual one, but aws ecs update-service is executed unconditionally for that entry; if this placeholder does not match a real ECS service, the gitmono matrix leg fails and the deploy-aws job is marked failed on every run. This should be updated to the real service name before merging.

Useful? React with 👍 / 👎.

@benjamin-747 benjamin-747 added this pull request to the merge queue Mar 19, 2026
Merged via the queue into web3infra-foundation:main with commit c8b6c00 Mar 19, 2026
8 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the sync-server configuration and its deployment workflow, simplifying local env loading while expanding the GitHub Actions pipeline to publish images to both AWS ECR Public and GCP Artifact Registry.

Changes:

  • Simplify sync-server env loading to only use .env.local in non-production, and make API_URL come directly from runtime environment.
  • Remove committed .env.* files for sync-server.
  • Update web-sync-server-deploy workflow to build once and push to both AWS + GCP, then trigger AWS ECS and GCP Cloud Run redeploys.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
moon/apps/sync-server/src/config.ts Simplifies dotenv loading and changes how API_URL is sourced.
moon/apps/sync-server/.env.staging-nju Removes committed environment config.
moon/apps/sync-server/.env.staging Removes committed environment config.
moon/apps/sync-server/.env.openatom Removes committed environment config.
moon/apps/sync-server/.env.gitmono Removes committed environment config.
moon/apps/sync-server/.env.example Removes example env template.
moon/apps/sync-server/.env.demo Removes committed environment config.
moon/apps/sync-server/.env.buck2hub Removes committed environment config.
.github/workflows/web-sync-server-deploy.yml Builds and pushes the sync-server image to AWS + GCP and triggers redeploys.

- name: Configure docker for GCP
run: gcloud auth configure-docker us-central1-docker.pkg.dev

- name: Build, tag, and push docker image to Amazon ECR Public
export const API_URL = process.env.API_URL || 'https://api.gitmega.com'

// Server Configuration
export const API_URL = process.env.API_URL
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.

4 participants