06-Operations / 06.02.WUI-Operations

06.02.WUI Operations

06.02. WUI Operations

This guide provides operational procedures for deploying, monitoring, and troubleshooting the WUI (frontend).

Production URLs

Environment URL
inf https://inf.carpulsetracker.com
dev https://dev.carpulsetracker.com
tst https://tst.carpulsetracker.com
prd https://carpulsetracker.com

Deploying the WUI

Auto-Deploy (Push to Master)

Pushing to the master branch automatically deploys to inf and dev environments.

git push origin master

Manual Deploy (Workflow Dispatch)

For tst and prd environments, use the GitHub Actions UI or CLI:

Via GitHub UI: 1. Go to https://github.com/csitea/bnc-cpt-wui/actions 2. Click on "ci-cd: wui-build-deploy" 3. Click "Run workflow" 4. Select the target environment (inf/dev/tst/prd) 5. Click "Run workflow"

Via GitHub CLI:

# Deploy to a specific environment
gh workflow run ci.yaml -f environment=dev --repo csitea/bnc-cpt-wui

# Deploy to all environments
for env in inf dev tst prd; do
  echo "=== Deploying to $env ==="
  gh workflow run ci.yaml -f environment=$env --repo csitea/bnc-cpt-wui
  sleep 30
done

Option 2: Shell Action (Local Deploy)

cd /opt/bnc/bnc-cpt/bnc-cpt-utl

# Deploy to single environment
ENV=dev ./run -a do_gcp_deploy_wui

# Deploy to all environments
for env in inf dev tst prd; do
  ENV=$env ./run -a do_gcp_deploy_wui
done

Monitoring Deployments

Check GitHub Actions Status

# List recent workflow runs
gh run list --workflow=ci.yaml --repo csitea/bnc-cpt-wui

# Watch the latest run in real-time
gh run watch --repo csitea/bnc-cpt-wui

# View logs of latest run
gh run view --log --repo csitea/bnc-cpt-wui

# View logs of failed run
gh run view --log-failed --repo csitea/bnc-cpt-wui

Health Checks

# Quick check all environments
for env in inf dev tst prd; do
  if [ "$env" = "prd" ]; then
    url="https://carpulsetracker.com"
  else
    url="https://$env.carpulsetracker.com"
  fi
  echo -n "$env: "
  curl -s -o /dev/null -w "%{http_code}" "$url/index.html"
  echo ""
done

Version Check

Check the deployed version by viewing the HTML source:

for env in inf dev tst; do
  echo -n "$env: "
  curl -s "https://$env.carpulsetracker.com/index.html" | grep -o 'content="v[^"]*"' | head -1
done
echo -n "prd: "
curl -s "https://carpulsetracker.com/index.html" | grep -o 'content="v[^"]*"' | head -1

Or in a browser: right-click > View Page Source > search for <meta name="version".


Version Bumping

cd /opt/bnc/bnc-cpt/bnc-cpt-utl

# Bump patch version (v1.0.1 -> v1.0.2)
./run -a do_version_bump

# Bump minor version (v1.0.9 -> v1.1.0)
BUMP=minor ./run -a do_version_bump

# Push the new tag
git -C /opt/bnc/bnc-cpt/bnc-cpt-wui push origin <new-tag>

The version is injected into the HTML at build time and becomes visible on the next deployment.


CDN Cache Invalidation

If users report seeing stale content after deployment:

# Single environment
ENV=dev
gcloud auth activate-service-account --key-file=$HOME/.gcp/.bnc/key-bnc-cpt-$ENV.json
gcloud compute url-maps invalidate-cdn-cache bnc-cpt-${ENV}-wui-https-url-map \
  --path="/*" --project=bnc-cpt-$ENV

# All environments
for env in inf dev tst prd; do
  gcloud auth activate-service-account --key-file=$HOME/.gcp/.bnc/key-bnc-cpt-${env}.json 2>/dev/null
  gcloud compute url-maps invalidate-cdn-cache bnc-cpt-${env}-wui-https-url-map \
    --path="/*" --project=bnc-cpt-${env}
done

GCS Bucket Operations

List Files in Bucket

ENV=dev
gcloud auth activate-service-account --key-file=$HOME/.gcp/.bnc/key-bnc-cpt-$ENV.json
gsutil ls gs://bnc-cpt-${ENV}-site-static/

View Bucket Size

gsutil du -sh gs://bnc-cpt-${ENV}-site-static/

Troubleshooting

Site Shows Old Content

  1. Check that the deployment succeeded (GitHub Actions)
  2. Invalidate CDN cache (see above)
  3. Try incognito/private browser window
  4. Check index.html version: curl -s https://dev.carpulsetracker.com/index.html | grep version

Site Returns 404 or 503

  1. Verify GCS bucket has files: gsutil ls gs://bnc-cpt-dev-site-static/
  2. Verify load balancer is configured: check GCP Console > Network Services > Load Balancing
  3. Verify SSL certificate is active: check GCP Console > Network Security > Certificate Manager

Deployment Fails in GitHub Actions

  1. Check workflow logs: gh run view --log-failed --repo csitea/bnc-cpt-wui
  2. Common issues:
  3. GCP auth failure: Verify GCP_SA_KEY_* secrets are set correctly
  4. Container build failure: Check Docker build logs in the workflow
  5. gsutil sync failure: Verify GCS bucket exists (Terraform step 015)

API Calls Failing (CORS)

If the frontend loads but API calls fail with CORS errors: 1. Check the API's CORS configuration matches the WUI domain 2. Verify the correct VITE_API_BASE_URL was used during build