This page documents how to set up a Bash script to keep your Phanpy instance (web client for Mastodon) up to date by monitoring official releases on GitHub.
The script uses curl to query the GitHub API. On minimal installations (such as Debian LXC templates), this dependency might be missing.
apt update && apt install curl -y
Note: While there is no official Docker image for Phanpy (as it consists of static files), you can find my Docker guides for other services here: Installing Docker, Portainer, and LXC on Debian and Proxmox.
You need to create a dedicated folder for your scripts and initialize a version file so the script can compare your local installation with the latest GitHub release.
mkdir -p /root/scripts
echo "2025.11.26.ac85274" > /var/www/html/.phanpy_version
nano /root/scripts/update_phanpy.sh
#!/bin/bash
# Automatic update script for Phanpy
# Author: Amaury aka BlablaLinux
REPO="cheeaun/phanpy"
INSTALL_DIR="/var/www/html"
VERSION_FILE="$INSTALL_DIR/.phanpy_version"
FILENAME="phanpy-dist.tar.gz"
echo "--- Starting Phanpy update check ---"
# Fetch the latest stable release tag via GitHub API
LATEST_RELEASE=$(curl -s https://api.github.com/repos/$REPO/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$LATEST_RELEASE" ]; then
echo "Error: Unable to reach GitHub API."
exit 1
fi
# Fetch the local version
CURRENT_VERSION=$([ -f "$VERSION_FILE" ] && cat "$VERSION_FILE" || echo "none")
if [ "$LATEST_RELEASE" == "$CURRENT_VERSION" ]; then
echo "Phanpy is already up to date ($CURRENT_VERSION)."
exit 0
fi
echo "New version detected: $LATEST_RELEASE. Updating..."
TEMP_DIR=$(mktemp -d)
URL="https://github.com/$REPO/releases/download/$LATEST_RELEASE/$FILENAME"
if curl -L -s -o "$TEMP_DIR/$FILENAME" "$URL"; then
# Preventive cleanup of old files to avoid asset conflicts
# Deletes everything in /var/www/html except the version file itself
find "$INSTALL_DIR" -mindepth 1 -not -name '.phanpy_version' -delete
# Extract the new version
tar -xzf "$TEMP_DIR/$FILENAME" -C "$INSTALL_DIR"
# Update the local version tag
echo "$LATEST_RELEASE" > "$VERSION_FILE"
echo "Update to $LATEST_RELEASE completed successfully."
else
echo "Error while downloading the archive."
exit 1
fi
rm -rf "$TEMP_DIR"
chmod +x /root/scripts/update_phanpy.sh
Run the script manually once to ensure the deployment works as expected:
/root/scripts/update_phanpy.sh
Once the script has finished, verify that the version file has been updated with the latest GitHub tag:
cat /var/www/html/.phanpy_version
To automate the check every night at 04:15 AM and generate a log file:
crontab -e
15 4 * * * /bin/bash /root/scripts/update_phanpy.sh > /var/log/phanpy_update.log 2>&1