11#! /usr/bin/env bash
22
33# Copyright (c) 2021-2025 community-scripts ORG
4- # Author: quantumryuu
4+ # Author: quantumryuu | Co-Author: Slaviša Arežina (tremor021)
55# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
66# Source: https://firefly-iii.org/
77
@@ -30,7 +30,6 @@ msg_info "Setting up database"
3030DB_NAME=firefly
3131DB_USER=firefly
3232DB_PASS=$( openssl rand -base64 18 | tr -dc ' a-zA-Z0-9' | head -c13)
33- MYSQL_VERSION=$( mariadb --version | grep -oE ' [0-9]+\.[0-9]+\.[0-9]+' | head -n1)
3433$STD mariadb -u root -e " CREATE DATABASE $DB_NAME ;"
3534$STD mariadb -u root -e " CREATE USER '$DB_USER '@'localhost' IDENTIFIED BY '$DB_PASS ';"
3635mariadb -u root -e " GRANT ALL ON $DB_NAME .* TO '$DB_USER '@'localhost'; FLUSH PRIVILEGES;"
@@ -43,6 +42,7 @@ mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRI
4342msg_ok " Set up database"
4443
4544msg_info " Installing Firefly III (Patience)"
45+ LOCAL_IP=$( hostname -I | awk ' {print $1}' )
4646RELEASE=$( curl -fsSL https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4)}' )
4747cd /opt
4848curl -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 +61,14 @@ $STD php artisan firefly:upgrade-database
6161$STD php artisan firefly:correct-database
6262$STD php artisan firefly:report-integrity
6363$STD php artisan firefly:laravel-passport-keys
64+ 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)}' )
65+ mkdir -p /opt/firefly/dataimporter
66+ cd /opt
67+ 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"
68+ tar -xzf " DataImporter-v${IMPORTER_RELEASE} .tar.gz" -C /opt/firefly/dataimporter
69+ cp /opt/firefly/dataimporter/.env.example /opt/firefly/dataimporter/.env
70+ sed -i " s#FIREFLY_III_URL=#FIREFLY_III_URL=http://${LOCAL_IP} #g" /opt/firefly/dataimporter/.env
71+ chown -R www-data:www-data /opt/firefly
6472echo " ${RELEASE} " > " /opt/${APPLICATION} _version.txt"
6573msg_ok " Installed Firefly III"
6674
@@ -75,7 +83,18 @@ cat <<EOF >/etc/apache2/sites-available/firefly.conf
7583 AllowOverride All
7684 Require all granted
7785 </Directory>
78-
86+
87+ Alias /dataimporter/ /opt/firefly/dataimporter/public/
88+
89+ <Directory /opt/firefly/dataimporter/public/>
90+ Options Indexes FollowSymLinks
91+ AllowOverride All
92+ Require all granted
93+ </Directory>
94+ <FilesMatch \.php$>
95+ SetHandler application/x-httpd-php
96+ </FilesMatch>
97+
7998 ErrorLog /var/log/apache2/error.log
8099 CustomLog /var/log/apache2/access.log combined
81100
@@ -93,7 +112,8 @@ motd_ssh
93112customize
94113
95114msg_info " Cleaning up"
96- rm -rf /opt/FireflyIII-v${RELEASE} .tar.gz
115+ rm -rf " /opt/FireflyIII-v${RELEASE} .tar.gz"
116+ rm -rf " /opt/DataImporter-v${IMPORTER_RELEASE} .tar.gz"
97117$STD apt-get -y autoremove
98118$STD apt-get -y autoclean
99119msg_ok " Cleaned"
0 commit comments