morphit/docs/MIGRATE-TO-RELEASE-TRACK.md

5.2 KiB

Moving a git-cloned install onto the release track

Who this is for: operators whose Morphit install came from git clone + git pull (rather than from extracting an official release tarball). If npx morphit-ops upgrade told you

[ERR] No release-info.json at <yourdir>/release-info.json

this page is for you. After a one-time manual step you'll be on the release track, and npx morphit-ops upgrade will work for every future version automatically.

Why this happens

morphit-ops upgrade reads a small file, release-info.json, at the root of your install to know which version you're running. That file is generated by the release build and baked into the official release tarball — it is not stored in the git repository, so a git clone/git pull install never has it. That's the whole reason the upgrade tool refuses to run on a cloned tree: it can't tell what version you're on.

The fix is to replace your cloned tree, one time, with the contents of an official release tarball (which contains release-info.json). Your config and keys are preserved.

Before you start — find your install directory

If you don't already know where Morphit is installed, ask the running services (this is the most reliable answer):

systemctl cat morphit-indexer morphit-relay 2>/dev/null \
  | grep -iE "WorkingDirectory|EnvironmentFile|User="
  • The WorkingDirectory= line is your install directory (used as INSTALL_DIR below).
  • The User= line is the service account that must own the files (used as SVC_USER below). If there is no User= line, the services run as root and you can skip the chown step.

Set both as shell variables so the rest of the commands are copy-paste safe (substitute your real values):

INSTALL_DIR=/opt/morphit          # whatever WorkingDirectory= showed
SVC_USER=morphit                  # whatever User= showed (or 'root')

The one-time migration

Run these as a user with sudo. Read each comment before you run the block.

# 1. Back up your config + keys (they live inside the install dir).
mkdir -p ~/morphit-config-backup
sudo cp "$INSTALL_DIR/morphit.config.env" ~/morphit-config-backup/
sudo cp "$INSTALL_DIR/morphit.env"        ~/morphit-config-backup/
sudo cp -r "$INSTALL_DIR/apps/relay/keystore."* ~/morphit-config-backup/ 2>/dev/null || true
sudo cp -r "$INSTALL_DIR/apps/relay/altnet"     ~/morphit-config-backup/ 2>/dev/null || true
sudo chown -R "$USER" ~/morphit-config-backup
ls -l ~/morphit-config-backup     # confirm your config + keystore are here

# 2. Download the latest release tarball + its checksum.
#    Get the exact asset URLs from the release page if these 404:
#    https://git.agorise.net/agorise/morphit/releases
cd /tmp
LATEST_TAG=$(curl -fsSL https://git.agorise.net/api/v1/repos/agorise/morphit/releases \
  | grep -oE '"tag_name":"[^"]+"' | head -1 | cut -d'"' -f4)
echo "Latest release tag: $LATEST_TAG"
curl -fLO "https://git.agorise.net/agorise/morphit/releases/download/$LATEST_TAG/morphit-$LATEST_TAG.tar.gz"
curl -fLO "https://git.agorise.net/agorise/morphit/releases/download/$LATEST_TAG/morphit-$LATEST_TAG.tar.gz.sha256"

# 3. Verify the download. This MUST print "OK". Stop if it doesn't.
sha256sum -c "morphit-$LATEST_TAG.tar.gz.sha256"

# 4. Stop the services.
sudo systemctl stop morphit-indexer morphit-relay
sudo systemctl stop morphit-matrix-bot 2>/dev/null || true

# 5. Move the old cloned tree aside and extract the release in its place.
sudo mv "$INSTALL_DIR" "${INSTALL_DIR}.old-clone-$(date +%s)"
sudo mkdir -p "$INSTALL_DIR"
sudo tar -xzf "/tmp/morphit-$LATEST_TAG.tar.gz" -C "$INSTALL_DIR"

# 6. Restore your config + keys into the new tree.
sudo cp ~/morphit-config-backup/morphit.config.env "$INSTALL_DIR/"
sudo cp ~/morphit-config-backup/morphit.env        "$INSTALL_DIR/"
sudo cp ~/morphit-config-backup/keystore.*         "$INSTALL_DIR/apps/relay/" 2>/dev/null || true
sudo cp -r ~/morphit-config-backup/altnet          "$INSTALL_DIR/apps/relay/" 2>/dev/null || true

# 7. Fix ownership (skip if your services run as root).
sudo chown -R "$SVC_USER:$SVC_USER" "$INSTALL_DIR"

# 8. Install dependencies and restart.
cd "$INSTALL_DIR"
sudo -u "$SVC_USER" npm ci --no-audit --no-fund || npm ci --no-audit --no-fund
sudo systemctl restart morphit-indexer morphit-relay
sudo systemctl restart morphit-matrix-bot 2>/dev/null || true

# 9. Confirm you're on the release track.
cat "$INSTALL_DIR/release-info.json"     # should show your tag, e.g. v1.0.0-beta.25
npx morphit-ops status                   # should run cleanly

From now on

You never git pull to upgrade again. To update to a future release, from your install directory:

npx morphit-ops upgrade

It downloads the new release, verifies it, backs up your current install, carries your config and keys forward automatically, and restarts your services. See UPGRADING.md for details.

If something looks wrong

Your old tree is still intact at ${INSTALL_DIR}.old-clone-<timestamp> and your config backup is at ~/morphit-config-backup. To roll back: stop the services, sudo rm -rf "$INSTALL_DIR", sudo mv the .old-clone-* directory back to $INSTALL_DIR, and restart. Nothing is deleted by this procedure — the old tree and the backup both remain until you remove them yourself.