Skip to content

Beta deploy automation: beta app connection triggers Pi branch switch #34

Description

@Qddog23

Overview

When opening the beta TestFlight build of PitMissionController, the app should automatically trigger the Pi server to switch to the ground-control branch and restart — no manual SSH or deploy steps needed.

Flow

  1. Beta app connects to the existing WebSocket server (running on main)
  2. During handshake it sends a {"type": "betaHandshake"} message
  3. Server detects it's a beta client, spawns a background subprocess:
    git checkout ground-control && git pull && cd CartInformationDisplays/frontend && npm run build && sudo systemctl restart missionControlServer.service
    
  4. Server restarts (~5–10s), now on ground-control
  5. App auto-reconnects (reconnect logic already exists in WebsocketEngine.swift)

Switching back to production works in reverse — the production build sends a prodHandshake, server redeploys main.

Implementation notes

  • WebSocketManager.reconnect() already handles reconnection with a 2s delay, so no iOS changes needed for the reconnect behavior
  • On reconnect, stateL/stateR reset to .Screensaver — expected behavior during a deliberate deploy
  • Guard: only trigger the deploy if the server isn't already on the target branch (git branch --show-current) to avoid redundant redeploys when opening the app multiple times
  • The Pi's IP is stable at 192.168.105.10 on the competition hotspot, so the endpoint is persistent — no Remote.it or dynamic DNS needed

Files to change

  • CartInformationDisplays/main.py (or relevant routing file) — add betaHandshake / prodHandshake message handlers that spawn the deploy subprocess
  • PitMissionController/RequestRouter.swift — send betaHandshake on connect (for beta build; prodHandshake for production build)
  • Deploy script on Pi — git checkout <branch> && git pull && npm run build && systemctl restart

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions