feat:web build cicd and backend - #10
Conversation
Introduces a production-ready workflow for deploying the backend to a GCP VM using Docker and SSH with GitHub Actions. Includes detailed deployment and server setup guides, supporting scripts, and clarifies deployment documentation for both frontend and backend. Streamlines CI by improving backend linting, adjusts Go tooling installation, and updates ignore rules. Enhances maintainability and enables consistent, auditable backend releases.
There was a problem hiding this comment.
Pull Request Overview
This pull request implements CI/CD infrastructure for both frontend and backend deployment, adding automated deployment pipelines and web build support. The changes enable manual deployment of the React Native Web frontend to Cloudflare Pages and the Nakama backend to GCP VMs.
- Added deployment automation with GitHub Actions workflows for both frontend and backend
- Configured React Native Web build support with Metro bundler and web-specific optimizations
- Created server setup scripts for automated GCP VM provisioning
Reviewed Changes
Copilot reviewed 14 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/server-deploy-setup.sh | Automated server provisioning script for GCP VM deployment |
| scripts/install-go-tools.sh | Updated Go tooling installation to use Homebrew for golangci-lint |
| scripts/gcp-vm-setup.sh | Quick setup script for GCP VM minimal Ubuntu installations |
| frontend/package.json | Added web build scripts and dependencies for React Native Web |
| frontend/metro.config.js | Metro bundler configuration with web platform support and SVG handling |
| frontend/index.web.ts | Web-specific entry point with touch handling and viewport optimizations |
| frontend/app.json | Enhanced web configuration with PWA settings |
| backend/.golangci.yml | Updated linting configuration with proper exclusion paths |
| DEPLOYMENT.md | Comprehensive deployment documentation for frontend |
| BACKEND_DEPLOYMENT.md | Detailed backend deployment guide with troubleshooting |
| .github/workflows/deploy-frontend.yml | GitHub Actions workflow for frontend deployment to Cloudflare Pages |
| .github/workflows/deploy-backend.yml | GitHub Actions workflow for backend deployment to GCP VM |
| .github/workflows/ci.yml | Updated CI workflow to use golangci-lint GitHub Action |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| nano setup_script.sh | ||
| # Paste the following content of server-deploy-setup.sh and save the file |
There was a problem hiding this comment.
This manual copy-paste step is error-prone and defeats automation. Consider directly downloading the script with curl or wget instead of requiring manual content copying.
| nano setup_script.sh | |
| # Paste the following content of server-deploy-setup.sh and save the file | |
| # Download the setup script directly (replace the URL with the actual location of server-deploy-setup.sh) | |
| curl -o setup_script.sh https://example.com/path/to/server-deploy-setup.sh |
| config.resolver.assetExts = config.resolver.assetExts.filter((ext) => ext !== 'svg'); | ||
| config.resolver.sourceExts.push('svg'); |
There was a problem hiding this comment.
The SVG handling configuration modifies the asset extensions after they were already extended earlier in the file (lines 13-33). This creates a dependency on order of operations that could be fragile if the configuration is refactored.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting
| echo "📝 Commit: ${{ steps.branch-info.outputs.COMMIT_SHORT }}" | ||
| echo "🎯 Environment: ${{ github.event.inputs.environment }}" | ||
| echo "💾 Backup location: $BACKUP_DIR" |
There was a problem hiding this comment.
[P0] Remove undefined variable reference in backend deploy script
The SSH deployment step executes with set -euo pipefail (line 53), so any access to an unset variable terminates the script. Later it prints echo "💾 Backup location: $BACKUP_DIR", but BACKUP_DIR is never assigned. Every run will therefore crash during the summary phase even if the containers were rebuilt successfully, causing the workflow to fail. Define the variable or drop the echo to allow deployments to finish.
Useful? React with 👍 / 👎.
| # Install golangci-lint | ||
| # docs: https://golangci-lint.run/docs/welcome/install/#local-installation | ||
| # For Mac OS | ||
| brew install golangci-lint | ||
| brew upgrade golangci-lint |
There was a problem hiding this comment.
[P1] Avoid Homebrew-only install in cross-platform Go tool script
scripts/install-go-tools.sh now installs golangci-lint exclusively via brew install/brew upgrade without checking the OS. The script is referenced in the setup instructions and is expected to run in CI and on Linux hosts, where Homebrew is not available. Running it there now exits with brew: command not found, leaving required lint tooling uninstalled. Revert to a go install based installation or gate the Homebrew commands behind a macOS check.
Useful? React with 👍 / 👎.
🚀 CI/CD Pipeline Improvements and Modernization
📋 Overview
This PR introduces significant improvements to our CI/CD pipeline, modernizing our build processes, enhancing deployment workflows, and adopting industry best practices for both frontend and backend deployments.
🔧 Key Changes
1. Modernized Backend Linting in CI
golangci/golangci-lint-action@v6contents: read,pull-requests: read)only-new-issues: truefor PR-friendly lintingworking-directory: backendfor monorepo support2. Updated golangci-lint Configuration
issues.exclude-dirsissues.exclude-fileslinters.exclusions.pathsstructure3. Enhanced Backend Deployment Workflow
deploy-backend.yml)4. Frontend Deployment to Cloudflare Pages
🎯 Benefits
CI Pipeline Improvements
Deployment Improvements
Configuration Modernization
🔄 Migration Details
Before (Custom Approach)
After (Modern Approach)
🧪 Testing
📚 References