Add DataImporter to Firefly

This commit is contained in:
tremor021 2025-06-15 22:01:17 +02:00
parent 5498c05cf3
commit 32280a762f

View File

@ -43,6 +43,7 @@ mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRI
msg_ok "Set up database"
msg_info "Installing Firefly III (Patience)"
LOCAL_IP=$(hostname -I | awk '{print $1}')
RELEASE=$(curl -fsSL https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
cd /opt
curl -fsSL "https://github.com/firefly-iii/firefly-iii/releases/download/v${RELEASE}/FireflyIII-v${RELEASE}.tar.gz" -o "FireflyIII-v${RELEASE}.tar.gz"
@ -61,6 +62,14 @@ $STD php artisan firefly:upgrade-database
$STD php artisan firefly:correct-database
$STD php artisan firefly:report-integrity
$STD php artisan firefly:laravel-passport-keys
IMPORTER_RELEASE=$(curl -fsSL https://api.github.com/repos/firefly-iii/data-importer/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
mkdir -p /opt/firefly/dataimporter
cd /opt
curl -fsSL "https://github.com/firefly-iii/data-importer/releases/download/v${IMPORTER_RELEASE}/DataImporter-v${IMPORTER_RELEASE}.tar.gz" -o "DataImporter-v${IMPORTER_RELEASE}.tar.gz"
tar -xzf "DataImporter-v${IMPORTER_RELEASE}.tar.gz" -C /opt/firefly/dataimporter
cp /opt/firefly/dataimporter/.env.example /opt/firefly/dataimporter/.env
sed -i "s#FIREFLY_III_URL=#FIREFLY_III_URL=http://${LOCAL_IP}#g" /opt/firefly/dataimporter/.env
chown -R www-data:www-data /opt/firefly
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Installed Firefly III"
@ -76,6 +85,17 @@ cat <<EOF >/etc/apache2/sites-available/firefly.conf
Require all granted
</Directory>
Alias /dataimporter/ /opt/firefly/dataimporter/public/
<Directory /opt/firefly/dataimporter/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
@ -93,7 +113,8 @@ motd_ssh
customize
msg_info "Cleaning up"
rm -rf /opt/FireflyIII-v${RELEASE}.tar.gz
rm -rf "/opt/FireflyIII-v${RELEASE}.tar.gz"
rm -rf "/opt/DataImporter-v${IMPORTER_RELEASE}.tar.gz"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"