cleanup
This commit is contained in:
parent
e104f11fb0
commit
edebef1243
@ -1,58 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/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://komo.do
|
|
||||||
|
|
||||||
APP="Alpine-Komodo"
|
|
||||||
var_tags="${var_tags:-docker,alpine}"
|
|
||||||
var_cpu="${var_cpu:-1}"
|
|
||||||
var_ram="${var_ram:-1024}"
|
|
||||||
var_disk="${var_disk:-10}"
|
|
||||||
var_os="${var_os:-alpine}"
|
|
||||||
var_version="${var_version:-3.22}"
|
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
|
||||||
|
|
||||||
header_info "$APP"
|
|
||||||
variables
|
|
||||||
color
|
|
||||||
catch_errors
|
|
||||||
|
|
||||||
function update_script() {
|
|
||||||
[[ -d /opt/komodo ]] || {
|
|
||||||
msg_error "No ${APP} Installation Found!"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
msg_info "Updating ${APP}"
|
|
||||||
COMPOSE_FILE=$(find /opt/komodo -maxdepth 1 -type f -name '*.compose.yaml' ! -name 'compose.env' | head -n1)
|
|
||||||
if [[ -z "$COMPOSE_FILE" ]]; then
|
|
||||||
msg_error "No valid compose file found in /opt/komodo!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
COMPOSE_BASENAME=$(basename "$COMPOSE_FILE")
|
|
||||||
BACKUP_FILE="/opt/komodo/${COMPOSE_BASENAME}.bak_$(date +%Y%m%d_%H%M%S)"
|
|
||||||
cp "$COMPOSE_FILE" "$BACKUP_FILE" || {
|
|
||||||
msg_error "Failed to create backup of ${COMPOSE_BASENAME}!"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
GITHUB_URL="https://raw.githubusercontent.com/moghtech/komodo/main/compose/${COMPOSE_BASENAME}"
|
|
||||||
if ! curl -fsSL "$GITHUB_URL" -o "$COMPOSE_FILE"; then
|
|
||||||
msg_error "Failed to download ${COMPOSE_BASENAME} from GitHub!"
|
|
||||||
mv "$BACKUP_FILE" "$COMPOSE_FILE"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
$STD docker compose -p komodo -f "$COMPOSE_FILE" --env-file /opt/komodo/compose.env up -d
|
|
||||||
msg_ok "Updated ${APP}"
|
|
||||||
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}:9120${CL}"
|
|
@ -1,58 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
|
||||||
# Author: Slaviša Arežina (tremor021) | Co-Author: Stavros (steveiliop56)
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
||||||
# Source: https://github.com/steveiliop56/tinyauth
|
|
||||||
|
|
||||||
APP="Alpine-Tinyauth"
|
|
||||||
var_tags="${var_tags:-alpine;auth}"
|
|
||||||
var_cpu="${var_cpu:-1}"
|
|
||||||
var_ram="${var_ram:-256}"
|
|
||||||
var_disk="${var_disk:-2}"
|
|
||||||
var_os="${var_os:-alpine}"
|
|
||||||
var_version="${var_version:-3.22}"
|
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
|
||||||
|
|
||||||
header_info "$APP"
|
|
||||||
variables
|
|
||||||
color
|
|
||||||
catch_errors
|
|
||||||
|
|
||||||
function update_script() {
|
|
||||||
if [[ ! -d /opt/tinyauth ]]; then
|
|
||||||
msg_error "No ${APP} Installation Found!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
msg_info "Updating packages"
|
|
||||||
$STD apk -U upgrade
|
|
||||||
msg_ok "Updated packages"
|
|
||||||
|
|
||||||
msg_info "Updating Tinyauth"
|
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
|
||||||
|
|
||||||
if [ "${RELEASE}" != "$(cat /opt/tinyauth_version.txt)" ] || [ ! -f /opt/tinyauth_version.txt ]; then
|
|
||||||
$STD service tinyauth stop
|
|
||||||
rm -f /opt/tinyauth/tinyauth
|
|
||||||
curl -fsSL "https://github.com/steveiliop56/tinyauth/releases/download/v${RELEASE}/tinyauth-amd64" -o /opt/tinyauth/tinyauth
|
|
||||||
chmod +x /opt/tinyauth/tinyauth
|
|
||||||
echo "${RELEASE}" >/opt/tinyauth_version.txt
|
|
||||||
msg_info "Restarting Tinyauth"
|
|
||||||
$STD service tinyauth start
|
|
||||||
msg_ok "Restarted Tinyauth"
|
|
||||||
msg_ok "Updated Tinyauth"
|
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
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}:3000${CL}"
|
|
62
ct/stirling-pdf.sh
Normal file
62
ct/stirling-pdf.sh
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||||
|
# Copyright (c) 2021-2025 tteck
|
||||||
|
# Author: tteck (tteckster)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://www.stirlingpdf.com/
|
||||||
|
|
||||||
|
APP="Stirling-PDF"
|
||||||
|
var_tags="${var_tags:-pdf-editor}"
|
||||||
|
var_cpu="${var_cpu:-2}"
|
||||||
|
var_ram="${var_ram:-2048}"
|
||||||
|
var_disk="${var_disk:-8}"
|
||||||
|
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/Stirling-PDF ]]; then
|
||||||
|
msg_error "No ${APP} Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
msg_info "Updating ${APP}"
|
||||||
|
systemctl stop stirlingpdf
|
||||||
|
if [[ -n $(dpkg -l | grep -w ocrmypdf) ]] && [[ -z $(dpkg -l | grep -w qpdf) ]]; then
|
||||||
|
$STD apt-get remove -y ocrmypdf
|
||||||
|
$STD apt-get install -y qpdf
|
||||||
|
fi
|
||||||
|
RELEASE=$(curl -fsSL https://api.github.com/repos/Stirling-Tools/Stirling-PDF/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
curl -fsSL "https://github.com/Stirling-Tools/Stirling-PDF/archive/refs/tags/v$RELEASE.tar.gz" -o $(basename "https://github.com/Stirling-Tools/Stirling-PDF/archive/refs/tags/v$RELEASE.tar.gz")
|
||||||
|
tar -xzf v$RELEASE.tar.gz
|
||||||
|
cd Stirling-PDF-$RELEASE
|
||||||
|
chmod +x ./gradlew
|
||||||
|
$STD ./gradlew build -x spotlessApply -x spotlessCheck -x test -x sonarqube
|
||||||
|
rm -rf /opt/Stirling-PDF/Stirling-PDF-*.jar
|
||||||
|
cp -r ./stirling-pdf/build/libs/*.jar /opt/Stirling-PDF/Stirling-PDF-$RELEASE.jar
|
||||||
|
cp -r scripts /opt/Stirling-PDF/
|
||||||
|
cp -r pipeline /opt/Stirling-PDF/
|
||||||
|
cp -r stirling-pdf/src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
|
||||||
|
cd ~
|
||||||
|
rm -rf Stirling-PDF-$RELEASE v$RELEASE.tar.gz
|
||||||
|
ln -sf /opt/Stirling-PDF/Stirling-PDF-$RELEASE.jar /opt/Stirling-PDF/Stirling-PDF.jar
|
||||||
|
systemctl start stirlingpdf
|
||||||
|
msg_ok "Updated ${APP} to v$RELEASE"
|
||||||
|
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}"
|
@ -1,79 +0,0 @@
|
|||||||
#!/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://komo.do/
|
|
||||||
|
|
||||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
||||||
color
|
|
||||||
verb_ip6
|
|
||||||
catch_errors
|
|
||||||
setting_up_container
|
|
||||||
network_check
|
|
||||||
update_os
|
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
|
||||||
$STD apk add --no-cache ca-certificates openssl
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
msg_info "Setup Docker Repository"
|
|
||||||
$STD apk add --no-cache docker docker-cli docker-compose openrc
|
|
||||||
msg_ok "Setup Docker Repository"
|
|
||||||
|
|
||||||
msg_info "Enabling Docker Service"
|
|
||||||
$STD rc-update add docker boot
|
|
||||||
$STD service docker start
|
|
||||||
msg_ok "Enabled Docker Service"
|
|
||||||
|
|
||||||
echo "${TAB3}Choose the database for Komodo installation:"
|
|
||||||
echo "${TAB3}1) MongoDB (recommended)"
|
|
||||||
echo "${TAB3}2) SQLite"
|
|
||||||
echo "${TAB3}3) PostgreSQL"
|
|
||||||
read -rp "${TAB3}Enter your choice (default: 1): " DB_CHOICE
|
|
||||||
DB_CHOICE=${DB_CHOICE:-1}
|
|
||||||
|
|
||||||
case $DB_CHOICE in
|
|
||||||
1)
|
|
||||||
DB_COMPOSE_FILE="mongo.compose.yaml"
|
|
||||||
;;
|
|
||||||
2)
|
|
||||||
DB_COMPOSE_FILE="sqlite.compose.yaml"
|
|
||||||
;;
|
|
||||||
3)
|
|
||||||
DB_COMPOSE_FILE="postgres.compose.yaml"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Invalid choice. Defaulting to MongoDB."
|
|
||||||
DB_COMPOSE_FILE="mongo.compose.yaml"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
mkdir -p /opt/komodo
|
|
||||||
cd /opt/komodo
|
|
||||||
curl -fsSL "https://raw.githubusercontent.com/moghtech/komodo/main/compose/$DB_COMPOSE_FILE" -o "$(basename "$DB_COMPOSE_FILE")"
|
|
||||||
|
|
||||||
msg_info "Setup Komodo Environment"
|
|
||||||
curl -fsSL "https://raw.githubusercontent.com/moghtech/komodo/main/compose/compose.env" -o "/opt/komodo/compose.env"
|
|
||||||
DB_PASSWORD=$(openssl rand -base64 16 | tr -d '/+=')
|
|
||||||
PASSKEY=$(openssl rand -base64 24 | tr -d '/+=')
|
|
||||||
WEBHOOK_SECRET=$(openssl rand -base64 24 | tr -d '/+=')
|
|
||||||
JWT_SECRET=$(openssl rand -base64 24 | tr -d '/+=')
|
|
||||||
|
|
||||||
sed -i "s/^KOMODO_DB_USERNAME=.*/KOMODO_DB_USERNAME=komodo_admin/" /opt/komodo/compose.env
|
|
||||||
sed -i "s/^KOMODO_DB_PASSWORD=.*/KOMODO_DB_PASSWORD=${DB_PASSWORD}/" /opt/komodo/compose.env
|
|
||||||
sed -i "s/^KOMODO_PASSKEY=.*/KOMODO_PASSKEY=${PASSKEY}/" /opt/komodo/compose.env
|
|
||||||
sed -i "s/^KOMODO_WEBHOOK_SECRET=.*/KOMODO_WEBHOOK_SECRET=${WEBHOOK_SECRET}/" /opt/komodo/compose.env
|
|
||||||
sed -i "s/^KOMODO_JWT_SECRET=.*/KOMODO_JWT_SECRET=${JWT_SECRET}/" /opt/komodo/compose.env
|
|
||||||
msg_ok "Setup Komodo Environment"
|
|
||||||
|
|
||||||
msg_info "Initialize Komodo"
|
|
||||||
$STD docker compose -p komodo -f "/opt/komodo/$DB_COMPOSE_FILE" --env-file /opt/komodo/compose.env up -d
|
|
||||||
msg_ok "Initialized Komodo"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
|
||||||
$STD apk cache clean
|
|
||||||
msg_ok "Cleaned"
|
|
@ -1,90 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
|
||||||
# Author: Slaviša Arežina (tremor021) | Co-Author: Stavros (steveiliop56)
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
||||||
# Source: https://github.com/steveiliop56/tinyauth
|
|
||||||
|
|
||||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
||||||
color
|
|
||||||
verb_ip6
|
|
||||||
catch_errors
|
|
||||||
setting_up_container
|
|
||||||
network_check
|
|
||||||
update_os
|
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
|
||||||
$STD apk add --no-cache curl openssl apache2-utils
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
msg_info "Installing Tinyauth"
|
|
||||||
mkdir -p /opt/tinyauth
|
|
||||||
|
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/steveiliop56/tinyauth/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
|
||||||
curl -fsSL "https://github.com/steveiliop56/tinyauth/releases/download/v${RELEASE}/tinyauth-amd64" -o /opt/tinyauth/tinyauth
|
|
||||||
chmod +x /opt/tinyauth/tinyauth
|
|
||||||
|
|
||||||
PASSWORD=$(openssl rand -base64 8 | tr -dc 'a-zA-Z0-9' | head -c 8)
|
|
||||||
USER=$(htpasswd -Bbn "tinyauth" "${PASSWORD}")
|
|
||||||
|
|
||||||
cat <<EOF > /opt/tinyauth/credentials.txt
|
|
||||||
Tinyauth Credentials
|
|
||||||
Username: tinyauth
|
|
||||||
Password: ${PASSWORD}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "${RELEASE}" >/opt/tinyauth_version.txt
|
|
||||||
msg_ok "Installed Tinyauth"
|
|
||||||
|
|
||||||
read -p "${TAB3}Enter your Tinyauth subdomain (e.g. https://tinyauth.example.com): " app_url
|
|
||||||
|
|
||||||
msg_info "Creating Tinyauth Service"
|
|
||||||
SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | head -c 32)
|
|
||||||
|
|
||||||
cat <<EOF >/opt/tinyauth/.env
|
|
||||||
SECRET=${SECRET}
|
|
||||||
USERS=${USER}
|
|
||||||
APP_URL=${app_url}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
sed -i -e 's/\$/\$\$/g' /opt/tinyauth/.env
|
|
||||||
|
|
||||||
cat <<'EOF' >/etc/init.d/tinyauth
|
|
||||||
#!/sbin/openrc-run
|
|
||||||
description="Tinyauth Service"
|
|
||||||
|
|
||||||
command="/opt/tinyauth/tinyauth"
|
|
||||||
directory="/opt/tinyauth"
|
|
||||||
command_user="root"
|
|
||||||
command_background="true"
|
|
||||||
pidfile="/var/run/tinyauth.pid"
|
|
||||||
|
|
||||||
start_pre() {
|
|
||||||
if [ -f "/opt/tinyauth/.env" ]; then
|
|
||||||
while IFS= read -r line || [ -n "$line" ]; do
|
|
||||||
[ -z "$line" ] && continue
|
|
||||||
case "$line" in
|
|
||||||
'#'*)
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
export "$line"
|
|
||||||
done < "/opt/tinyauth/.env"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
depend() {
|
|
||||||
use net
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
chmod +x /etc/init.d/tinyauth
|
|
||||||
$STD rc-update add tinyauth default
|
|
||||||
msg_ok "Enabled Tinyauth Service"
|
|
||||||
|
|
||||||
msg_info "Starting Tinyauth"
|
|
||||||
$STD service tinyauth start
|
|
||||||
msg_ok "Started Tinyauth"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
@ -1,114 +0,0 @@
|
|||||||
#!/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/ZoeyVid/NPMplus
|
|
||||||
|
|
||||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
||||||
color
|
|
||||||
verb_ip6
|
|
||||||
catch_errors
|
|
||||||
setting_up_container
|
|
||||||
network_check
|
|
||||||
update_os
|
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
|
||||||
$STD apk add \
|
|
||||||
tzdata \
|
|
||||||
gawk \
|
|
||||||
yq
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
msg_info "Installing Docker & Compose"
|
|
||||||
$STD apk add docker
|
|
||||||
$STD rc-service docker start
|
|
||||||
$STD rc-update add docker default
|
|
||||||
|
|
||||||
get_latest_release() {
|
|
||||||
curl -fsSL https://api.github.com/repos/$1/releases/latest | grep '"tag_name":' | cut -d'"' -f4
|
|
||||||
}
|
|
||||||
DOCKER_COMPOSE_LATEST_VERSION=$(get_latest_release "docker/compose")
|
|
||||||
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
|
|
||||||
mkdir -p $DOCKER_CONFIG/cli-plugins
|
|
||||||
curl -fsSL https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_LATEST_VERSION/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
|
|
||||||
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
|
|
||||||
msg_ok "Installed Docker & Compose"
|
|
||||||
|
|
||||||
msg_info "Fetching NPMplus"
|
|
||||||
cd /opt
|
|
||||||
curl -fsSL "https://raw.githubusercontent.com/ZoeyVid/NPMplus/refs/heads/develop/compose.yaml" -o compose.yaml
|
|
||||||
msg_ok "Fetched NPMplus"
|
|
||||||
|
|
||||||
attempts=0
|
|
||||||
while true; do
|
|
||||||
read -r -p "${TAB3}Enter your TZ Identifier (e.g., Europe/Berlin): " TZ_INPUT
|
|
||||||
if validate_tz "$TZ_INPUT"; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
msg_error "Invalid timezone! Please enter a valid TZ identifier."
|
|
||||||
|
|
||||||
attempts=$((attempts + 1))
|
|
||||||
if [[ "$attempts" -ge 3 ]]; then
|
|
||||||
msg_error "Maximum attempts reached. Exiting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
read -r -p "${TAB3}Enter your ACME Email: " ACME_EMAIL_INPUT
|
|
||||||
|
|
||||||
yq -i "
|
|
||||||
.services.npmplus.environment |=
|
|
||||||
(map(select(. != \"TZ=*\" and . != \"ACME_EMAIL=*\")) +
|
|
||||||
[\"TZ=$TZ_INPUT\", \"ACME_EMAIL=$ACME_EMAIL_INPUT\"])
|
|
||||||
" /opt/compose.yaml
|
|
||||||
|
|
||||||
msg_info "Building and Starting NPMplus (Patience)"
|
|
||||||
$STD docker compose up -d
|
|
||||||
CONTAINER_ID=""
|
|
||||||
for i in {1..60}; do
|
|
||||||
CONTAINER_ID=$(docker ps --filter "name=npmplus" --format "{{.ID}}")
|
|
||||||
if [[ -n "$CONTAINER_ID" ]]; then
|
|
||||||
STATUS=$(docker inspect --format '{{.State.Health.Status}}' "$CONTAINER_ID" 2>/dev/null || echo "starting")
|
|
||||||
if [[ "$STATUS" == "healthy" ]]; then
|
|
||||||
msg_ok "NPMplus is running and healthy"
|
|
||||||
break
|
|
||||||
elif [[ "$STATUS" == "unhealthy" ]]; then
|
|
||||||
msg_error "NPMplus container is unhealthy! Check logs."
|
|
||||||
docker logs "$CONTAINER_ID"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
sleep 2
|
|
||||||
[[ $i -eq 60 ]] && msg_error "NPMplus container did not become healthy within 120s." && docker logs "$CONTAINER_ID" && exit 1
|
|
||||||
done
|
|
||||||
msg_ok "Builded and started NPMplus"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
|
|
||||||
msg_info "Retrieving Default Login (Patience)"
|
|
||||||
LOGFILE="/tmp/npmplus.log"
|
|
||||||
docker logs "$CONTAINER_ID" &>"$LOGFILE" &
|
|
||||||
|
|
||||||
PASSWORD_FOUND=0
|
|
||||||
for i in {1..60}; do
|
|
||||||
if grep -q "Creating a new user:" "$LOGFILE"; then
|
|
||||||
PASSWORD_LINE=$(grep "Creating a new user:" "$LOGFILE" | head -n1)
|
|
||||||
PASSWORD=$(echo "$PASSWORD_LINE" | awk -F 'password: ' '{print $2}')
|
|
||||||
if [[ -n "$PASSWORD" ]]; then
|
|
||||||
echo -e "username: admin@example.org\npassword: $PASSWORD" >/opt/.npm_pwd
|
|
||||||
msg_ok "Saved default login to /opt/.npm_pwd"
|
|
||||||
PASSWORD_FOUND=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ $PASSWORD_FOUND -eq 0 ]]; then
|
|
||||||
msg_error "Could not retrieve default login after 60 seconds."
|
|
||||||
echo -e "\nYou can manually try:\n docker logs $CONTAINER_ID | grep 'Creating a new user:'\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f "$LOGFILE"
|
|
154
install/stirling-pdf-install.sh
Normal file
154
install/stirling-pdf-install.sh
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2025 tteck
|
||||||
|
# Author: tteck (tteckster)
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://www.stirlingpdf.com/
|
||||||
|
|
||||||
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
|
color
|
||||||
|
verb_ip6
|
||||||
|
catch_errors
|
||||||
|
setting_up_container
|
||||||
|
network_check
|
||||||
|
update_os
|
||||||
|
|
||||||
|
msg_info "Installing Dependencies (Patience)"
|
||||||
|
$STD apt-get install -y \
|
||||||
|
git \
|
||||||
|
automake \
|
||||||
|
autoconf \
|
||||||
|
libtool \
|
||||||
|
libleptonica-dev \
|
||||||
|
pkg-config \
|
||||||
|
zlib1g-dev \
|
||||||
|
make \
|
||||||
|
g++ \
|
||||||
|
unpaper \
|
||||||
|
qpdf \
|
||||||
|
poppler-utils
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
msg_info "Installing LibreOffice Components"
|
||||||
|
$STD apt-get install -y \
|
||||||
|
libreoffice-writer \
|
||||||
|
libreoffice-calc \
|
||||||
|
libreoffice-impress \
|
||||||
|
libreoffice-core \
|
||||||
|
libreoffice-common \
|
||||||
|
libreoffice-base-core \
|
||||||
|
python3-uno
|
||||||
|
msg_ok "Installed LibreOffice Components"
|
||||||
|
|
||||||
|
msg_info "Installing Python Dependencies"
|
||||||
|
$STD apt-get install -y \
|
||||||
|
python3 \
|
||||||
|
python3-pip
|
||||||
|
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
||||||
|
$STD pip3 install \
|
||||||
|
uno \
|
||||||
|
opencv-python-headless \
|
||||||
|
unoconv \
|
||||||
|
pngquant \
|
||||||
|
WeasyPrint
|
||||||
|
msg_ok "Installed Python Dependencies"
|
||||||
|
|
||||||
|
msg_info "Installing Azul Zulu"
|
||||||
|
curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xB1998361219BD9C9" -o "/etc/apt/trusted.gpg.d/zulu-repo.asc"
|
||||||
|
curl -fsSL "https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb" -o "/zulu-repo_1.0.0-3_all.deb"
|
||||||
|
$STD dpkg -i zulu-repo_1.0.0-3_all.deb
|
||||||
|
$STD apt-get update
|
||||||
|
$STD apt-get -y install zulu17-jdk
|
||||||
|
msg_ok "Installed Azul Zulu"
|
||||||
|
|
||||||
|
msg_info "Installing JBIG2"
|
||||||
|
$STD git clone https://github.com/agl/jbig2enc /opt/jbig2enc
|
||||||
|
cd /opt/jbig2enc
|
||||||
|
$STD bash ./autogen.sh
|
||||||
|
$STD bash ./configure
|
||||||
|
$STD make
|
||||||
|
$STD make install
|
||||||
|
msg_ok "Installed JBIG2"
|
||||||
|
|
||||||
|
msg_info "Installing Language Packs (Patience)"
|
||||||
|
$STD apt-get install -y 'tesseract-ocr-*'
|
||||||
|
msg_ok "Installed Language Packs"
|
||||||
|
|
||||||
|
msg_info "Installing Stirling-PDF (Additional Patience)"
|
||||||
|
RELEASE=$(curl -fsSL https://api.github.com/repos/Stirling-Tools/Stirling-PDF/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
curl -fsSL "https://github.com/Stirling-Tools/Stirling-PDF/archive/refs/tags/v${RELEASE}.tar.gz" -o "v${RELEASE}.tar.gz"
|
||||||
|
tar -xzf v${RELEASE}.tar.gz
|
||||||
|
cd Stirling-PDF-$RELEASE
|
||||||
|
chmod +x ./gradlew
|
||||||
|
$STD ./gradlew build -x spotlessApply -x spotlessCheck -x test -x sonarqube
|
||||||
|
mkdir -p /opt/Stirling-PDF
|
||||||
|
touch /opt/Stirling-PDF/.env
|
||||||
|
mv ./stirling-pdf/build/libs/*.jar /opt/Stirling-PDF/Stirling-PDF-$RELEASE.jar
|
||||||
|
mv scripts /opt/Stirling-PDF/
|
||||||
|
mv pipeline /opt/Stirling-PDF/
|
||||||
|
mv stirling-pdf/src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
|
||||||
|
ln -s /opt/Stirling-PDF/Stirling-PDF-$RELEASE.jar /opt/Stirling-PDF/Stirling-PDF.jar
|
||||||
|
ln -s /usr/share/tesseract-ocr/5/tessdata/ /usr/share/tessdata
|
||||||
|
msg_ok "Installed Stirling-PDF"
|
||||||
|
|
||||||
|
msg_info "Creating Service"
|
||||||
|
# Create LibreOffice listener service
|
||||||
|
cat <<EOF >/etc/systemd/system/libreoffice-listener.service
|
||||||
|
[Unit]
|
||||||
|
Description=LibreOffice Headless Listener Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
ExecStart=/usr/lib/libreoffice/program/soffice --headless --invisible --nodefault --nofirststartwizard --nolockcheck --nologo --accept="socket,host=127.0.0.1,port=2002;urp;StarOffice.ComponentContext"
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Set up environment variables
|
||||||
|
cat <<EOF >/opt/Stirling-PDF/.env
|
||||||
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/libreoffice/program
|
||||||
|
UNO_PATH=/usr/lib/libreoffice/program
|
||||||
|
PYTHONPATH=/usr/lib/python3/dist-packages:/usr/lib/libreoffice/program
|
||||||
|
LD_LIBRARY_PATH=/usr/lib/libreoffice/program
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF >/etc/systemd/system/stirlingpdf.service
|
||||||
|
[Unit]
|
||||||
|
Description=Stirling-PDF service
|
||||||
|
After=syslog.target network.target libreoffice-listener.service
|
||||||
|
Requires=libreoffice-listener.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
SuccessExitStatus=143
|
||||||
|
Type=simple
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
EnvironmentFile=/opt/Stirling-PDF/.env
|
||||||
|
WorkingDirectory=/opt/Stirling-PDF
|
||||||
|
ExecStart=/usr/bin/java -jar Stirling-PDF.jar
|
||||||
|
ExecStop=/bin/kill -15 %n
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Enable and start services
|
||||||
|
systemctl enable -q --now libreoffice-listener
|
||||||
|
systemctl enable -q --now stirlingpdf
|
||||||
|
msg_ok "Created Service"
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -rf v${RELEASE}.tar.gz /zulu-repo_1.0.0-3_all.deb
|
||||||
|
$STD apt-get -y autoremove
|
||||||
|
$STD apt-get -y autoclean
|
||||||
|
msg_ok "Cleaned"
|
Loading…
x
Reference in New Issue
Block a user