diff --git a/ct/headers/hortusfox b/ct/headers/hortusfox new file mode 100644 index 000000000..617179884 --- /dev/null +++ b/ct/headers/hortusfox @@ -0,0 +1,6 @@ + __ __ __ ______ + / / / /___ _____/ /___ _______/ ____/___ _ __ + / /_/ / __ \/ ___/ __/ / / / ___/ /_ / __ \| |/_/ + / __ / /_/ / / / /_/ /_/ (__ ) __/ / /_/ /> < +/_/ /_/\____/_/ \__/\__,_/____/_/ \____/_/|_| + diff --git a/ct/hortusfox.sh b/ct/hortusfox.sh new file mode 100644 index 000000000..0f131ce82 --- /dev/null +++ b/ct/hortusfox.sh @@ -0,0 +1,73 @@ +#!/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: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/danielbrendel/hortusfox-web + +APP="HortusFox" +var_tags="${var_tags:-plants}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-5}" +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/hortusfox ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -fsSL https://api.github.com/repos/danielbrendel/hortusfox-web/releases/latest | jq -r .tag_name | sed 's/^v//') + if [[ ! -f ~/.hortusfox ]] || [[ "${RELEASE}" != "$(cat ~/.hortusfox)" ]]; then + msg_info "Stopping Service" + systemctl stop apache2 + msg_ok "Stopped Service" + + msg_info "Backing up current HortusFox installation" + cd /opt + mv /opt/hortusfox/ /opt/hortusfox-backup + msg_ok "Backed up current HortusFox installation" + + fetch_and_deploy_gh_release "hortusfox" "danielbrendel/hortusfox-web" + + msg_info "Updating HortusFox" + cd /opt/hortusfox + mv /opt/hortusfox-backup/.env /opt/hortusfox/.env + $STD composer install --no-dev --optimize-autoloader + $STD php asatru migrate --no-interaction + $STD php asatru plants:attributes + $STD php asatru calendar:classes + msg_ok "Updated HortusFox" + + msg_info "Starting Service" + systemctl start apache2 + msg_ok "Started Service" + + msg_info "Cleaning up" + rm -r /opt/hortusfox-backup + 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}" diff --git a/frontend/public/json/hortusfox.json b/frontend/public/json/hortusfox.json new file mode 100644 index 000000000..a55ccb929 --- /dev/null +++ b/frontend/public/json/hortusfox.json @@ -0,0 +1,40 @@ +{ + "name": "HortusFox", + "slug": "hortusfox", + "categories": [ + 24 + ], + "type": "ct", + "updateable": true, + "privileged": false, + "date_created": "2025-08-08", + "config_path": "/opt/hortusfox/.env", + "interface_port": 80, + "documentation": "https://github.com/danielbrendel/hortusfox-web", + "website": "https://www.hortusfox.com/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/hortusfox.webp", + "description": "HortusFox is a collaborative plant management system for plant enthusiasts. Manage, document and track your entire plant collection – self-hosted and privacy-friendly.", + "install_methods": [ + { + "type": "default", + "script": "ct/hortusfox.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 5, + "os": "Debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Login Credentials : `cat ~/hortusfox.creds`", + "type": "info" + } + ] +} diff --git a/install/hortusfox-install.sh b/install/hortusfox-install.sh new file mode 100644 index 000000000..e24c0d944 --- /dev/null +++ b/install/hortusfox-install.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/danielbrendel/hortusfox-web + +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 apache2 +msg_ok "Installed Dependencies" + +PHP_MODULE="exif,mysql" PHP_APACHE="YES" PHP_FPM="NO" PHP_VERSION="8.3" setup_php +setup_mariadb +setup_composer + +msg_info "Setting up database" +DB_NAME=hortusfox +DB_USER=hortusfox +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;" +$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';" +$STD mariadb -u root -e "GRANT ALL PRIVILEGES ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" +{ + echo "HortusFox Database Credentials" + echo "Database: $DB_NAME" + echo "Username: $DB_USER" + echo "Password: $DB_PASS" +} >>~/hortusfox.creds +msg_ok "Set up database" + +fetch_and_deploy_gh_release "hortusfox" "danielbrendel/hortusfox-web" + +msg_info "Configuring .env" +cp /opt/hortusfox/.env.example /opt/hortusfox/.env +sed -i "s|^DB_HOST=.*|DB_HOST=localhost|" /opt/hortusfox/.env +sed -i "s|^DB_USER=.*|DB_USER=$DB_USER|" /opt/hortusfox/.env +sed -i "s|^DB_PASSWORD=.*|DB_PASSWORD=$DB_PASS|" /opt/hortusfox/.env +sed -i "s|^DB_DATABASE=.*|DB_DATABASE=$DB_NAME|" /opt/hortusfox/.env +sed -i "s|^DB_ENABLE=.*|DB_ENABLE=true|" /opt/hortusfox/.env +sed -i "s|^APP_TIMEZONE=.*|APP_TIMEZONE=Europe/Berlin|" /opt/hortusfox/.env +msg_ok ".env configured" + +msg_info "Installing Composer dependencies" +cd /opt/hortusfox +$STD composer install --no-dev --optimize-autoloader +msg_ok "Composer dependencies installed" + +msg_info "Running DB migration" +$STD php asatru migrate:fresh +msg_ok "Migration finished" + +msg_info "Setting up HortusFox" +$STD mariadb -u root -D $DB_NAME -e "INSERT IGNORE INTO AppModel (workspace, language, created_at) VALUES ('Default Workspace', 'en', NOW());" +$STD php asatru plants:attributes +$STD php asatru calendar:classes +ADMIN_EMAIL="admin@example.com" +ADMIN_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)" +ADMIN_HASH=$(php -r "echo password_hash('$ADMIN_PASS', PASSWORD_BCRYPT);") +$STD mariadb -u root -D $DB_NAME -e "INSERT IGNORE INTO UserModel (name, email, password, admin) VALUES ('Admin', '$ADMIN_EMAIL', '$ADMIN_HASH', 1);" +{ + echo "" + echo "HortusFox-Admin-Creds:" + echo "E-Mail: $ADMIN_EMAIL" + echo "Passwort: $ADMIN_PASS" +} >>~/hortusfox.creds +$STD mariadb -u root -D $DB_NAME -e "INSERT IGNORE INTO LocationsModel (name, active, created_at) VALUES ('Home', 1, NOW());" +msg_ok "Set up HortusFox" + +msg_info "Configuring Apache vHost" +cat </etc/apache2/sites-available/hortusfox.conf + + ServerAdmin webmaster@localhost + DocumentRoot /opt/hortusfox/public + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + ErrorLog \${APACHE_LOG_DIR}/hortusfox_error.log + CustomLog \${APACHE_LOG_DIR}/hortusfox_access.log combined + +EOF +$STD a2dissite 000-default +$STD a2ensite hortusfox +$STD a2enmod rewrite +systemctl restart apache2 +msg_ok "Apache configured" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"