Dépôt d'outils pour le service mobilizon.chapril.org. https://mobilizon.chapril.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.7 KiB

#!/bin/bash
# upgrade du mobilizon du Chapril
LOCAL_REPO=/srv/mobilizon.chapril.org/live
echo "========================= "
echo "=§= Upgrade de mobilizon "
echo "========================= "
echo " "
echo " https://docs.joinmobilizon.org/administration/upgrading/ "
echo " "
echo "=§= récupération du tag le plus récent"
echo " "
cd LOCAL_REPO
git fetch --tags
lastVersion=$(curl -s https://framagit.org/api/v4/projects/20125/releases | jshon -a -e name 2>/dev/null | sed -e "/rc/d" | cut -d '"' -f2 | grep -v '[\^\(alpha\)]'|head -n 1)
currentVersion=$(cd $LOCAL_REPO && git branch | grep '*'|cut -c 3-100 )
if [ $currentVersion = $lastVersion ]; then
echo " "
echo "=§= pas besoin de mettre à jour, la version actuelle est déjà la plus récente"
echo " "
exit 0
else
echo "UPGRADE : récupération de la version $lastVersion."
git status
git checkout $lastVersion
echo " "
echo "=§= stopper le service"
echo " "
service mobilizon stop
echo " "
echo "=§= recompiler le front end"
echo " "
cd js
NODE_BUILD_MEMORY=1024 yarn run build
echo " "
echo "=§= recompiler les elixirs du backend"
echo " "
cd ..
MIX_ENV=prod mix compile
echo " "
echo "=§= migration de la base de données"
echo " "
MIX_ENV=prod mix ecto.migrate
echo " "
echo "=§= migration de la base de données"
echo " "
service mobilizon start
journalctl -fu mobilizon.service
# pour créer un utilisateur vous pouvez lancer cette commande
# MIX_ENV=prod mix mobilizon.users.new "your@email.com" --admin --password "Y0urP4ssw0rd"
fi