Skip to content

Instantly share code, notes, and snippets.

@Erulezz
Last active April 7, 2024 11:12
Show Gist options
  • Save Erulezz/e32a37fa2ecfb9bde5ba93abd53dcfc4 to your computer and use it in GitHub Desktop.
Save Erulezz/e32a37fa2ecfb9bde5ba93abd53dcfc4 to your computer and use it in GitHub Desktop.
Update firefly-iii script
#!/bin/bash
# Remove old version of firefly-iii
rm -r firefly-iii-old
# Get latest version number of firefly
latestversion=$(curl -s https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
# Download latest release version
wget https://github.com/firefly-iii/firefly-iii/releases/download/$latestversion/FireflyIII-$latestversion.zip
# Maintenance mode - enable
cd firefly-iii
/usr/local/php83/bin/php artisan down
cd ..
# Unzip latest version to new directory
unzip -q -o FireflyIII-$latestversion.zip -x "storage/*" -d firefly-iii-updated
# Copy old config files and storage folder
cp firefly-iii/.env firefly-iii-updated/.env
cp -r firefly-iii/storage firefly-iii-updated
# Update config and database
cd firefly-iii-updated
rm -rf bootstrap/cache/*
/usr/local/php83/bin/php artisan migrate --seed
/usr/local/php83/bin/php artisan firefly-iii:decrypt-all
/usr/local/php83/bin/php artisan cache:clear
/usr/local/php83/bin/php artisan firefly-iii:upgrade-database
/usr/local/php83/bin/php artisan firefly-iii:laravel-passport-keys
/usr/local/php83/bin/php artisan firefly-iii:correct-database
/usr/local/php83/bin/php artisan firefly-iii:report-integrity
/usr/local/php83/bin/php artisan cache:clear
# Serve next version
cd ..
mv firefly-iii firefly-iii-old
mv firefly-iii-updated firefly-iii
# Clean files not needed for production
cd firefly-iii
rm -r tests
rm releases.md
rm readme.md
rm COPYING
rm crowdin.yml
rm nginx_app.conf
rm sonar-project.properties
rm Procfile
cd ..
# Maintenance mode - disable
cd firefly-iii
/usr/local/php83/bin/php artisan up
cd ..
# Delete downloaded zip file
rm FireflyIII-$latestversion.zip
echo "Firefly Updated";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment