ProxmoxVE/ct/firefly.sh

115 lines
3.1 KiB
Bash
Raw Normal View History

2024-11-30 15:35:50 +00:00
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/quantumryuu/ProxmoxVE/build/misc/build.func)
#source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2024 community-scripts ORG
# Author: kristocopani
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
function header_info {
clear
cat <<"EOF"
2024-11-30 15:36:51 +00:00
_______ ______ ____________
/ ____(_)_______ / __/ /_ __ / _/ _/ _/
/ /_ / / ___/ _ \/ /_/ / / / / / / / / / /
/ __/ / / / / __/ __/ / /_/ / _/ /_/ /_/ /
/_/ /_/_/ \___/_/ /_/\__, / /___/___/___/
/____/
2024-11-30 15:35:50 +00:00
EOF
}
header_info
echo -e "Loading..."
2024-11-30 15:38:47 +00:00
APP="Firefly"
2024-11-30 15:35:50 +00:00
var_disk="2"
var_cpu="1"
2024-11-30 15:36:51 +00:00
var_ram="1024"
2024-11-30 15:35:50 +00:00
var_os="debian"
var_version="12"
variables
color
catch_errors
function default_settings() {
CT_TYPE="1"
PW=""
CT_ID=$NEXTID
HN=$NSAPP
DISK_SIZE="$var_disk"
CORE_COUNT="$var_cpu"
RAM_SIZE="$var_ram"
BRG="vmbr0"
NET="dhcp"
GATE=""
APT_CACHER=""
APT_CACHER_IP=""
DISABLEIP6="no"
MTU=""
SD=""
NS=""
MAC=""
VLAN=""
SSH="no"
VERB="no"
echo_default
}
function update_script() {
header_info
check_container_storage
check_container_resources
2024-11-30 18:49:41 +00:00
if [[ ! -d /opt/firefly ]]; then
2024-11-30 15:35:50 +00:00
msg_error "No ${APP} Installation Found!"
exit
fi
2024-11-30 17:47:51 +00:00
RELEASE=$(curl -s https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
2024-11-30 15:35:50 +00:00
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
2024-11-30 16:30:47 +00:00
msg_info "Stopping Apache2"
systemctl stop apache2
msg_ok "Stopped Apache2"
2024-11-30 15:35:50 +00:00
msg_info "Updating ${APP} to v${RELEASE}"
2024-11-30 18:49:41 +00:00
cp /opt/firefly/.env /opt/.env
cp -r /opt/firefly/storage /opt/storage
rm -rf /opt/firefly
2024-11-30 15:35:50 +00:00
cd /opt
2024-11-30 17:47:51 +00:00
wget -q "https://github.com/firefly-iii/firefly-iii/releases/download/v${RELEASE}/FireflyIII-v${RELEASE}.tar.gz"
2024-11-30 18:49:41 +00:00
mkdir -p /opt/firefly
tar -xzf FireflyIII-v${RELEASE}.tar.gz -C /opt/firefly --exclude='storage'
mv /opt/.env /opt/firefly/.env
mv /opt/storage /opt/firefly/storage
cd /opt/firefly
2024-11-30 18:29:15 +00:00
composer install --no-dev &>/dev/null
2024-11-30 18:49:41 +00:00
php artisan migrate --seed --force &>/dev/null
php artisan firefly:decrypt-all &>/dev/null
2024-11-30 16:30:47 +00:00
php artisan cache:clear &>/dev/null
php artisan view:clear &>/dev/null
2024-11-30 18:49:41 +00:00
php artisan firefly:upgrade-database &>/dev/null
php artisan firefly:laravel-passport-keys &>/dev/null
2024-11-30 18:55:36 +00:00
chown -R www-data:www-data /opt/firefly
chmod -R 775 /opt/firefly/storage
2024-11-30 16:30:47 +00:00
echo "${RELEASE}" >"/opt/${APP}_version.txt" &>/dev/null
2024-11-30 15:35:50 +00:00
msg_ok "Updated ${APP} to v${RELEASE}"
2024-11-30 16:30:47 +00:00
msg_info "Starting Apache2"
systemctl start apache2
msg_ok "Started Apache2"
2024-11-30 15:35:50 +00:00
msg_info "Cleaning up"
2024-11-30 18:15:47 +00:00
rm -rf /opt/FireflyIII-v${RELEASE}.tar.gz
2024-11-30 15:35:50 +00:00
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 "${APP} should be reachable by going to the following URL.
2024-11-30 16:46:11 +00:00
${BL}http://${IP}${CL} \n"