Files

2.5 KiB

Manual Agent Upgrade Guide (v0.1.23 → v0.2.0)

⚠️ FOR DEVELOPER USE ONLY - One-Time Upgrade

You're reading this because you have a v0.1.23 agent (no auto-update capability) and need to manually upgrade to v0.2.0. Everyone else gets v0.2.0 fresh with auto-update built-in.

Quick Upgrade (Linux/Fedora)

# On build machine / server:
# 1. Build and sign v0.2.0 agent for linux/amd64
./build.sh linux amd64 0.2.0

# 2. Copy binary to Fedora machine
scp redflag-agent-linux-amd64-v0.2.0 memory@fedora:/tmp/

# On Fedora machine:
# 3. Stop agent service
sudo systemctl stop redflag-agent

# 4. Backup current binary (just in case)
sudo cp /usr/local/bin/redflag-agent /usr/local/bin/redflag-agent.v0.1.23.backup

# 5. Install new binary
sudo cp /tmp/redflag-agent-linux-amd64-v0.2.0 /usr/local/bin/redflag-agent
sudo chmod +x /usr/local/bin/redflag-agent

# 6. Update config version manually
sudo sed -i 's/"version": "0.1.23"/"version": "0.2.0"/' /etc/redflag/config.json

# 7. Restart service
sudo systemctl start redflag-agent

# 8. Verify
/usr/local/bin/redflag-agent --version  # Should show v0.2.0
sudo systemctl status redflag-agent     # Should be running

Alternative: Use Download Endpoint

If you have a signed v0.2.0 package in the database:

# On Fedora machine:
cd /tmp
wget https://your-server.com/api/v1/download/linux/amd64?version=0.2.0 -O redflag-agent-v0.2.0

# Then follow steps 3-8 above

Verify Update Capability

After upgrading, test that the agent can now receive updates:

# Check agent version in database
psql -U redflag -c "SELECT version FROM agents WHERE agent_id = 'your-agent-id'"
# Should show: 0.2.0

# Trigger a test update from UI
# Should now work (nonce generation → update command → agent pickup)

Troubleshooting

Agent fails to start:

# Check logs
sudo journalctl -u redflag-agent -f

# Rollback if needed
sudo cp /usr/local/bin/redflag-agent.v0.1.23.backup /usr/local/bin/redflag-agent
sudo systemctl restart redflag-agent

Version mismatch error:

# Manual config update didn't work
sudo nano /etc/redflag/config.json
# Change "version": "0.1.23" → "0.2.0"
sudo systemctl restart redflag-agent

After Manual Upgrade

Once on v0.2.0, you never need to do this again. Future upgrades work automatically:

  1. Server builds and signs v0.2.1
  2. You click "Update Agent" in UI
  3. Agent receives nonce → downloads → verifies signature → installs → restarts

Manual upgrade only needed this one time because v0.1.23 predates the update system.