From 8a96be5776293ff612d6e98d76f523594db1122f Mon Sep 17 00:00:00 2001 From: "push-app-to-main[bot]" <203845782+push-app-to-main[bot]@users.noreply.github.com> Date: Sat, 12 Sep 2026 08:44:25 +0000 Subject: [PATCH] Add gotenberg (ct) --- ct/gotenberg.sh | 67 +++++++++++++++++++++++++ ct/headers/gotenberg | 6 +++ install/gotenberg-install.sh | 96 ++++++++++++++++++++++++++++++++++++ 3 files changed, 169 insertions(+) create mode 100644 ct/gotenberg.sh create mode 100644 ct/headers/gotenberg create mode 100644 install/gotenberg-install.sh diff --git a/ct/gotenberg.sh b/ct/gotenberg.sh new file mode 100644 index 000000000..7664ae6c1 --- /dev/null +++ b/ct/gotenberg.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" +_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: CrazyWolf13 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/gotenberg/gotenberg + +APP="Gotenberg" +var_tags="${var_tags:-document;pdf}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-4096}" +var_disk="${var_disk:-15}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /etc/systemd/system/gotenberg.service ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "gotenberg" "gotenberg/gotenberg"; then + msg_info "Stopping ${APP}" + systemctl stop gotenberg + msg_ok "Stopped ${APP}" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "gotenberg" "gotenberg/gotenberg" "tarball" "latest" "/opt/gotenberg" + + msg_info "Building ${APP} (Patience)" + cd /opt/gotenberg + export CGO_ENABLED=0 + $STD go mod download + $STD go build -o /usr/local/bin/gotenberg \ + -ldflags "-s -w -X 'github.com/gotenberg/gotenberg/v8/cmd.Version=$(cat ~/.gotenberg)'" \ + cmd/gotenberg/main.go + msg_ok "Built ${APP}" + + msg_info "Starting ${APP}" + systemctl start gotenberg + msg_ok "Started ${APP}" + 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}Gotenberg is a stateless API and has no web interface.${CL}" +echo -e "${INFO}${YW}Check the health endpoint using the following URL:${CL}" +echo -e "${GATEWAY}${BGN}http://${IP}:3000/health${CL}" diff --git a/ct/headers/gotenberg b/ct/headers/gotenberg new file mode 100644 index 000000000..d0b5c042e --- /dev/null +++ b/ct/headers/gotenberg @@ -0,0 +1,6 @@ + ______ __ __ + / ____/___ / /____ ____ / /_ ___ _________ _ + / / __/ __ \/ __/ _ \/ __ \/ __ \/ _ \/ ___/ __ `/ +/ /_/ / /_/ / /_/ __/ / / / /_/ / __/ / / /_/ / +\____/\____/\__/\___/_/ /_/_.___/\___/_/ \__, / + /____/ diff --git a/install/gotenberg-install.sh b/install/gotenberg-install.sh new file mode 100644 index 000000000..a15d2e0bc --- /dev/null +++ b/install/gotenberg-install.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: CrazyWolf13 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/gotenberg/gotenberg + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt install -y \ + chromium \ + libreoffice-writer \ + libreoffice-calc \ + libreoffice-impress \ + libreoffice-draw \ + libreoffice-math \ + python3-uno \ + python-is-python3 \ + pdftk-java \ + qpdf \ + libimage-exiftool-perl \ + fonts-crosextra-carlito \ + fonts-crosextra-caladea \ + fonts-liberation \ + fonts-liberation2 \ + fonts-dejavu \ + fonts-noto-cjk \ + fonts-noto-color-emoji \ + fonts-noto-core +msg_ok "Installed Dependencies" + +GO_VERSION="1.27" setup_go + +fetch_and_deploy_gh_release "pdfcpu" "pdfcpu/pdfcpu" "prebuild" "latest" "/opt/pdfcpu" "pdfcpu_*_Linux_$(arch_resolve "x86_64" "arm64").tar.xz" +ln -sf "$(find /opt/pdfcpu -type f -name pdfcpu | head -n1)" /usr/local/bin/pdfcpu + +msg_info "Installing unoconverter" +UNOCONVERTER_VERSION=$(get_latest_github_release "gotenberg/unoconverter" "false") +download_file "https://raw.githubusercontent.com/gotenberg/unoconverter/${UNOCONVERTER_VERSION}/unoconv" /usr/local/bin/unoconverter +chmod +x /usr/local/bin/unoconverter +msg_ok "Installed unoconverter" + +fetch_and_deploy_gh_release "gotenberg" "gotenberg/gotenberg" "tarball" "latest" "/opt/gotenberg" + +msg_info "Building Gotenberg (Patience)" +cd /opt/gotenberg +export CGO_ENABLED=0 +$STD go mod download +$STD go build -o /usr/local/bin/gotenberg \ + -ldflags "-s -w -X 'github.com/gotenberg/gotenberg/v8/cmd.Version=$(cat ~/.gotenberg)'" \ + cmd/gotenberg/main.go +msg_ok "Built Gotenberg" + +msg_info "Creating Service" +cat </etc/systemd/system/gotenberg.service +[Unit] +Description=Gotenberg +Documentation=https://gotenberg.dev +After=network.target + +[Service] +Type=simple +User=root +Environment=LANG=C.UTF-8 +Environment=LC_ALL=C.UTF-8 +Environment=PDFTK_BIN_PATH=/usr/bin/pdftk +Environment=QPDF_BIN_PATH=/usr/bin/qpdf +Environment=EXIFTOOL_BIN_PATH=/usr/bin/exiftool +Environment=PDFCPU_BIN_PATH=/usr/local/bin/pdfcpu +Environment=CHROMIUM_BIN_PATH=/usr/bin/chromium +Environment=CHROMIUM_HYPHEN_DATA_DIR_PATH=/opt/gotenberg/build/chromium-hyphen-data +Environment=LIBREOFFICE_BIN_PATH=/usr/lib/libreoffice/program/soffice.bin +Environment=UNOCONVERTER_BIN_PATH=/usr/local/bin/unoconverter +Environment=OTEL_TRACES_EXPORTER=none +Environment=OTEL_METRICS_EXPORTER=none +Environment=OTEL_LOGS_EXPORTER=none +ExecStart=/usr/local/bin/gotenberg --api-port=3000 +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now gotenberg +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc