Add Firefly refactor
This commit is contained in:
parent
fc39a320e5
commit
2d87551ea5
77
ct/firefly.sh
Normal file
77
ct/firefly.sh
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: quantumryuu
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://firefly-iii.org/
|
||||||
|
|
||||||
|
APP="Firefly"
|
||||||
|
var_tags="${var_tags:-finance}"
|
||||||
|
var_cpu="${var_cpu:-1}"
|
||||||
|
var_ram="${var_ram:-1024}"
|
||||||
|
var_disk="${var_disk:-2}"
|
||||||
|
var_os="${var_os:-debian}"
|
||||||
|
var_version="${var_version:-12}"
|
||||||
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
|
||||||
|
header_info "$APP"
|
||||||
|
variables
|
||||||
|
color
|
||||||
|
catch_errors
|
||||||
|
|
||||||
|
function update_script() {
|
||||||
|
header_info
|
||||||
|
check_container_storage
|
||||||
|
check_container_resources
|
||||||
|
|
||||||
|
if [[ ! -d /opt/firefly ]]; then
|
||||||
|
msg_error "No ${APP} Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
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)}')
|
||||||
|
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||||
|
msg_info "Stopping Apache2"
|
||||||
|
systemctl stop apache2
|
||||||
|
msg_ok "Stopped Apache2"
|
||||||
|
|
||||||
|
msg_info "Updating ${APP} to v${RELEASE}"
|
||||||
|
cp /opt/firefly/.env /opt/.env
|
||||||
|
cp -r /opt/firefly/storage /opt/storage
|
||||||
|
cd /opt
|
||||||
|
curl -fsSL "https://github.com/firefly-iii/firefly-iii/releases/download/v${RELEASE}/FireflyIII-v${RELEASE}.tar.gz" -o $(basename "https://github.com/firefly-iii/firefly-iii/releases/download/v${RELEASE}/FireflyIII-v${RELEASE}.tar.gz")
|
||||||
|
tar -xzf FireflyIII-v${RELEASE}.tar.gz -C /opt/firefly --exclude='storage'
|
||||||
|
cp /opt/.env /opt/firefly/.env
|
||||||
|
cp -r /opt/storage /opt/firefly/storage
|
||||||
|
cd /opt/firefly
|
||||||
|
chown -R www-data:www-data /opt/firefly
|
||||||
|
chmod -R 775 /opt/firefly/storage
|
||||||
|
$STD php artisan migrate --seed --force
|
||||||
|
$STD php artisan cache:clear
|
||||||
|
$STD php artisan view:clear
|
||||||
|
$STD php artisan firefly-iii:upgrade-database
|
||||||
|
$STD php artisan firefly-iii:laravel-passport-keys
|
||||||
|
echo "${RELEASE}" >"/opt/${APP}_version.txt"
|
||||||
|
msg_ok "Updated ${APP} to v${RELEASE}"
|
||||||
|
|
||||||
|
msg_info "Starting Apache2"
|
||||||
|
systemctl start apache2
|
||||||
|
msg_ok "Started Apache2"
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -rf /opt/FireflyIII-v${RELEASE}.tar.gz
|
||||||
|
msg_ok "Cleaned"
|
||||||
|
msg_ok "Updated Successfully"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at v${RELEASE}."
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
start
|
||||||
|
build_container
|
||||||
|
description
|
||||||
|
|
||||||
|
msg_ok "Completed Successfully!\n"
|
||||||
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|
99
install/firefly-install.sh
Normal file
99
install/firefly-install.sh
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: quantumryuu
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://firefly-iii.org/
|
||||||
|
|
||||||
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
|
color
|
||||||
|
verb_ip6
|
||||||
|
catch_errors
|
||||||
|
setting_up_container
|
||||||
|
network_check
|
||||||
|
update_os
|
||||||
|
|
||||||
|
msg_info "Installing Dependencies"
|
||||||
|
curl -fsSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ bookworm main" >/etc/apt/sources.list.d/php.list
|
||||||
|
$STD apt-get update
|
||||||
|
$STD apt-get install -y \
|
||||||
|
apache2 \
|
||||||
|
libapache2-mod-php8.4 \
|
||||||
|
php8.4-{bcmath,cli,intl,curl,zip,gd,xml,mbstring,mysql} \
|
||||||
|
composer
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
install_mariadb
|
||||||
|
|
||||||
|
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;"
|
||||||
|
{
|
||||||
|
echo "Firefly-Credentials"
|
||||||
|
echo "Firefly Database User: $DB_USER"
|
||||||
|
echo "Firefly Database Password: $DB_PASS"
|
||||||
|
echo "Firefly Database Name: $DB_NAME"
|
||||||
|
} >>~/firefly.creds
|
||||||
|
msg_ok "Set up database"
|
||||||
|
|
||||||
|
msg_info "Installing Firefly III (Patience)"
|
||||||
|
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"
|
||||||
|
mkdir -p /opt/firefly
|
||||||
|
tar -xzf FireflyIII-v${RELEASE}.tar.gz -C /opt/firefly
|
||||||
|
chown -R www-data:www-data /opt/firefly
|
||||||
|
chmod -R 775 /opt/firefly/storage
|
||||||
|
cd /opt/firefly
|
||||||
|
cp .env.example .env
|
||||||
|
sed -i "s/DB_HOST=.*/DB_HOST=localhost/" /opt/firefly/.env
|
||||||
|
sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=$DB_PASS/" /opt/firefly/.env
|
||||||
|
echo "export COMPOSER_ALLOW_SUPERUSER=1" >>~/.bashrc
|
||||||
|
source ~/.bashrc
|
||||||
|
$STD composer install --no-dev --no-plugins --no-interaction
|
||||||
|
$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
|
||||||
|
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||||
|
msg_ok "Installed Firefly III"
|
||||||
|
|
||||||
|
msg_info "Creating Service"
|
||||||
|
cat <<EOF >/etc/apache2/sites-available/firefly.conf
|
||||||
|
<VirtualHost *:80>
|
||||||
|
ServerAdmin webmaster@localhost
|
||||||
|
DocumentRoot /opt/firefly/public/
|
||||||
|
|
||||||
|
<Directory /opt/firefly/public>
|
||||||
|
Options FollowSymLinks
|
||||||
|
AllowOverride All
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
ErrorLog /var/log/apache2/error.log
|
||||||
|
CustomLog /var/log/apache2/access.log combined
|
||||||
|
|
||||||
|
</VirtualHost>
|
||||||
|
EOF
|
||||||
|
chown www-data:www-data /opt/firefly/storage/oauth-*.key
|
||||||
|
$STD a2enmod php8.4
|
||||||
|
$STD a2enmod rewrite
|
||||||
|
$STD a2ensite firefly.conf
|
||||||
|
$STD a2dissite 000-default.conf
|
||||||
|
$STD systemctl reload apache2
|
||||||
|
msg_ok "Created Service"
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -rf /opt/FireflyIII-v${RELEASE}.tar.gz
|
||||||
|
$STD apt-get -y autoremove
|
||||||
|
$STD apt-get -y autoclean
|
||||||
|
msg_ok "Cleaned"
|
Loading…
x
Reference in New Issue
Block a user