Skip to content

Instantly share code, notes, and snippets.

@mriedmann
Created March 26, 2020 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mriedmann/d0cc8041d1374a38ae734ca2139498ef to your computer and use it in GitHub Desktop.
Save mriedmann/d0cc8041d1374a38ae734ca2139498ef to your computer and use it in GitHub Desktop.
humhub-docker update script
#!/bin/bash
set -eo pipefail
CUR_VERSION=$(grep 'ARG HUMHUB_VERSION=' Dockerfile | tr "=" "\n" | tail -n 1)
NEW_VERSION=${NEW_VERSION:-$(curl -s https://api.github.com/repos/humhub/humhub/releases | jq -r '.[0] | .name')}
if [ "$CUR_VERSION" == "$NEW_VERSION" ]; then
echo "no update needed"
exit 0
else
echo "updating from $CUR_VERSION to $NEW_VERSION"
fi
GIT_BRANCH="update-$NEW_VERSION"
git branch $GIT_BRANCH || true
git checkout $GIT_BRANCH
sed -i -e "s/ARG HUMHUB_VERSION=[0-9\.]*/ARG HUMHUB_VERSION=$NEW_VERSION/" Dockerfile
for LINE in 'humhub:$V' '\`$V\`'
do
S="s/"
for V in $CUR_VERSION $NEW_VERSION; do
S+="$(eval echo $LINE)/"
done
S+="g"
echo $S
sed -i -e "$S" README.md
done
git add Dockerfile
git add README.md
@alexszilagyi
Copy link

@mriedmann: Does this script handles step by step update? I'm running an old version does it loops through the versions and applies to each version the changes needed?

@mriedmann
Copy link
Author

mriedmann commented May 27, 2020

Hi! No, this script is used to automate updates of the image itself if the humhub-team releases a new version. This has nothing to do with application (humhub) updates.
For updating humhub it should be sufficient to pull the new version and start it, targeting the same data folders and database. It should then apply the needed database updates automatically (always do backups!).

@alexszilagyi
Copy link

alexszilagyi commented May 27, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment