Skip to content

Upgrade and Migration

Chris Nighswonger edited this page Mar 2, 2026 · 1 revision

Upgrade and Migration

This page describes safe upgrade and host-move workflows for Kanfei.

Scope

Covers:

  • migrating from the davis-wx alpha package
  • in-place upgrades between beta releases
  • migration to a new host
  • validation steps after cutover

Migrating from davis-wx (alpha)

If upgrading from the davis-wx alpha package, do not uninstall davis-wx before copying your data.

  1. Stop the old services:

    sudo systemctl stop davis-wx-web davis-wx-logger
    sudo systemctl disable davis-wx-web davis-wx-logger
  2. Install the new package:

    sudo apt install ./kanfei_0.1.0.beta3_all.deb
  3. Stop the new services while you copy data:

    sudo systemctl stop kanfei-web kanfei-logger
  4. Copy your database and backgrounds:

    sudo cp /var/lib/davis-wx/weather.db /var/lib/kanfei/kanfei.db
    sudo cp -r /var/lib/davis-wx/backgrounds/* /var/lib/kanfei/backgrounds/ 2>/dev/null || true
    sudo chown -R kanfei:kanfei /var/lib/kanfei
  5. Copy your configuration from /etc/davis-wx/davis-wx.conf to /etc/kanfei/kanfei.conf. The format is the same — all variables now use the KANFEI_ prefix.

  6. Start the new services:

    sudo systemctl start kanfei-logger kanfei-web
  7. Verify at http://localhost:8000 — historical data, settings, and dashboard layout should be preserved.

  8. Once verified, remove the old package:

    sudo apt purge davis-wx

Upgrading Between Beta Releases

No database migration is required between beta releases. The .deb package is a drop-in replacement:

sudo apt install ./kanfei_0.1.0.beta3_all.deb

After upgrading, check for new features in the release notes (e.g., enable automatic backups in Settings > Backup after upgrading to beta3).

In-Place Upgrade Checklist (from source)

  1. Record current version/commit and service state.
  2. Create a backup: python station.py backup
  3. Stop running services/processes.
  4. Deploy new code (git pull or new package).
  5. Start services/processes.
  6. Validate core functionality.

Validation After Upgrade

Minimum checks:

curl -s http://localhost:8000/api/station | jq .
curl -s http://localhost:8000/api/current | jq .
curl -s http://localhost:8000/api/config | jq 'length'

UI checks:

  • dashboard loads
  • live updates flowing
  • Settings page renders and saves

Optional feature checks:

  • nowcast endpoints if enabled
  • spray workflows if enabled
  • upload integrations if enabled

Migration to New Host

1. Prepare Destination

  • install prerequisites (Python/Node or package runtime)
  • deploy Kanfei code/package
  • confirm runtime user and hardware access (serial device permissions or network reachability)

2. Transfer Data

Move these from source to destination:

  • SQLite DB file (db_path)
  • .env
  • custom background assets directory (if used)

Preserve ownership and permissions.

3. Cutover

  1. Stop source instance.
  2. Ensure DB is fully copied.
  3. Start destination instance.
  4. Validate endpoints/UI.

4. Revalidate Hardware Connection

After migration to a new host:

  • verify serial port assignments if using serial hardware (device paths may differ)
  • verify network station reachability from the new host
  • rerun setup/auto-detect if connection parameters differ
  • confirm /api/station shows healthy connection

5. Post-Cutover Verification

  • station reconnects and polls successfully
  • timestamps in /api/current are fresh
  • expected config values present
  • optional integrations behave as expected

Rollback Plan

If upgrade fails:

  1. stop upgraded instance
  2. restore prior DB + config backup
  3. restart previous known-good build
  4. re-validate /api/station and /api/current

Notes

  • Keep schema-affecting upgrades paired with tested restore points.
  • If moving across architectures/OS variants, run a full smoke test before production cutover.

Related Pages

Clone this wiki locally