From e6c21811bb2f27c3e976ace33e57b8822fbf691b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Mon, 16 Jun 2025 07:31:22 +0200 Subject: [PATCH] Firefly: Add Data Importer to LXC (#5159) * Add Data Importer to Firefly LXC * Remove useless var --- ct/firefly.sh | 2 +- frontend/public/json/firefly.json | 4 ++++ install/firefly-install.sh | 28 ++++++++++++++++++++++++---- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/ct/firefly.sh b/ct/firefly.sh index 1471f3fb28..1c646e3aac 100644 --- a/ct/firefly.sh +++ b/ct/firefly.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG -# Author: quantumryuu +# Author: quantumryuu | Co-Author: Slaviša Arežina (tremor021) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://firefly-iii.org/ diff --git a/frontend/public/json/firefly.json b/frontend/public/json/firefly.json index 4c8d232f84..cff7e2b9f0 100644 --- a/frontend/public/json/firefly.json +++ b/frontend/public/json/firefly.json @@ -32,6 +32,10 @@ "password": null }, "notes": [ + { + "text": "Data Importer is at `http:///dataimporter/`", + "type": "info" + }, { "text": "Database credentials: `cat ~/firefly.creds`", "type": "info" diff --git a/install/firefly-install.sh b/install/firefly-install.sh index c10e9ca8e2..82082d76b4 100644 --- a/install/firefly-install.sh +++ b/install/firefly-install.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Copyright (c) 2021-2025 community-scripts ORG -# Author: quantumryuu +# Author: quantumryuu | Co-Author: Slaviša Arežina (tremor021) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://firefly-iii.org/ @@ -30,7 +30,6 @@ msg_info "Setting up database" DB_NAME=firefly DB_USER=firefly DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) -MYSQL_VERSION=$(mariadb --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n1) $STD mariadb -u root -e "CREATE DATABASE $DB_NAME;" $STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';" mariadb -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 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 +61,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" @@ -75,7 +83,18 @@ cat </etc/apache2/sites-available/firefly.conf AllowOverride All Require all granted - + + Alias /dataimporter/ /opt/firefly/dataimporter/public/ + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + + SetHandler application/x-httpd-php + + ErrorLog /var/log/apache2/error.log CustomLog /var/log/apache2/access.log combined @@ -93,7 +112,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"