Upgraded my #Friendica. I used the following script to minimize disruption, which assumes the installation is in /var/www/$SITE
, daemon.php
rather than worker.php
is used and both git repositories are already on the correct branch (e.g. stable
):
#!/bin/bash
SITE=friendica.gidikroon.eu
ADDONDIR=addon
sudo -Hu www-data sh -c "cd ~/$SITE \
&& /usr/bin/php ~/$SITE/bin/daemon.php stop \
&& git fetch origin \
&& (cd $ADDONDIR && git fetch origin) \
&& git merge --ff-only \
&& (cd $ADDONDIR && git merge --ff-only) \
&& bin/composer.phar install --no-dev \
&& /usr/bin/php ~/$SITE/bin/daemon.php start"
The main difference between this and the documented upgrade procedure is splitting the fetch and the merge steps, to avoid having old addons running on a new main in case of a slow network, and doing the composer step with updated addons included. The main purpose of the script is so I don't forget to stop the daemon processes or to update the addons.
When the current branch is a release candidate branch, but the release has happened and I want to switch to stable
, I use this script to avoid jumping back to the previous release during the process:
#!/bin/bash
SITE=friendica-dev.gidikroon.eu
# For when the current branch is a release candidate and the actual release has just been released,
# or for when the current branch is 'stable' and a release candidate has been branched off.
NEWBRANCH=stable
ADDONDIR=addon
sudo -Hu www-data sh -c "cd ~/$SITE \
&& /usr/bin/php ~/$SITE/bin/daemon.php stop \
&& git fetch origin $NEWBRANCH:$NEWBRANCH \
&& (cd $ADDONDIR && git fetch origin $NEWBRANCH:$NEWBRANCH) \
&& git switch $NEWBRANCH \
&& (cd $ADDONDIR && git switch $NEWBRANCH) \
&& bin/composer.phar install --no-dev \
&& /usr/bin/php ~/$SITE/bin/daemon.php start"
A very similar script I used for Osada and Zap, assuming its repositories are already on the target branches (e.g. release
):
#!/bin/bash
SITE=osada.gidikroon.eu
ADDONDIR=extend/addon/zaddons
sudo -Hu www-data sh -c "cd ~/$SITE \
&& git fetch origin \
&& (cd $ADDONDIR && git fetch origin) \
&& git merge --ff-only \
&& (cd $ADDONDIR && git merge --ff-only) \
&& composer install --no-dev"