From a1232d6a69209682bb00ec4900347dce538c0b76 Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Mon, 23 Nov 2026 09:04:10 +0100 Subject: [PATCH] Add freescout (ct) (#18930) Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> --- ct/freescout.sh | 70 ++++++++++++++++++++ install/freescout-install.sh | 124 +++++++++++++++++++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 ct/freescout.sh create mode 100644 install/freescout-install.sh diff --git a/ct/freescout.sh b/ct/freescout.sh new file mode 100644 index 000000000..7201729b9 --- /dev/null +++ b/ct/freescout.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/freescout-help-desk/freescout + +APP="FreeScout" +var_tags="${var_tags:-helpdesk;ticketing}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-1024}" +var_disk="${var_disk:-6}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-yes}" +var_unprivileged="${var_unprivileged:-1}" + +export var_admin_email="${var_admin_email:-}" +export var_admin_pass="${var_admin_pass:-}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/freescout ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "freescout" "freescout-help-desk/freescout"; then + msg_info "Stopping FreeScout" + systemctl stop cron nginx php8.4-fpm + pkill -u www-data -f artisan || true + msg_ok "Stopped FreeScout" + + create_backup /opt/freescout/.env + CLEAN_INSTALL=1 CLEAN_INSTALL_KEEP="storage Modules public/modules" fetch_and_deploy_gh_release "freescout" "freescout-help-desk/freescout" "tarball" + restore_backup + + msg_info "Updating FreeScout" + cd /opt/freescout + $STD php artisan freescout:after-app-update + $STD php artisan storage:link + chown -R www-data:www-data /opt/freescout + msg_ok "Updated FreeScout" + + msg_info "Starting FreeScout" + systemctl start php8.4-fpm nginx cron + msg_ok "Started FreeScout" + msg_ok "Updated successfully!" + 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 "${GATEWAY}${BGN}http://${IP}${CL}" +echo -e "${INFO}${YW}Admin credentials: ~/freescout.creds (inside the container)${CL}" diff --git a/install/freescout-install.sh b/install/freescout-install.sh new file mode 100644 index 000000000..4ca9a3ad9 --- /dev/null +++ b/install/freescout-install.sh @@ -0,0 +1,124 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/freescout-help-desk/freescout + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +var_admin_email="${var_admin_email:-admin@example.com}" +if [[ ! "$var_admin_email" =~ ^[^@[:space:]]+@[^@[:space:]]+\.[^@[:space:]]+$ ]]; then + msg_warn "Invalid admin email '${var_admin_email}', using admin@example.com" + var_admin_email="admin@example.com" +fi +var_admin_pass="${var_admin_pass:-$(random_password 16)}" + +msg_info "Installing Dependencies" +$STD apt install -y nginx +msg_ok "Installed Dependencies" + +setup_mariadb +MARIADB_DB_NAME="freescout" MARIADB_DB_USER="freescout" setup_mariadb_db +PHP_VERSION="8.4" PHP_FPM="YES" setup_php +fetch_and_deploy_gh_release "freescout" "freescout-help-desk/freescout" "tarball" + +msg_info "Configuring FreeScout" +cd /opt/freescout +cat </opt/freescout/.env +APP_URL=http://${LOCAL_IP} +DB_CONNECTION=mysql +DB_HOST=localhost +DB_PORT=3306 +DB_DATABASE=freescout +DB_USERNAME=freescout +DB_PASSWORD=${MARIADB_DB_PASS} +APP_KEY= +EOF +$STD php artisan key:generate --force +$STD php artisan storage:link +$STD php artisan migrate --force +$STD php artisan freescout:create-user --role=admin --firstName=Admin --lastName=FreeScout --email="$var_admin_email" --password="$var_admin_pass" --no-interaction +touch /opt/freescout/storage/.installed +$STD php artisan freescout:clear-cache +chown -R www-data:www-data /opt/freescout +cat <>~/freescout.creds + +FreeScout Admin +Email: ${var_admin_email} +Password: ${var_admin_pass} +EOF +chmod 600 ~/freescout.creds +msg_ok "Configured FreeScout" + +msg_info "Configuring Nginx" +sed -i 's/^;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/8.4/fpm/php.ini +systemctl restart php8.4-fpm +PHP_SOCK=$(get_php_fpm_socket) +cat </etc/nginx/sites-available/freescout +server { + listen 80; + listen [::]:80; + server_name _; + + root /opt/freescout/public; + index index.php index.html index.htm; + + client_max_body_size 128M; + + location / { + try_files \$uri \$uri/ /index.php?\$query_string; + } + location ~ \.php\$ { + fastcgi_split_path_info ^(.+\.php)(/.+)\$; + fastcgi_pass unix:${PHP_SOCK}; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; + include fastcgi_params; + } + location ~* ^/storage/attachment/ { + expires 1M; + access_log off; + try_files \$uri \$uri/ /index.php?\$query_string; + } + location ~* ^/(?:css|js)/.*\.(?:css|js)\$ { + expires 2d; + access_log off; + add_header Cache-Control "public, must-revalidate"; + add_header X-Content-Type-Options "nosniff"; + } + location ~* ^/storage/.*\.((?!(jpg|jpeg|jfif|pjpeg|pjp|apng|bmp|gif|ico|cur|png|tif|tiff|webp|pdf|txt|diff|patch|json|mp3|wav|ogg|wma)).)*\$ { + add_header Content-disposition "attachment; filename=\$2"; + add_header X-Content-Type-Options "nosniff"; + default_type application/octet-stream; + } + location ~* ^/(storage/|.*\.).*\$ { + expires 1M; + access_log off; + add_header Cache-Control "public"; + add_header X-Content-Type-Options "nosniff"; + } + location ~ /\. { + deny all; + } +} +EOF +nginx_enable_site "freescout" +msg_ok "Configured Nginx" + +msg_info "Setting up Cron" +cat </etc/cron.d/freescout +* * * * * www-data php /opt/freescout/artisan schedule:run >/dev/null 2>&1 +EOF +systemctl enable -q --now cron +msg_ok "Set up Cron" + +motd_ssh +customize +cleanup_lxc