From b9caf2c00d6b70881b4d6634273ed996838d7de0 Mon Sep 17 00:00:00 2001 From: "benjamin.747" Date: Wed, 11 Feb 2026 18:15:58 +0800 Subject: [PATCH 1/2] fix: update db config --- api/config/database.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/api/config/database.yml b/api/config/database.yml index d3e75d4..e804acf 100644 --- a/api/config/database.yml +++ b/api/config/database.yml @@ -150,23 +150,23 @@ staging-gitmono: ssl_mode: required replica: true - staging-buck2hub: - primary: - <<: *default - username: <%= Rails.application.credentials.dig(:mysql, :username) %> - password: <%= Rails.application.credentials.dig(:mysql, :password) %> - database: campsite_api_buck2hub - host: <%= Rails.application.credentials.dig(:mysql, :host) %> - ssl_mode: required +staging-buck2hub: + primary: + <<: *default + username: <%= Rails.application.credentials.dig(:mysql, :username) %> + password: <%= Rails.application.credentials.dig(:mysql, :password) %> + database: campsite_api_buck2hub + host: <%= Rails.application.credentials.dig(:mysql, :host) %> + ssl_mode: required - primary_replica: - <<: *default - username: <%= Rails.application.credentials.dig(:mysql, :username) %> - password: <%= Rails.application.credentials.dig(:mysql, :password) %> - database: campsite_api_buck2hub - host: <%= Rails.application.credentials.dig(:mysql, :host) %> - ssl_mode: required - replica: true + primary_replica: + <<: *default + username: <%= Rails.application.credentials.dig(:mysql, :username) %> + password: <%= Rails.application.credentials.dig(:mysql, :password) %> + database: campsite_api_buck2hub + host: <%= Rails.application.credentials.dig(:mysql, :host) %> + ssl_mode: required + replica: true demo: primary: From c9f7b11799aecf8ab27b7106b8b9f5bd33dbb8f6 Mon Sep 17 00:00:00 2001 From: "benjamin.747" Date: Thu, 12 Feb 2026 17:12:18 +0800 Subject: [PATCH 2/2] feat: update login page title --- .github/workflows/deploy-api.yml | 33 ++++++++++++++++++++- api/app/views/users/sessions/new.html.erb | 4 +-- api/config/environments/demo.rb | 1 + api/config/environments/development.rb | 6 ++++ api/config/environments/staging-buck2hub.rb | 1 + api/config/environments/staging-gitmono.rb | 1 + api/config/environments/staging.rb | 12 +------- 7 files changed, 44 insertions(+), 14 deletions(-) diff --git a/.github/workflows/deploy-api.yml b/.github/workflows/deploy-api.yml index 0b2efa3..44cb573 100644 --- a/.github/workflows/deploy-api.yml +++ b/.github/workflows/deploy-api.yml @@ -112,7 +112,8 @@ jobs: "$IMAGE_BASE:${{ env.IMAGE_TAG_BASE }}-arm64" docker manifest push "$IMAGE_BASE:${{ env.IMAGE_TAG_BASE }}" - deploy: + deploy-aws: + if: ${{ github.repository == 'web3infra-foundation/mega' }} needs: manifest runs-on: ubuntu-latest strategy: @@ -133,3 +134,33 @@ jobs: 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: + needs: manifest + 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: buck2-hub-campsite + 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 \ No newline at end of file diff --git a/api/app/views/users/sessions/new.html.erb b/api/app/views/users/sessions/new.html.erb index 07c74fa..c0fc630 100644 --- a/api/app/views/users/sessions/new.html.erb +++ b/api/app/views/users/sessions/new.html.erb @@ -1,4 +1,4 @@ -<% @page_title = "Sign in - Campsite" %> +<% @page_title = "Sign in - #{Rails.configuration.x.app_name}" %>
@@ -11,7 +11,7 @@

Sign in

- Login to Mega with Github Now + Login to <%= Rails.configuration.x.app_name %> with Github Now
diff --git a/api/config/environments/demo.rb b/api/config/environments/demo.rb index 2067fb7..dfd0a2e 100644 --- a/api/config/environments/demo.rb +++ b/api/config/environments/demo.rb @@ -107,4 +107,5 @@ config.hosts << "gitmono.local" config.hosts << "localhost" config.hosts << "127.0.0.1" + config.x.app_name = "Mega Local Demo" end diff --git a/api/config/environments/development.rb b/api/config/environments/development.rb index 628f1d7..5a5e4ae 100644 --- a/api/config/environments/development.rb +++ b/api/config/environments/development.rb @@ -11,6 +11,8 @@ # since you don't have to restart the web server when you make code changes. config.cache_classes = false + # config.action_dispatch.tld_length = 2 + # Do not eager load code on boot. config.eager_load = false @@ -84,4 +86,8 @@ config.hosts << "auth.gitmono.test" config.hosts << "api.gitmono.test" config.hosts << "gitmono.test" + config.hosts << "auth.xuanwu.openatom.cn:3001" + # config.hosts << "auth.gitmono.local:3001" + + config.x.app_name = "Mega Dev" end diff --git a/api/config/environments/staging-buck2hub.rb b/api/config/environments/staging-buck2hub.rb index 8289363..ba17ddc 100644 --- a/api/config/environments/staging-buck2hub.rb +++ b/api/config/environments/staging-buck2hub.rb @@ -115,4 +115,5 @@ /172\.31\.\d+\.\d+/, /192\.168\.\d+\.\d+/, ] + config.x.app_name = "Buck2Hub" end diff --git a/api/config/environments/staging-gitmono.rb b/api/config/environments/staging-gitmono.rb index de8b5f8..d55dd03 100644 --- a/api/config/environments/staging-gitmono.rb +++ b/api/config/environments/staging-gitmono.rb @@ -115,4 +115,5 @@ /172\.31\.\d+\.\d+/, /192\.168\.\d+\.\d+/, ] + config.x.app_name = "Mega App" end diff --git a/api/config/environments/staging.rb b/api/config/environments/staging.rb index 6493d91..9ad0715 100644 --- a/api/config/environments/staging.rb +++ b/api/config/environments/staging.rb @@ -106,7 +106,6 @@ config.hosts << "api.gitmega.com" config.hosts << "gitmega.com" - # config.hosts << "mega-campsite-api.fly.dev" # 允许 AWS VPC 中常见的私有 IP 网段访问 @@ -120,14 +119,5 @@ # required to access the app via Fly private network # config.hosts << "mega-campsite-api.internal" - # Rails.application.config.middleware.insert_before 0, Rack::Cors do - # allow do - # origins 'http://admin.gitmega.com', 'http://auth.gitmega.com', 'http://api.gitmega.com', 'http://home.gitmega.com' - - # resource '*', - # headers: :any, - # methods: [:get, :post, :put, :patch, :delete, :options, :head], - # credentials: true - # end - # end + config.x.app_name = "Mega App" end