diff --git a/ct/gomft.sh b/ct/gomft.sh new file mode 100644 index 000000000..5effb2ed7 --- /dev/null +++ b/ct/gomft.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/StarFleetCPTN/GoMFT + +APP="GoMFT" +var_tags="backup" +var_cpu="1" +var_ram="512" +var_disk="4" +var_os="debian" +var_version="12" +var_unprivileged="1" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d "/opt/gomft" ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping $APP" + systemctl stop gomft + msg_ok "Stopped $APP" + + msg_info "Updating $APP to ${RELEASE}" + rm -f /opt/gomft/gomft + temp_file=$(mktemp) + wget -q "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file + tar -xzf $temp_file + cp -rf GoMFT-${RELEASE}/* /opt/gomft + $STD $HOME/go/bin/templ generate + wget -q "https://github.com/StarFleetCPTN/GoMFT/releases/download/v${RELEASE}/gomft-v${RELEASE}-linux-amd64" -O /opt/gomft/gomft + chmod +x /opt/gomft/gomft + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated $APP to ${RELEASE}" + + msg_info "Cleaning Up" + rm -f $temp_file + rm -rf GoMFT-${RELEASE} + msg_ok "Cleanup Complete" + + msg_info "Starting $APP" + systemctl start gomft + msg_ok "Started $APP" + + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at ${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}:8080${CL}" diff --git a/install/gomft-install.sh b/install/gomft-install.sh new file mode 100644 index 000000000..72f314bdc --- /dev/null +++ b/install/gomft-install.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/StarFleetCPTN/GoMFT + +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 \ + sudo \ + mc \ + sqlite3 \ + rclone \ + tzdata \ + ca-certificates +msg_ok "Installed Dependencies" + +msg_info "Setting up Golang" +set +o pipefail +temp_file=$(mktemp) +golang_tarball=$(curl -s https://go.dev/dl/ | grep -oP 'go[\d\.]+\.linux-amd64\.tar\.gz' | head -n 1) +wget -q https://golang.org/dl/"$golang_tarball" -O "$temp_file" +tar -C /usr/local -xzf "$temp_file" +ln -sf /usr/local/go/bin/go /usr/local/bin/go +set -o pipefail +msg_ok "Setup Golang" + +msg_info "Setup ${APPLICATION}" +temp_file2=$(mktemp) +RELEASE=$(curl -s https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +wget -q "https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file2 +tar -xzf $temp_file2 +mv GoMFT-${RELEASE}/ /opt/gomft +cd /opt/gomft +$STD go install github.com/a-h/templ/cmd/templ@latest +wget -q "https://github.com/StarFleetCPTN/GoMFT/releases/download/v${RELEASE}/gomft-v${RELEASE}-linux-amd64" -O gomft +$STD $HOME/go/bin/templ generate +chmod +x gomft +JWT_SECRET_KEY=$(openssl rand -base64 24 | tr -d '/+=') + +cat </opt/gomft/.env +SERVER_ADDRESS=:8080 +DATA_DIR=/opt/gomft/data/gomft +BACKUP_DIR=/opt/gomft/data/gomft/backups +JWT_SECRET=$JWT_SECRET_KEY +BASE_URL=http://localhost:8080 + +# Email configuration +EMAIL_ENABLED=false +EMAIL_HOST=smtp.example.com +EMAIL_PORT=587 +EMAIL_FROM_EMAIL=gomft@example.com +EMAIL_FROM_NAME=GoMFT +EMAIL_REPLY_TO= +EMAIL_ENABLE_TLS=true +EMAIL_REQUIRE_AUTH=true +EMAIL_USERNAME=smtp_username +EMAIL_PASSWORD=smtp_password +EOF + +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Setup ${APPLICATION}" + +msg_info "Creating Service" +cat </etc/systemd/system/gomft.service +[Unit] +Description=GoMFT Service +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/gomft +ExecStart=/opt/gomft/./gomft +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now gomft +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -f $temp_file $temp_file2 +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" + +motd_ssh +customize diff --git a/json/gomft.json b/json/gomft.json new file mode 100644 index 000000000..7fb93be27 --- /dev/null +++ b/json/gomft.json @@ -0,0 +1,39 @@ +{ + "name": "GoMFT", + "slug": "gomft", + "categories": [ + 7 + ], + "date_created": "2025-03-17", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8080, + "documentation": "https://github.com/StarFleetCPTN/GoMFT#configuration", + "website": "https://github.com/StarFleetCPTN/GoMFT", + "logo": "https://github.com/StarFleetCPTN/GoMFT/blob/main/static/img/logo.svg", + "description": "GoMFT is a web-based managed file transfer application built with Go, leveraging rclone for robust file transfer capabilities. It provides a user-friendly interface for configuring, scheduling, and monitoring file transfers across various storage providers.", + "install_methods": [ + { + "type": "default", + "script": "ct/gomft.sh", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 4, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": "admin@example.com", + "password": "admin" + }, + "notes": [ + { + "text": "For additional configuration options, edit .env file here: `/opt/gomft/.env`. Check the documentation for more details.", + "type": "info" + } + ] +}