Robocubs / Robocubs/RobocubsMissionControl

Beta deploy automation: beta app connection triggers Pi branch switch

Open
#34 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with CartInformationDisplays/main.py and PitMissionController/RequestRouter.swift, then review the existing WebsocketEngine.swift reconnect behavior. Trace the handshake path and the Pi deploy script, including the target-branch guard. Done means beta and production handshakes trigger the appropriate deployment and the app reconnects after the server restart.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python, swift
Domain
backend, devops, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.