deploy-phoenix-client

majiayu000 的头像作者 majiayu000

使用 PHOENIX BACKEND 配置(shot-client-phoenix 应用程序)将 shot-client-next 前端部署到 Fly.io。在部署连接到位于 shot-elixir.fly.dev 的 Elixir/Phoenix 后端的生产前端时,请使用此技能。

📖 中文导读:使用 PHOENIX BACKEND 配置(shot-client-phoenix 应用程序)将 shot-client-next 前端部署到 Fly.io。在部署连接到位于 shot-elixir.fly.dev 的 Elixir/Phoenix 后端的生产前端时,请使用此技能。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: deploy-phoenix-client description: Deploy the shot-client-next frontend to Fly.io using PHOENIX BACKEND configuration (shot-client-phoenix app). Use this skill when deploying the production frontend that connects to the Elixir/Phoenix backend at shot-elixir.fly.dev.

Deploy Phoenix Frontend Client to Fly.io

⚠️ IMPORTANT: This deploys to the PHOENIX backend configuration

This skill deploys the Next.js frontend configured to connect to the Elixir/Phoenix backend at shot-elixir.fly.dev.

  • Fly.io App: shot-client-phoenix
  • Config File: fly-phoenix.toml
  • Backend: Phoenix/Elixir (shot-elixir.fly.dev)
  • WebSocket: Phoenix Channels at wss://shot-elixir.fly.dev/socket
  • Environment: NEXT_PUBLIC_BACKEND_TYPE=phoenix

Quick Deployment

cd /Users/isaacpriestley/tech/isaacpriestley/chi-war/shot-client-next
./deploy_phoenix.sh

Manual Deployment Steps

# Navigate to shot-client-next
cd /Users/isaacpriestley/tech/isaacpriestley/chi-war/shot-client-next

# Verify build succeeds
npm run build

# Deploy to Fly.io with Phoenix configuration
fly deploy --app shot-client-phoenix -c fly-phoenix.toml

# Monitor deployment
fly logs --app shot-client-phoenix

# Verify health
curl https://shot-client-phoenix.fly.dev

When to Use This Skill

Use this skill when:

  • Deploying frontend changes to production (Phoenix backend is primary)
  • User says "deploy to production"
  • User says "deploy the frontend" or "deploy the client"
  • User says "deploy Phoenix client"
  • Releasing UI updates to the live application

Environment Variables (fly-phoenix.toml)

These are configured in the build args:

  • NEXT_PUBLIC_API_BASE_URL=https://shot-elixir.fly.dev
  • NEXT_PUBLIC_SERVER_URL=https://shot-elixir.fly.dev
  • NEXT_PUBLIC_WEBSOCKET_URL=wss://shot-elixir.fly.dev
  • NEXT_PUBLIC_BACKEND_TYPE=phoenix ← Critical for Phoenix channels

Post-Deployment Verification

After deployment, verify:

  1. WebSocket connection uses Phoenix Channels (not Rails ActionCable /cable)
  2. Check browser console for: [PhoenixChannelClient] Socket connection opened
  3. NO errors about /cable endpoint
  4. Factions dropdown doesn't spin endlessly
  5. Real-time fight updates work correctly

Troubleshooting

WebSocket connects to /cable instead of /socket:

  • Verify NEXT_PUBLIC_BACKEND_TYPE=phoenix is set in fly-phoenix.toml
  • Check build logs show Phoenix backend configuration
  • Clear browser cache and hard reload

Build fails:

  • Check npm run build succeeds locally
  • Review TypeScript errors
  • Check fly logs --app shot-client-phoenix
  • deploy-rails-client - Deploy frontend with Rails backend (legacy)
  • deploy-shot-elixir - Deploy the Phoenix/Elixir backend