From 0d382b9b6a1b83f4a773374d95e95b30668163c1 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Mon, 26 Jan 2026 13:14:47 +0100 Subject: [PATCH] ghost test --- ct/ghost.sh | 55 ++++++++++++++++++++++++++++++++++++++++ install/ghost-install.sh | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 ct/ghost.sh create mode 100644 install/ghost-install.sh diff --git a/ct/ghost.sh b/ct/ghost.sh new file mode 100644 index 000000000..31fa44237 --- /dev/null +++ b/ct/ghost.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2026 community-scripts ORG +# Author: fabrice1236 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://ghost.org/ + +APP="Ghost" +var_tags="${var_tags:-cms;blog}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-1024}" +var_disk="${var_disk:-5}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + setup_mariadb + NODE_VERSION="22" setup_nodejs + + msg_info "Updating Ghost" + if command -v ghost &>/dev/null; then + current_version=$(ghost version | grep 'Ghost-CLI version' | awk '{print $3}') + latest_version=$(npm show ghost-cli version) + if [ "$current_version" != "$latest_version" ]; then + msg_info "Updating ${APP} from version v${current_version} to v${latest_version}" + $STD npm install -g ghost-cli@latest + msg_ok "Updated successfully!" + else + msg_ok "${APP} is already at v${current_version}" + fi + else + msg_error "No ${APP} Installation Found!" + exit + 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}:2368${CL}" diff --git a/install/ghost-install.sh b/install/ghost-install.sh new file mode 100644 index 000000000..d97de4f31 --- /dev/null +++ b/install/ghost-install.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: fabrice1236 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://ghost.org/ + +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 \ + nginx \ + ca-certificates \ + libjemalloc2 +msg_ok "Installed Dependencies" + +setup_mariadb +MARIADB_DB_NAME="ghost" MARIADB_DB_USER="ghostuser" setup_mariadb_db +NODE_VERSION="22" setup_nodejs + +msg_info "Installing Ghost CLI" +$STD npm install ghost-cli@latest -g +msg_ok "Installed Ghost CLI" + +msg_info "Creating Service" +$STD adduser --disabled-password --gecos "Ghost user" ghost-user +$STD usermod -aG sudo ghost-user +echo "ghost-user ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/ghost-user +mkdir -p /var/www/ghost +chown -R ghost-user:ghost-user /var/www/ghost +chmod 775 /var/www/ghost +$STD sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=$MARIADB_DB_USER --dbpass=$MARIADB_DB_PASS --dbname=$MARIADB_DB_NAME --url=http://localhost:2368 --no-prompt --no-setup-nginx --no-setup-ssl --no-setup-mysql --enable --start --ip 0.0.0.0" +rm /etc/sudoers.d/ghost-user +msg_ok "Creating Service" + +motd_ssh +customize +cleanup_lxc