From df4926d1797e02541662eeab9060625452704abf Mon Sep 17 00:00:00 2001 From: Stroopwafe1 <48443491+Stroopwafe1@users.noreply.github.com> Date: Fri, 27 Jun 2025 12:09:44 +0200 Subject: [PATCH 1/4] Feat: Add script to install leantime --- ct/leantime.sh | 79 ++++++++++++++++++++ frontend/public/json/leantime.json | 35 +++++++++ install/leantime-install.sh | 113 +++++++++++++++++++++++++++++ 3 files changed, 227 insertions(+) create mode 100644 ct/leantime.sh create mode 100644 frontend/public/json/leantime.json create mode 100644 install/leantime-install.sh diff --git a/ct/leantime.sh b/ct/leantime.sh new file mode 100644 index 00000000..b084ef8a --- /dev/null +++ b/ct/leantime.sh @@ -0,0 +1,79 @@ +#!/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: Stroopwafe1 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://leantime.io + +# App Default Values +# Name of the app (e.g. Google, Adventurelog, Apache-Guacamole" +APP="Leantime" +# Tags for Proxmox VE, maximum 2 pcs., no spaces allowed, separated by a semicolon ; (e.g. database | adblock;dhcp) +var_tags="${var_tags:-productivity}" +# Number of cores (1-X) (e.g. 4) - default are 2 +var_cpu="${var_cpu:-2}" +# Amount of used RAM in MB (e.g. 2048 or 4096) +var_ram="${var_ram:-2048}" +# Amount of used disk space in GB (e.g. 4 or 10) +var_disk="${var_disk:-20}" +# Default OS (e.g. debian, ubuntu, alpine) +var_os="${var_os:-debian}" +# Default OS version (e.g. 12 for debian, 24.04 for ubuntu, 3.20 for alpine) +var_version="${var_version:-12}" +# 1 = unprivileged container, 0 = privileged container +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + # Check if installation is present | -f for file, -d for folder + if [[ ! -d /opt/${APP} ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + # Crawling the new version and checking whether an update is required + RELEASE=$(curl -fsSL https://api.github.com/repos/Leantime/leantime/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + # Creating Backup + msg_info "Creating Backup" + mariadb-dump leantime >"/opt/${APP}_db_backup_$(date +%F).sql" + tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" /opt/leantime + msg_ok "Backup Created" + + # Execute Update + msg_info "Updating $APP to v${RELEASE}" + curl -fsSL -o "${RELEASE}.tar.gz" "https://github.com/Leantime/leantime/archive/refs/tags/${RELEASE}.tar.gz" + tar xf "${RELEASE}.tar.gz" --strip-components=1 -C "/opt/${APP}" + msg_ok "Updated $APP to v${RELEASE}" + + # Cleaning up + msg_info "Cleaning Up" + rm -rf "${RELEASE}.tar.gz" + msg_ok "Cleanup Completed" + + # Last Action + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Update Successful" + 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}/install${CL}" diff --git a/frontend/public/json/leantime.json b/frontend/public/json/leantime.json new file mode 100644 index 00000000..b4594797 --- /dev/null +++ b/frontend/public/json/leantime.json @@ -0,0 +1,35 @@ +{ + "name": "Leantime", + "slug": "leantime", + "categories": [ + 12 + ], + "date_created": "2025-06-27", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://docs.leantime.io/", + "config_path": "/opt/Leantime/config/.env", + "website": "https://leantime.io", + "logo": "https://assets.leantime.io/wp-content/uploads/2019/02/iconOnly-700.png", + "description": "Leantime is a goals focused project management system for non-project managers. Building with ADHD, Autism, and dyslexia in mind. ", + "install_methods": [ + { + "type": "default", + "script": "ct/leantime.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 20, + "os": "Debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +} diff --git a/install/leantime-install.sh b/install/leantime-install.sh new file mode 100644 index 00000000..c7d60c7c --- /dev/null +++ b/install/leantime-install.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Stroopwafe1 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://leantime.io + +# Import Functions und Setup +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +PHP_VERSION=8.4 +PHP_MODULE=mysql +PHP_APACHE=YES +PHP_FPM=YES + +msg_info "Installing Apache2" +$STD apt-get install -y \ + apache2 +msg_ok "Installed Apache2" + +setup_php + +msg_info "Installing Apache2 mod for PHP" +$STD apt-get install -y \ + "libapache2-mod-php${PHP_VERSION}" +msg_ok "Installed Apache2 mod" + +setup_mariadb + +msg_ok "Installed Dependencies" + +# Template: MySQL Database +msg_info "Setting up Database" +systemctl enable -q --now mariadb +DB_NAME=leantime +DB_USER=leantime +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +$STD mysql -u root -e "CREATE DATABASE $DB_NAME;" +$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');" +$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" +{ + echo "${APPLICATION} Credentials" + echo "Database User: $DB_USER" + echo "Database Password: $DB_PASS" + echo "Database Name: $DB_NAME" +} >>~/"$APPLICATION".creds +msg_ok "Set up Database" + +# Setup App +msg_info "Setup ${APPLICATION}" +APACHE_LOG_DIR=/var/log/apache2 +RELEASE=$(curl -fsSL https://api.github.com/repos/Leantime/leantime/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +curl -fsSL -o "${RELEASE}.tar.gz" "https://github.com/Leantime/leantime/releases/download/${RELEASE}/Leantime-${RELEASE}.tar.gz" +mkdir -p "/opt/${APPLICATION}" +mkdir -p /etc/apache2/sites-enabled +tar xf "${RELEASE}.tar.gz" --strip-components=1 -C "/opt/${APPLICATION}" +chown -R www-data:www-data "/opt/${APPLICATION}" +chmod -R 750 "/opt/${APPLICATION}" + +cat </etc/apache2/sites-enabled/000-default.conf + + ServerAdmin webmaster@localhost + DocumentRoot /opt/${APPLICATION}/public + DirectoryIndex index.php index.html index.cgi index.pl index.xhtml + Options +ExecCGI + + + Options FollowSymLinks + Require all granted + AllowOverride All + + + + Require all granted + + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + +EOF + +mv "/opt/${APPLICATION}/config/sample.env" "/opt/${APPLICATION}/config/.env" +sed -i -e "s|^LEAN_DB_DATABASE.*|LEAN_DB_DATABASE = '$DB_NAME'|" \ + -e "s|^LEAN_DB_USER.*|LEAN_DB_USER = '$DB_USER'|" \ + -e "s|^LEAN_DB_PASSWORD.*|LEAN_DB_PASSWORD = '$DB_PASS'|" \ + -e "s|^LEAN_SESSION_PASSWORD.*|LEAN_SESSION_PASSWORD = '$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)'|" \ + "/opt/${APPLICATION}/config/.env" + +a2enmod -q proxy_fcgi setenvif rewrite +a2enconf -q "php${PHP_VERSION}-fpm" + +sed -i -e "s/^;extension.\(curl\|fileinfo\|gd\|intl\|ldap\|mbstring\|exif\|mysqli\|odbc\|openssl\|pdo_mysql\)/extension=\1/g" "/etc/php/${PHP_VERSION}/apache2/php.ini" + +systemctl restart apache2 + +echo "${RELEASE}" >/opt/"${APPLICATION}"_version.txt +msg_ok "Setup ${APPLICATION}" + +motd_ssh +customize + +# Cleanup +msg_info "Cleaning up" +rm -f "${RELEASE}".tar.gz +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" From 9f01464234db7db6123202b4d6bdbd72be6b9c24 Mon Sep 17 00:00:00 2001 From: Stroopwafe1 <48443491+Stroopwafe1@users.noreply.github.com> Date: Fri, 27 Jun 2025 18:25:15 +0200 Subject: [PATCH 2/4] Chore: Implement feedback --- ct/leantime.sh | 42 +++++------------------------- frontend/public/json/leantime.json | 2 +- install/leantime-install.sh | 10 +------ 3 files changed, 8 insertions(+), 46 deletions(-) diff --git a/ct/leantime.sh b/ct/leantime.sh index b084ef8a..cc58a765 100644 --- a/ct/leantime.sh +++ b/ct/leantime.sh @@ -1,27 +1,18 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: Stroopwafe1 # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://leantime.io -# App Default Values -# Name of the app (e.g. Google, Adventurelog, Apache-Guacamole" APP="Leantime" -# Tags for Proxmox VE, maximum 2 pcs., no spaces allowed, separated by a semicolon ; (e.g. database | adblock;dhcp) var_tags="${var_tags:-productivity}" -# Number of cores (1-X) (e.g. 4) - default are 2 var_cpu="${var_cpu:-2}" -# Amount of used RAM in MB (e.g. 2048 or 4096) var_ram="${var_ram:-2048}" -# Amount of used disk space in GB (e.g. 4 or 10) var_disk="${var_disk:-20}" -# Default OS (e.g. debian, ubuntu, alpine) var_os="${var_os:-debian}" -# Default OS version (e.g. 12 for debian, 24.04 for ubuntu, 3.20 for alpine) var_version="${var_version:-12}" -# 1 = unprivileged container, 0 = privileged container var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -40,32 +31,11 @@ function update_script() { exit fi - # Crawling the new version and checking whether an update is required - RELEASE=$(curl -fsSL https://api.github.com/repos/Leantime/leantime/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') - if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then - # Creating Backup - msg_info "Creating Backup" - mariadb-dump leantime >"/opt/${APP}_db_backup_$(date +%F).sql" - tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" /opt/leantime - msg_ok "Backup Created" - - # Execute Update - msg_info "Updating $APP to v${RELEASE}" - curl -fsSL -o "${RELEASE}.tar.gz" "https://github.com/Leantime/leantime/archive/refs/tags/${RELEASE}.tar.gz" - tar xf "${RELEASE}.tar.gz" --strip-components=1 -C "/opt/${APP}" - msg_ok "Updated $APP to v${RELEASE}" - - # Cleaning up - msg_info "Cleaning Up" - rm -rf "${RELEASE}.tar.gz" - msg_ok "Cleanup Completed" - - # Last Action - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Update Successful" - else - msg_ok "No update required. ${APP} is already at v${RELEASE}" - fi + msg_info "Creating Backup" + mariadb-dump leantime >"/opt/${APP}_db_backup_$(date +%F).sql" + tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" "/opt/${APP}" + msg_ok "Backup Created" + fetch_and_deploy_gh_release "$APP" "Leantime/leantime" "prebuild" "latest" "/opt/${APP}" Leantime-v[0-9].[0-9].[0-9].tar.gz exit } diff --git a/frontend/public/json/leantime.json b/frontend/public/json/leantime.json index b4594797..e5e0fec8 100644 --- a/frontend/public/json/leantime.json +++ b/frontend/public/json/leantime.json @@ -12,7 +12,7 @@ "documentation": "https://docs.leantime.io/", "config_path": "/opt/Leantime/config/.env", "website": "https://leantime.io", - "logo": "https://assets.leantime.io/wp-content/uploads/2019/02/iconOnly-700.png", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/leantime.webp", "description": "Leantime is a goals focused project management system for non-project managers. Building with ADHD, Autism, and dyslexia in mind. ", "install_methods": [ { diff --git a/install/leantime-install.sh b/install/leantime-install.sh index c7d60c7c..475a464a 100644 --- a/install/leantime-install.sh +++ b/install/leantime-install.sh @@ -5,7 +5,6 @@ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://leantime.io -# Import Functions und Setup source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" color verb_ip6 @@ -35,7 +34,6 @@ setup_mariadb msg_ok "Installed Dependencies" -# Template: MySQL Database msg_info "Setting up Database" systemctl enable -q --now mariadb DB_NAME=leantime @@ -55,11 +53,7 @@ msg_ok "Set up Database" # Setup App msg_info "Setup ${APPLICATION}" APACHE_LOG_DIR=/var/log/apache2 -RELEASE=$(curl -fsSL https://api.github.com/repos/Leantime/leantime/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') -curl -fsSL -o "${RELEASE}.tar.gz" "https://github.com/Leantime/leantime/releases/download/${RELEASE}/Leantime-${RELEASE}.tar.gz" -mkdir -p "/opt/${APPLICATION}" -mkdir -p /etc/apache2/sites-enabled -tar xf "${RELEASE}.tar.gz" --strip-components=1 -C "/opt/${APPLICATION}" +fetch_and_deploy_gh_release "$APPLICATION" "Leantime/leantime" "prebuild" "latest" "/opt/${APPLICATION}" Leantime-v[0-9].[0-9].[0-9].tar.gz chown -R www-data:www-data "/opt/${APPLICATION}" chmod -R 750 "/opt/${APPLICATION}" @@ -99,7 +93,6 @@ sed -i -e "s/^;extension.\(curl\|fileinfo\|gd\|intl\|ldap\|mbstring\|exif\|mysql systemctl restart apache2 -echo "${RELEASE}" >/opt/"${APPLICATION}"_version.txt msg_ok "Setup ${APPLICATION}" motd_ssh @@ -107,7 +100,6 @@ customize # Cleanup msg_info "Cleaning up" -rm -f "${RELEASE}".tar.gz $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned" From dc0e63e7810b3854285d526b92f6f0a437087485 Mon Sep 17 00:00:00 2001 From: Stroopwafe1 <48443491+Stroopwafe1@users.noreply.github.com> Date: Fri, 27 Jun 2025 20:42:22 +0200 Subject: [PATCH 3/4] Chore: Remove remaining comments --- install/leantime-install.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/install/leantime-install.sh b/install/leantime-install.sh index 475a464a..cd577289 100644 --- a/install/leantime-install.sh +++ b/install/leantime-install.sh @@ -50,7 +50,6 @@ $STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH } >>~/"$APPLICATION".creds msg_ok "Set up Database" -# Setup App msg_info "Setup ${APPLICATION}" APACHE_LOG_DIR=/var/log/apache2 fetch_and_deploy_gh_release "$APPLICATION" "Leantime/leantime" "prebuild" "latest" "/opt/${APPLICATION}" Leantime-v[0-9].[0-9].[0-9].tar.gz @@ -98,7 +97,6 @@ msg_ok "Setup ${APPLICATION}" motd_ssh customize -# Cleanup msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean From 9989b15dda0871d0514e890df2a66c2586e13b7f Mon Sep 17 00:00:00 2001 From: Stroopwafe1 <48443491+Stroopwafe1@users.noreply.github.com> Date: Fri, 27 Jun 2025 20:45:56 +0200 Subject: [PATCH 4/4] Chore: Remove comment --- ct/leantime.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ct/leantime.sh b/ct/leantime.sh index cc58a765..f49c503a 100644 --- a/ct/leantime.sh +++ b/ct/leantime.sh @@ -25,7 +25,6 @@ function update_script() { check_container_storage check_container_resources - # Check if installation is present | -f for file, -d for folder if [[ ! -d /opt/${APP} ]]; then msg_error "No ${APP} Installation Found!" exit