Browse Source

make upgrade script

master
tykayn 8 months ago
committed by Baptiste Lemoine
parent
commit
eeec1cc9f7
  1. 55
      upgrade/upgrade.sh

55
upgrade/upgrade.sh

@ -0,0 +1,55 @@
#!/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/$FRAMAGIT_PROJECT_ID/releases | jshon -a -e name|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
Loading…
Cancel
Save