mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-01-10 10:55:10 +00:00
New Script: Firefly (#616)
* firefly * initial commit for test * more tests * fix fix fix * fixeeees * update flow * test * fixed install probably * update fix * update fix * fixes on versioning * 123 * test update * update flow test * hope it works now? * work pleaaaase * reeveeeeeert * cleanup * more cleanup * Ready for PR! * Update firefly.json * Fixes * more fixes * fix firefly.json * Update firefly-install.sh * Update firefly.json --------- Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>
This commit is contained in:
parent
47377fdd26
commit
a9df33c7cf
85
ct/firefly.sh
Normal file
85
ct/firefly.sh
Normal file
@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||
# Copyright (c) 2021-2024 community-scripts ORG
|
||||
# Author: quantumryuu
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://firefly-iii.org/
|
||||
|
||||
# App Default Values
|
||||
APP="Firefly"
|
||||
var_tags="finance"
|
||||
var_cpu="1"
|
||||
var_ram="1024"
|
||||
var_disk="2"
|
||||
var_os="debian"
|
||||
var_version="12"
|
||||
var_unprivileged="1"
|
||||
|
||||
# App Output & Base Settings
|
||||
header_info "$APP"
|
||||
base_settings
|
||||
|
||||
# Core
|
||||
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 -s 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
|
||||
rm -rf /opt/firefly/*
|
||||
cd /opt
|
||||
wget -q "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'
|
||||
cd /opt/firefly
|
||||
composer install --no-dev --no-interaction &>/dev/null
|
||||
php artisan migrate --seed --force &>/dev/null
|
||||
php artisan firefly:decrypt-all &>/dev/null
|
||||
php artisan cache:clear &>/dev/null
|
||||
php artisan view:clear &>/dev/null
|
||||
php artisan firefly:upgrade-database &>/dev/null
|
||||
php artisan firefly:laravel-passport-keys &>/dev/null
|
||||
chown -R www-data:www-data /opt/firefly
|
||||
chmod -R 775 /opt/firefly/storage
|
||||
|
||||
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}"
|
101
install/firefly-install.sh
Normal file
101
install/firefly-install.sh
Normal file
@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2024 community-scripts ORG
|
||||
# Author: quantumryuu
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
curl \
|
||||
mc \
|
||||
sudo
|
||||
curl -sSLo /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.3 \
|
||||
php8.3-{bcmath,cli,intl,curl,zip,gd,xml,mbstring,mysql} \
|
||||
mariadb-server \
|
||||
composer
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
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=$(mysql --version | grep -oP 'Distrib \K[0-9]+\.[0-9]+\.[0-9]+')
|
||||
mysql -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
|
||||
mysql -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 -s https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
|
||||
cd /opt
|
||||
wget -q "https://github.com/firefly-iii/firefly-iii/releases/download/v${RELEASE}/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
|
||||
$STD a2enmod php8.3
|
||||
$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"
|
39
json/firefly.json
Normal file
39
json/firefly.json
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "Firefly III",
|
||||
"slug": "firefly",
|
||||
"categories": [
|
||||
0
|
||||
],
|
||||
"date_created": "2025-01-01",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 80,
|
||||
"documentation": "https://docs.firefly-iii.org/",
|
||||
"website": "https://firefly-iii.org/",
|
||||
"logo": "https://raw.githubusercontent.com/firefly-iii/firefly-iii/develop/.github/assets/img/logo-small.png",
|
||||
"description": "Firefly III is a free, self-hosted tool for managing your finances. Track expenses, plan budgets, and get detailed reports.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/firefly.sh",
|
||||
"resources": {
|
||||
"cpu": 1,
|
||||
"ram": 1024,
|
||||
"hdd": 2,
|
||||
"os": "Debian",
|
||||
"version": "12"
|
||||
}
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "Database credentials: `cat ~/firefly.creds`",
|
||||
"type": "info"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user