From 530e94be8c6d82d8ec9f9b8bfbc1fa006b92f15e Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Mon, 6 Jan 2025 18:35:45 +0100 Subject: [PATCH 01/37] add Ghost installation and update scripts --- ct/ghost.sh | 60 ++++++++++++++++++++++ install/ghost-install.sh | 105 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 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 00000000..4d301602 --- /dev/null +++ b/ct/ghost.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# shellcheck disable=SC1090 +source <(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/head/ghost/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: fabrice1236 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://ghost.org/ + +# App Default Values +APP="Ghost" +var_tags="cms;blog" +var_cpu="2" +var_ram="1024" +var_disk="4" +var_os="ubuntu" +var_version="20.04" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -f /etc/apt/sources.list.d/homebridge.list ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating ${APP} LXC" + # CHECK FOR NPM HERE ! + if command -v ghost &> /dev/null; then + current_version=$(ghost --version | awk '{print $2}') + latest_version=$(npm show ghost-cli version) + if [ "$current_version" != "$latest_version" ]; then + msg_info "Updating ${APP} from version $current_version to $latest_version" + npm install -g ghost-cli@latest &> /dev/null + else + msg_ok "${APP} is already up-to-date (version $current_version)" + fi + else + msg_error "No ${APP} Installation Found!" + exit + fi + msg_ok "Updated Successfully" + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" \ No newline at end of file diff --git a/install/ghost-install.sh b/install/ghost-install.sh new file mode 100644 index 00000000..ce3042be --- /dev/null +++ b/install/ghost-install.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: fabrice1236 +# License: MIT +# Source: https://ghost.org/ + +# Import Functions und Setup +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + + +####ADD user ? + + +# Installing Dependencies with the 3 core dependencies (curl;sudo;mc) +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + sudo \ + mc \ + nginx \ + mysql-server \ + ca-certificates \ + gnupg +msg_ok "Installed Dependencies" + + +#allow nginx through firewall +$STD ufw allow 'Nginx Full' + +# Enter mysql +$STD mysql +# Update permissions +$STD ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'ghost'; +# Reread permissions +$STD FLUSH PRIVILEGES; +# exit mysql +$STD exit + + + + +msg_info "Setting up Node.js Repository" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +msg_ok "Set up Node.js Repository" + +msg_info "Installing Node.js" +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" + +msg_info "Installing npm" +$STD apt-get install -y npm +msg_ok "Installed npm" + + +$STD npm install ghost-cli@latest -g + +msg_info "Setting up Ghost" +mkdir -p /var/www/ghost +chown -R $USER:$USER /var/www/ghost +chmod 775 /var/www/ghost +cd /var/www/ghost + + +ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --no-prompt --no-setup-linux-user --no-setup-nginx --no-setup-ssl --no-setup-systemd +msg_ok "Ghost setup completed" + +# Creating Service (if needed) +msg_info "Creating Service" +cat </etc/systemd/system/${APPLICATION}.service +[Unit] +Description=${APPLICATION} Service +After=network.target + +[Service] +ExecStart=/usr/bin/ghost run +WorkingDirectory=/var/www/ghost +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now ${APPLICATION}.service +msg_ok "Created Service" + +motd_ssh +customize + +# Cleanup +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" + +motd_ssh +customize \ No newline at end of file From 110529f8d9d77cb7dba96c8c4fe6bf7b8e05f281 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Mon, 6 Jan 2025 18:37:29 +0100 Subject: [PATCH 02/37] remove unnecessary installation check --- ct/ghost.sh | 4 ---- install/ghost-install.sh | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index 4d301602..1d55398b 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -29,10 +29,6 @@ function update_script() { header_info check_container_storage check_container_resources - if [[ ! -f /etc/apt/sources.list.d/homebridge.list ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi msg_info "Updating ${APP} LXC" # CHECK FOR NPM HERE ! if command -v ghost &> /dev/null; then diff --git a/install/ghost-install.sh b/install/ghost-install.sh index ce3042be..8d3c759a 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -18,7 +18,7 @@ update_os ####ADD user ? -# Installing Dependencies with the 3 core dependencies (curl;sudo;mc) +# Install Dependencies msg_info "Installing Dependencies" $STD apt-get install -y \ curl \ From 87f9db5862c9b4b2a7bbd15451ac34de08f3148a Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Mon, 6 Jan 2025 18:46:01 +0100 Subject: [PATCH 03/37] Fixed link for testing --- ct/ghost.sh | 2 +- misc/build.func | 10 +++++----- misc/install.func | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index 1d55398b..b5040f77 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # shellcheck disable=SC1090 -source <(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/head/ghost/misc/build.func) +source <(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: fabrice1236 # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE diff --git a/misc/build.func b/misc/build.func index d83c99e8..b9b21d21 100644 --- a/misc/build.func +++ b/misc/build.func @@ -788,9 +788,9 @@ build_container() { TEMP_DIR=$(mktemp -d) pushd $TEMP_DIR >/dev/null if [ "$var_os" == "alpine" ]; then - export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/alpine-install.func)" + export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/head/ghost/misc/alpine-install.func)" else - export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)" + export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/head/ghost/misc/install.func)" fi export CACHER="$APT_CACHER" export CACHER_IP="$APT_CACHER_IP" @@ -820,7 +820,7 @@ build_container() { $PW " # This executes create_lxc.sh and creates the container and .conf file - bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/create_lxc.sh)" || exit + bash -c "$(wget -qLO - https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/head/ghost/ct/create_lxc.sh)" || exit LXC_CONFIG=/etc/pve/lxc/${CTID}.conf if [ "$CT_TYPE" == "0" ]; then @@ -882,7 +882,7 @@ http://dl-cdn.alpinelinux.org/alpine/latest-stable/community EOF' pct exec "$CTID" -- ash -c "apk add bash >/dev/null" fi - lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/$var_install.sh)" || exit + lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/head/ghost/install/$var_install.sh)" || exit } @@ -894,7 +894,7 @@ description() { DESCRIPTION=$(cat < - Logo + Logo

${APP} LXC

diff --git a/misc/install.func b/misc/install.func index 1a3cf5eb..4cfbc21b 100644 --- a/misc/install.func +++ b/misc/install.func @@ -253,6 +253,6 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(wget -qLO - https://github.com/fabrice1236/ProxmoxVE/raw/ghost/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update } From f53e702cd9dfe1eb02a274a5cd166dcb5ab9d972 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Mon, 6 Jan 2025 20:31:30 +0100 Subject: [PATCH 04/37] Set up testing. --- ct/ghost.sh | 12 +++++++++++- misc/build.func | 16 +++++++++++----- misc/install.func | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index b5040f77..0ec3dc4e 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # shellcheck disable=SC1090 -source <(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost/misc/build.func) +source <(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost-testing/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: fabrice1236 # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -52,5 +52,15 @@ start build_container description +# Ensure the container is created before starting it +if pct status "$CT_ID" &>/dev/null; then + msg_info "Starting LXC Container" + pct start "$CT_ID" + msg_ok "Started LXC Container" +else + msg_error "Failed to create LXC Container" + exit 1 +fi + msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" \ No newline at end of file diff --git a/misc/build.func b/misc/build.func index b9b21d21..a8a6a62f 100644 --- a/misc/build.func +++ b/misc/build.func @@ -788,9 +788,9 @@ build_container() { TEMP_DIR=$(mktemp -d) pushd $TEMP_DIR >/dev/null if [ "$var_os" == "alpine" ]; then - export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/head/ghost/misc/alpine-install.func)" + export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost-testing/misc/alpine-install.func)" else - export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/head/ghost/misc/install.func)" + export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost-testing/misc/install.func)" fi export CACHER="$APT_CACHER" export CACHER_IP="$APT_CACHER_IP" @@ -820,7 +820,13 @@ build_container() { $PW " # This executes create_lxc.sh and creates the container and .conf file - bash -c "$(wget -qLO - https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/head/ghost/ct/create_lxc.sh)" || exit + bash -c "$(wget -qLO - https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost-testing/ct/create_lxc.sh)" || exit + + # Ensure the container configuration file is created + if [ ! -f "/etc/pve/lxc/${CTID}.conf" ]; then + msg_error "Failed to create LXC Container configuration file" + exit 1 + fi LXC_CONFIG=/etc/pve/lxc/${CTID}.conf if [ "$CT_TYPE" == "0" ]; then @@ -882,7 +888,7 @@ http://dl-cdn.alpinelinux.org/alpine/latest-stable/community EOF' pct exec "$CTID" -- ash -c "apk add bash >/dev/null" fi - lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/head/ghost/install/$var_install.sh)" || exit + lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost-testing/install/$var_install.sh)" || exit } @@ -894,7 +900,7 @@ description() { DESCRIPTION=$(cat < - Logo + Logo

${APP} LXC

diff --git a/misc/install.func b/misc/install.func index 4cfbc21b..4e74757e 100644 --- a/misc/install.func +++ b/misc/install.func @@ -253,6 +253,6 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(wget -qLO - https://github.com/fabrice1236/ProxmoxVE/raw/ghost/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(wget -qLO - https://github.com/fabrice1236/ProxmoxVE/raw/ghost-testing/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update } From 2c65b7fc9a0c01cb8e1e42b889967b4adc0791a8 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Mon, 6 Jan 2025 20:43:21 +0100 Subject: [PATCH 05/37] Refactor Ghost installation script to streamline MySQL configuration and consolidate Node.js and npm installation steps --- install/ghost-install.sh | 47 ++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 8d3c759a..8f72e70f 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -14,10 +14,6 @@ setting_up_container network_check update_os - -####ADD user ? - - # Install Dependencies msg_info "Installing Dependencies" $STD apt-get install -y \ @@ -30,47 +26,39 @@ $STD apt-get install -y \ gnupg msg_ok "Installed Dependencies" - -#allow nginx through firewall +# Allow nginx through firewall $STD ufw allow 'Nginx Full' -# Enter mysql -$STD mysql -# Update permissions -$STD ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'ghost'; -# Reread permissions -$STD FLUSH PRIVILEGES; -# exit mysql -$STD exit - - - +# Configure MySQL +msg_info "Configuring MySQL" +$STD mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'ghost';" +$STD mysql -u root -e "FLUSH PRIVILEGES;" +msg_ok "Configured MySQL" +# Set up Node.js Repository msg_info "Setting up Node.js Repository" mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list msg_ok "Set up Node.js Repository" -msg_info "Installing Node.js" +# Install Node.js and npm +msg_info "Installing Node.js and npm" $STD apt-get update -$STD apt-get install -y nodejs -msg_ok "Installed Node.js" - -msg_info "Installing npm" -$STD apt-get install -y npm -msg_ok "Installed npm" - +$STD apt-get install -y nodejs npm +msg_ok "Installed Node.js and npm" +# Install Ghost CLI +msg_info "Installing Ghost CLI" $STD npm install ghost-cli@latest -g +msg_ok "Installed Ghost CLI" +# Set up Ghost msg_info "Setting up Ghost" mkdir -p /var/www/ghost chown -R $USER:$USER /var/www/ghost chmod 775 /var/www/ghost cd /var/www/ghost - - ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --no-prompt --no-setup-linux-user --no-setup-nginx --no-setup-ssl --no-setup-systemd msg_ok "Ghost setup completed" @@ -99,7 +87,4 @@ customize msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean -msg_ok "Cleaned" - -motd_ssh -customize \ No newline at end of file +msg_ok "Cleaned" \ No newline at end of file From f69c7259441bc19e2437ffde84f6c5b9595db290 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Mon, 6 Jan 2025 20:48:48 +0100 Subject: [PATCH 06/37] Update MySQL configuration in installation script to use password for flushing privileges --- install/ghost-install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 8f72e70f..01c1d92e 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -32,9 +32,13 @@ $STD ufw allow 'Nginx Full' # Configure MySQL msg_info "Configuring MySQL" $STD mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'ghost';" -$STD mysql -u root -e "FLUSH PRIVILEGES;" +$STD mysql -u root -p'ghost' -e "FLUSH PRIVILEGES;" msg_ok "Configured MySQL" + +Rules updated (v6) + + # Set up Node.js Repository msg_info "Setting up Node.js Repository" mkdir -p /etc/apt/keyrings From e77366fca98e70e7b25b67d7beeb41f2148b5611 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Mon, 6 Jan 2025 20:53:58 +0100 Subject: [PATCH 07/37] Bug fix --- install/ghost-install.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 01c1d92e..dc3d4629 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -36,9 +36,6 @@ $STD mysql -u root -p'ghost' -e "FLUSH PRIVILEGES;" msg_ok "Configured MySQL" -Rules updated (v6) - - # Set up Node.js Repository msg_info "Setting up Node.js Repository" mkdir -p /etc/apt/keyrings From 26cf31b716a8338ec0a868c51823a39e374fc1d4 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Mon, 6 Jan 2025 21:01:05 +0100 Subject: [PATCH 08/37] Remove separate npm installation step --- install/ghost-install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index dc3d4629..1f7889ce 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -43,11 +43,11 @@ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dea echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list msg_ok "Set up Node.js Repository" -# Install Node.js and npm -msg_info "Installing Node.js and npm" +# Install Node.js (includes npm) +msg_info "Installing Node.js" $STD apt-get update -$STD apt-get install -y nodejs npm -msg_ok "Installed Node.js and npm" +$STD apt-get install -y nodejs +msg_ok "Installed Node.js" # Install Ghost CLI msg_info "Installing Ghost CLI" From 0ead0c528fa2a587c57fd22d363be09c8729e5c8 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Mon, 6 Jan 2025 21:11:20 +0100 Subject: [PATCH 09/37] Add ghost-user creation and modify Ghost installation to run as new user --- install/ghost-install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 1f7889ce..78200f27 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -54,13 +54,18 @@ msg_info "Installing Ghost CLI" $STD npm install ghost-cli@latest -g msg_ok "Installed Ghost CLI" + +# Create a new user for Ghost +adduser ghost-user +usermod -aG sudo ghost-user + # Set up Ghost msg_info "Setting up Ghost" mkdir -p /var/www/ghost chown -R $USER:$USER /var/www/ghost chmod 775 /var/www/ghost cd /var/www/ghost -ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --no-prompt --no-setup-linux-user --no-setup-nginx --no-setup-ssl --no-setup-systemd +$STD sudo -u ghost-user ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --no-prompt --no-setup-linux-user --no-setup-nginx --no-setup-ssl --no-setup-systemd msg_ok "Ghost setup completed" # Creating Service (if needed) From 0fd64e22a1ca9abbd1163369834f1f8ff8f615e7 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Mon, 6 Jan 2025 21:19:19 +0100 Subject: [PATCH 10/37] Create ghost-user with proper permissions and update Ghost setup commands --- install/ghost-install.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 78200f27..c50039d4 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -56,16 +56,17 @@ msg_ok "Installed Ghost CLI" # Create a new user for Ghost -adduser ghost-user -usermod -aG sudo ghost-user +msg_info "Creating ghost-user" +$STD adduser --disabled-password --gecos "Ghost user" ghost-user +$STD usermod -aG sudo ghost-user +msg_ok "Created ghost-user" # Set up Ghost msg_info "Setting up Ghost" mkdir -p /var/www/ghost -chown -R $USER:$USER /var/www/ghost +chown -R ghost-user:ghost-user /var/www/ghost chmod 775 /var/www/ghost -cd /var/www/ghost -$STD sudo -u ghost-user ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --no-prompt --no-setup-linux-user --no-setup-nginx --no-setup-ssl --no-setup-systemd +sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --no-prompt --no-setup-linux-user --no-setup-nginx --no-setup-ssl --no-setup-systemd" msg_ok "Ghost setup completed" # Creating Service (if needed) From 4e35e582ebea7cad837a943434ea11db5e64782d Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Mon, 6 Jan 2025 22:01:42 +0100 Subject: [PATCH 11/37] Update Ghost installation script to include URL and modify service execution --- ct/ghost.sh | 5 +++-- install/ghost-install.sh | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index 0ec3dc4e..316fbf71 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -30,9 +30,10 @@ function update_script() { check_container_storage check_container_resources msg_info "Updating ${APP} LXC" - # CHECK FOR NPM HERE ! + # CHECK FOR NPM HERE ! + if command -v ghost &> /dev/null; then - current_version=$(ghost --version | awk '{print $2}') + current_version=$(ghost --version | awk '{print $2}') #TO REVIEW latest_version=$(npm show ghost-cli version) if [ "$current_version" != "$latest_version" ]; then msg_info "Updating ${APP} from version $current_version to $latest_version" diff --git a/install/ghost-install.sh b/install/ghost-install.sh index c50039d4..35d40670 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -66,7 +66,7 @@ msg_info "Setting up Ghost" mkdir -p /var/www/ghost chown -R ghost-user:ghost-user /var/www/ghost chmod 775 /var/www/ghost -sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --no-prompt --no-setup-linux-user --no-setup-nginx --no-setup-ssl --no-setup-systemd" +sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --url=http://localhost:2368 --no-prompt --no-setup-linux-user --no-setup-nginx --no-setup-ssl --no-setup-systemd --no-setup-mysql --no-start --no-enable" msg_ok "Ghost setup completed" # Creating Service (if needed) @@ -77,8 +77,10 @@ Description=${APPLICATION} Service After=network.target [Service] -ExecStart=/usr/bin/ghost run +ExecStart=/usr/bin/ghost start WorkingDirectory=/var/www/ghost +User=ghost-user +Group=ghost-user Restart=always [Install] From 6b92c3b6a96657cfd0090f0adabad3c4249daee3 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Tue, 7 Jan 2025 18:46:22 +0100 Subject: [PATCH 12/37] Update Ghost installation to Ubuntu 24.04 and modify service execution --- ct/ghost.sh | 12 +----------- install/ghost-install.sh | 5 +++-- json/ghost.json | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 json/ghost.json diff --git a/ct/ghost.sh b/ct/ghost.sh index 316fbf71..d8395e98 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -13,7 +13,7 @@ var_cpu="2" var_ram="1024" var_disk="4" var_os="ubuntu" -var_version="20.04" +var_version="24.04" var_unprivileged="1" # App Output & Base Settings @@ -53,15 +53,5 @@ start build_container description -# Ensure the container is created before starting it -if pct status "$CT_ID" &>/dev/null; then - msg_info "Starting LXC Container" - pct start "$CT_ID" - msg_ok "Started LXC Container" -else - msg_error "Failed to create LXC Container" - exit 1 -fi - msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" \ No newline at end of file diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 35d40670..f08ffd78 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -45,7 +45,6 @@ msg_ok "Set up Node.js Repository" # Install Node.js (includes npm) msg_info "Installing Node.js" -$STD apt-get update $STD apt-get install -y nodejs msg_ok "Installed Node.js" @@ -77,7 +76,9 @@ Description=${APPLICATION} Service After=network.target [Service] -ExecStart=/usr/bin/ghost start +Type=simple +Environment="NODE_ENV=production" +ExecStart=/usr/bin/node /usr/bin/ghost run WorkingDirectory=/var/www/ghost User=ghost-user Group=ghost-user diff --git a/json/ghost.json b/json/ghost.json new file mode 100644 index 00000000..79b79585 --- /dev/null +++ b/json/ghost.json @@ -0,0 +1,34 @@ +{ + "name": "Ghost", + "slug": "ghost", + "categories": [ + 12 + ], + "date_created": "2025-01-07", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 2368, + "documentation": "https://ghost.org/docs/", + "website": "https://ghost.org", + "logo": "https://raw.githubusercontent.com/TryGhost/Ghost/b6fe724b577e84f7dd174646d0323dabdcdf576e/apps/shade/src/assets/images/ghost-orb.svg", + "description": "Ghost is a powerful app for professional publishers to create, share, and grow a business around their content. It comes with modern tools to build a website, publish content, send newsletters & offer paid subscriptions to members.", + "install_methods": [ + { + "type": "default", + "script": "ct/ghost.sh", + "resources": { + "cpu": 2, + "ram": 1024, + "hdd": 4, + "os": "Ubuntu", + "version": "24.04" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] + } \ No newline at end of file From a5cddebca23a1dc49edad361c1b5d15b0cba115c Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Tue, 7 Jan 2025 18:54:27 +0100 Subject: [PATCH 13/37] Downgrade Ubuntu installation version from 24.04 to 22.04 --- ct/ghost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index d8395e98..11afa79c 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -13,7 +13,7 @@ var_cpu="2" var_ram="1024" var_disk="4" var_os="ubuntu" -var_version="24.04" +var_version="22.04" var_unprivileged="1" # App Output & Base Settings From f8bca784b9e8a13b7edc81438aa28842e6df763f Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Tue, 7 Jan 2025 18:58:06 +0100 Subject: [PATCH 14/37] Add npm installation check to Ghost installation script --- install/ghost-install.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index f08ffd78..7e2b85e1 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -46,6 +46,13 @@ msg_ok "Set up Node.js Repository" # Install Node.js (includes npm) msg_info "Installing Node.js" $STD apt-get install -y nodejs +if ! command -v npm &> /dev/null; then + msg_info "Installing npm" + $STD apt-get install -y npm + msg_ok "Installed npm" +else + msg_ok "npm is already installed" +fi msg_ok "Installed Node.js" # Install Ghost CLI From b8e7388e2082b19d3507db52421f33d94eca979c Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Tue, 7 Jan 2025 19:02:46 +0100 Subject: [PATCH 15/37] Update Ghost installation script to install npm alongside Node.js --- install/ghost-install.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 7e2b85e1..4fe49581 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -44,16 +44,10 @@ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.co msg_ok "Set up Node.js Repository" # Install Node.js (includes npm) -msg_info "Installing Node.js" +msg_info "Installing Node.js and npm" $STD apt-get install -y nodejs -if ! command -v npm &> /dev/null; then - msg_info "Installing npm" - $STD apt-get install -y npm - msg_ok "Installed npm" -else - msg_ok "npm is already installed" -fi -msg_ok "Installed Node.js" +$STD apt-get install -y npm +msg_ok "Installed Node.js and npm" # Install Ghost CLI msg_info "Installing Ghost CLI" From 03bffdd0630d812fb1697a47a48c5e1319118a54 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Tue, 7 Jan 2025 19:15:12 +0100 Subject: [PATCH 16/37] Add update to package list --- install/ghost-install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 4fe49581..ee4e43cc 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -45,8 +45,9 @@ msg_ok "Set up Node.js Repository" # Install Node.js (includes npm) msg_info "Installing Node.js and npm" +$STD apt-get update $STD apt-get install -y nodejs -$STD apt-get install -y npm +# $STD apt-get install -y npm msg_ok "Installed Node.js and npm" # Install Ghost CLI From 3cbc4768cd14f810a1da9932a80f65e4646e3747 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Tue, 7 Jan 2025 20:58:30 +0100 Subject: [PATCH 17/37] Use ghost-cli's systemd set up --- install/ghost-install.sh | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index ee4e43cc..3b295ffc 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -67,30 +67,30 @@ msg_info "Setting up Ghost" mkdir -p /var/www/ghost chown -R ghost-user:ghost-user /var/www/ghost chmod 775 /var/www/ghost -sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --url=http://localhost:2368 --no-prompt --no-setup-linux-user --no-setup-nginx --no-setup-ssl --no-setup-systemd --no-setup-mysql --no-start --no-enable" +sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --url=http://localhost:2368 --no-prompt --no-setup-nginx --no-setup-ssl --no-setup-mysql --no-start" msg_ok "Ghost setup completed" # Creating Service (if needed) -msg_info "Creating Service" -cat </etc/systemd/system/${APPLICATION}.service -[Unit] -Description=${APPLICATION} Service -After=network.target +# msg_info "Creating Service" +# cat </etc/systemd/system/${APPLICATION}.service +# [Unit] +# Description=${APPLICATION} Service +# After=network.target -[Service] -Type=simple -Environment="NODE_ENV=production" -ExecStart=/usr/bin/node /usr/bin/ghost run -WorkingDirectory=/var/www/ghost -User=ghost-user -Group=ghost-user -Restart=always +# [Service] +# Type=simple +# Environment="NODE_ENV=production" +# ExecStart=/usr/bin/node /usr/bin/ghost run +# WorkingDirectory=/var/www/ghost +# User=ghost-user +# Group=ghost-user +# Restart=always -[Install] -WantedBy=multi-user.target -EOF -systemctl enable -q --now ${APPLICATION}.service -msg_ok "Created Service" +# [Install] +# WantedBy=multi-user.target +# EOF +# systemctl enable -q --now ${APPLICATION}.service +# msg_ok "Created Service" motd_ssh customize From 5ba31738691ee3268e7692ebeaa2889a5919d999 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Tue, 7 Jan 2025 21:38:56 +0100 Subject: [PATCH 18/37] Add NOPASSWD for ghost-user during install and enable Ghost on all interfaces --- ct/ghost.sh | 7 ++++--- install/ghost-install.sh | 25 +++---------------------- json/ghost.json | 2 +- 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index 11afa79c..354fde0b 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -11,7 +11,7 @@ APP="Ghost" var_tags="cms;blog" var_cpu="2" var_ram="1024" -var_disk="4" +var_disk="5" var_os="ubuntu" var_version="22.04" var_unprivileged="1" @@ -30,7 +30,6 @@ function update_script() { check_container_storage check_container_resources msg_info "Updating ${APP} LXC" - # CHECK FOR NPM HERE ! if command -v ghost &> /dev/null; then current_version=$(ghost --version | awk '{print $2}') #TO REVIEW @@ -54,4 +53,6 @@ build_container description msg_ok "Completed Successfully!\n" -echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" \ No newline at end of file +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}" \ No newline at end of file diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 3b295ffc..41dc4499 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -60,6 +60,7 @@ msg_ok "Installed Ghost CLI" msg_info "Creating ghost-user" $STD adduser --disabled-password --gecos "Ghost user" ghost-user $STD usermod -aG sudo ghost-user +echo "ghost-user ALL=(ALL) NOPASSWD: /usr/bin/ghost" | tee /etc/sudoers.d/ghost-user msg_ok "Created ghost-user" # Set up Ghost @@ -67,30 +68,10 @@ msg_info "Setting up Ghost" mkdir -p /var/www/ghost chown -R ghost-user:ghost-user /var/www/ghost chmod 775 /var/www/ghost -sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --url=http://localhost:2368 --no-prompt --no-setup-nginx --no-setup-ssl --no-setup-mysql --no-start" +sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --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 #Remove ghost-user for sudoers after setup (not required anymore) msg_ok "Ghost setup completed" -# Creating Service (if needed) -# msg_info "Creating Service" -# cat </etc/systemd/system/${APPLICATION}.service -# [Unit] -# Description=${APPLICATION} Service -# After=network.target - -# [Service] -# Type=simple -# Environment="NODE_ENV=production" -# ExecStart=/usr/bin/node /usr/bin/ghost run -# WorkingDirectory=/var/www/ghost -# User=ghost-user -# Group=ghost-user -# Restart=always - -# [Install] -# WantedBy=multi-user.target -# EOF -# systemctl enable -q --now ${APPLICATION}.service -# msg_ok "Created Service" motd_ssh customize diff --git a/json/ghost.json b/json/ghost.json index 79b79585..c0e730ba 100644 --- a/json/ghost.json +++ b/json/ghost.json @@ -20,7 +20,7 @@ "resources": { "cpu": 2, "ram": 1024, - "hdd": 4, + "hdd": 5, "os": "Ubuntu", "version": "24.04" } From 7e4eecaef808c91540f397256df6f9cb01ed2aba Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Tue, 7 Jan 2025 21:59:21 +0100 Subject: [PATCH 19/37] Update ghost-user sudoers configuration to temporarely allow all commands without password --- install/ghost-install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 41dc4499..4ff6fc15 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -60,7 +60,10 @@ msg_ok "Installed Ghost CLI" msg_info "Creating ghost-user" $STD adduser --disabled-password --gecos "Ghost user" ghost-user $STD usermod -aG sudo ghost-user -echo "ghost-user ALL=(ALL) NOPASSWD: /usr/bin/ghost" | tee /etc/sudoers.d/ghost-user +echo "ghost-user ALL=(ALL) NOPASSWD:ALL | tee /etc/sudoers.d/ghost-user + +# echo "ghost-user ALL=(ALL) NOPASSWD:/bin/chown -R ghost:ghost /var/www/ghost/*/content, /bin/mv /tmp/*/ghost_*.service /lib/systemd/system/ghost_*.service, /bin/systemctl daemon-reload, /bin/systemctl is-active ghost_*, /bin/systemctl start ghost_*, /bin/systemctl is-enabled ghost_*, /bin/systemctl enable ghost_* --quiet" | tee /etc/sudoers.d/ghost-user + msg_ok "Created ghost-user" # Set up Ghost From 739b47e9c31f430cee2389b36fdaade79adc7294 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Tue, 7 Jan 2025 22:06:36 +0100 Subject: [PATCH 20/37] Fix syntax error --- install/ghost-install.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 4ff6fc15..a853a686 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -60,10 +60,9 @@ msg_ok "Installed Ghost CLI" msg_info "Creating ghost-user" $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 - -# echo "ghost-user ALL=(ALL) NOPASSWD:/bin/chown -R ghost:ghost /var/www/ghost/*/content, /bin/mv /tmp/*/ghost_*.service /lib/systemd/system/ghost_*.service, /bin/systemctl daemon-reload, /bin/systemctl is-active ghost_*, /bin/systemctl start ghost_*, /bin/systemctl is-enabled ghost_*, /bin/systemctl enable ghost_* --quiet" | tee /etc/sudoers.d/ghost-user +echo "ghost-user ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/ghost-user +# # echo "ghost-user ALL=(ALL) NOPASSWD:/bin/chown -R ghost:ghost /var/www/ghost/*/content, /bin/mv /tmp/*/ghost_*.service /lib/systemd/system/ghost_*.service, /bin/systemctl daemon-reload, /bin/systemctl is-active ghost_*, /bin/systemctl start ghost_*, /bin/systemctl is-enabled ghost_*, /bin/systemctl enable ghost_* --quiet" | tee /etc/sudoers.d/ghost-user msg_ok "Created ghost-user" # Set up Ghost From d402d4a635f338de93639b664b8c4f6f4534774f Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Wed, 8 Jan 2025 20:39:23 +0100 Subject: [PATCH 21/37] Update ghost version retrieval and configure MySQL with random password --- ct/ghost.sh | 2 +- install/ghost-install.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index 354fde0b..76249ff3 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -32,7 +32,7 @@ function update_script() { msg_info "Updating ${APP} LXC" if command -v ghost &> /dev/null; then - current_version=$(ghost --version | awk '{print $2}') #TO REVIEW + 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 $current_version to $latest_version" diff --git a/install/ghost-install.sh b/install/ghost-install.sh index a853a686..a9d1b99c 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -31,8 +31,15 @@ $STD ufw allow 'Nginx Full' # Configure MySQL msg_info "Configuring MySQL" -$STD mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'ghost';" +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +$STD mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY '$DB_PASS';" $STD mysql -u root -p'ghost' -e "FLUSH PRIVILEGES;" + +{ + echo "MySQL-Credentials" + echo "Username: root" + echo "Password: $DB_PASS" +} >> ~/mysql.creds msg_ok "Configured MySQL" From 4d2292a0e44473e41b10001568801b990377d75e Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Thu, 9 Jan 2025 18:19:40 +0100 Subject: [PATCH 22/37] Update ghost.json and clean ghost-install.sh --- install/ghost-install.sh | 4 ++-- json/ghost.json | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index a9d1b99c..a6fd2aa9 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -68,10 +68,10 @@ msg_info "Creating ghost-user" $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 - -# # echo "ghost-user ALL=(ALL) NOPASSWD:/bin/chown -R ghost:ghost /var/www/ghost/*/content, /bin/mv /tmp/*/ghost_*.service /lib/systemd/system/ghost_*.service, /bin/systemctl daemon-reload, /bin/systemctl is-active ghost_*, /bin/systemctl start ghost_*, /bin/systemctl is-enabled ghost_*, /bin/systemctl enable ghost_* --quiet" | tee /etc/sudoers.d/ghost-user msg_ok "Created ghost-user" + + # Set up Ghost msg_info "Setting up Ghost" mkdir -p /var/www/ghost diff --git a/json/ghost.json b/json/ghost.json index c0e730ba..76db9bf4 100644 --- a/json/ghost.json +++ b/json/ghost.json @@ -22,7 +22,7 @@ "ram": 1024, "hdd": 5, "os": "Ubuntu", - "version": "24.04" + "version": "22.04" } } ], @@ -30,5 +30,12 @@ "username": null, "password": null }, - "notes": [] - } \ No newline at end of file + "notes": [ + { + "text": "To run Ghost-CLI commands, first set a password for the ghost-user by running `sudo passwd ghost-user`. Then, switch to the ghost-user with `sudo -su ghost-user`.", + "type": "info" + } + ] +} + + From a72e1d3fd4f09ae7ad738aac00655d20dd765943 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Thu, 9 Jan 2025 18:22:36 +0100 Subject: [PATCH 23/37] Update ghost installation script to use dynamic database password --- install/ghost-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index a6fd2aa9..bdd638ea 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -77,7 +77,7 @@ msg_info "Setting up Ghost" mkdir -p /var/www/ghost chown -R ghost-user:ghost-user /var/www/ghost chmod 775 /var/www/ghost -sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=ghost --dbname=ghost --url=http://localhost:2368 --no-prompt --no-setup-nginx --no-setup-ssl --no-setup-mysql --enable --start --ip 0.0.0.0" +sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=$DBPASS --dbname=ghost --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 #Remove ghost-user for sudoers after setup (not required anymore) msg_ok "Ghost setup completed" From f0d179e7c8db5b368d27e38a9ed859a70d47e4f8 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Thu, 9 Jan 2025 18:26:20 +0100 Subject: [PATCH 24/37] Fix MySQL flush privileges command to use dynamic database password --- install/ghost-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index bdd638ea..6f34e02d 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -33,7 +33,7 @@ $STD ufw allow 'Nginx Full' msg_info "Configuring MySQL" DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) $STD mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY '$DB_PASS';" -$STD mysql -u root -p'ghost' -e "FLUSH PRIVILEGES;" +$STD mysql -u root -p"$DB_PASS" -e "FLUSH PRIVILEGES;" { echo "MySQL-Credentials" From eecde60373c7ed434e8813d7adcbc157668330fa Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Thu, 9 Jan 2025 18:34:44 +0100 Subject: [PATCH 25/37] Fix variable name for database password in ghost installation script --- install/ghost-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 6f34e02d..f0a1972e 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -77,7 +77,7 @@ msg_info "Setting up Ghost" mkdir -p /var/www/ghost chown -R ghost-user:ghost-user /var/www/ghost chmod 775 /var/www/ghost -sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=$DBPASS --dbname=ghost --url=http://localhost:2368 --no-prompt --no-setup-nginx --no-setup-ssl --no-setup-mysql --enable --start --ip 0.0.0.0" +sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=$DB_PASS --dbname=ghost --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 #Remove ghost-user for sudoers after setup (not required anymore) msg_ok "Ghost setup completed" From bad191c4cf30f94e0da712ae169962e04a810059 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Thu, 9 Jan 2025 18:43:18 +0100 Subject: [PATCH 26/37] Add update success message only if ghost was actually updated --- ct/ghost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index 76249ff3..d11a857a 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -37,6 +37,7 @@ function update_script() { if [ "$current_version" != "$latest_version" ]; then msg_info "Updating ${APP} from version $current_version to $latest_version" npm install -g ghost-cli@latest &> /dev/null + msg_ok "Updated Successfully" else msg_ok "${APP} is already up-to-date (version $current_version)" fi @@ -44,7 +45,6 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_ok "Updated Successfully" exit } From 233bbcf7f395ee1d4fdfce68c94c79a8207816b7 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Thu, 9 Jan 2025 18:59:56 +0100 Subject: [PATCH 27/37] Remove unnecessary shellcheck directive from ghost.sh --- ct/ghost.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index d11a857a..e4699269 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 source <(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost-testing/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: fabrice1236 From 46f10e5e8cb99e2304bcff315ed6a6d367949a1b Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Thu, 9 Jan 2025 19:06:43 +0100 Subject: [PATCH 28/37] Change back to community-scripts URLs --- ct/ghost.sh | 2 +- misc/build.func | 16 +++++----------- misc/install.func | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index e4699269..25ad4826 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost-testing/misc/build.func) +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: fabrice1236 # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE diff --git a/misc/build.func b/misc/build.func index a8a6a62f..d83c99e8 100644 --- a/misc/build.func +++ b/misc/build.func @@ -788,9 +788,9 @@ build_container() { TEMP_DIR=$(mktemp -d) pushd $TEMP_DIR >/dev/null if [ "$var_os" == "alpine" ]; then - export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost-testing/misc/alpine-install.func)" + export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/alpine-install.func)" else - export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost-testing/misc/install.func)" + export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)" fi export CACHER="$APT_CACHER" export CACHER_IP="$APT_CACHER_IP" @@ -820,13 +820,7 @@ build_container() { $PW " # This executes create_lxc.sh and creates the container and .conf file - bash -c "$(wget -qLO - https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost-testing/ct/create_lxc.sh)" || exit - - # Ensure the container configuration file is created - if [ ! -f "/etc/pve/lxc/${CTID}.conf" ]; then - msg_error "Failed to create LXC Container configuration file" - exit 1 - fi + bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/create_lxc.sh)" || exit LXC_CONFIG=/etc/pve/lxc/${CTID}.conf if [ "$CT_TYPE" == "0" ]; then @@ -888,7 +882,7 @@ http://dl-cdn.alpinelinux.org/alpine/latest-stable/community EOF' pct exec "$CTID" -- ash -c "apk add bash >/dev/null" fi - lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/fabrice1236/ProxmoxVE/refs/heads/ghost-testing/install/$var_install.sh)" || exit + lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/$var_install.sh)" || exit } @@ -900,7 +894,7 @@ description() { DESCRIPTION=$(cat < - Logo + Logo

${APP} LXC

diff --git a/misc/install.func b/misc/install.func index 4e74757e..1a3cf5eb 100644 --- a/misc/install.func +++ b/misc/install.func @@ -253,6 +253,6 @@ EOF systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') msg_ok "Customized Container" fi - echo "bash -c \"\$(wget -qLO - https://github.com/fabrice1236/ProxmoxVE/raw/ghost-testing/ct/${app}.sh)\"" >/usr/bin/update + echo "bash -c \"\$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update } From 0418f47d0e1ea222744036ea8c0f8197c8d7c63d Mon Sep 17 00:00:00 2001 From: fabrice1236 <87321357+fabrice1236@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:15:58 +0100 Subject: [PATCH 29/37] Update ct/ghost.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- ct/ghost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index 25ad4826..9349ccef 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -34,7 +34,7 @@ function update_script() { 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 $current_version to $latest_version" + msg_info "Updating ${APP} from version v${current_version} to v${latest_version}" npm install -g ghost-cli@latest &> /dev/null msg_ok "Updated Successfully" else From f2187e9b47490b2a347272ccd5dad3734daf342d Mon Sep 17 00:00:00 2001 From: fabrice1236 <87321357+fabrice1236@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:16:16 +0100 Subject: [PATCH 30/37] Update install/ghost-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- install/ghost-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index f0a1972e..599d38ee 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -79,7 +79,7 @@ chown -R ghost-user:ghost-user /var/www/ghost chmod 775 /var/www/ghost sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=$DB_PASS --dbname=ghost --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 #Remove ghost-user for sudoers after setup (not required anymore) -msg_ok "Ghost setup completed" +msg_ok "Creating Service" motd_ssh From 695460a4718d36929a80d0ff49888e8914fda370 Mon Sep 17 00:00:00 2001 From: fabrice1236 <87321357+fabrice1236@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:16:28 +0100 Subject: [PATCH 31/37] Update ct/ghost.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- ct/ghost.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index 9349ccef..5b0bcb2d 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -38,7 +38,7 @@ function update_script() { npm install -g ghost-cli@latest &> /dev/null msg_ok "Updated Successfully" else - msg_ok "${APP} is already up-to-date (version $current_version)" + msg_ok "${APP} is already at v${current_version}" fi else msg_error "No ${APP} Installation Found!" From 0085682ed7275a07f6f44c8131fe19d1ca87cbc1 Mon Sep 17 00:00:00 2001 From: fabrice1236 <87321357+fabrice1236@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:16:37 +0100 Subject: [PATCH 32/37] Update install/ghost-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- install/ghost-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 599d38ee..8bb0087d 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -64,7 +64,7 @@ msg_ok "Installed Ghost CLI" # Create a new user for Ghost -msg_info "Creating ghost-user" +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 From 445969badabe3c18e73770ae2379e82fb3abd4ed Mon Sep 17 00:00:00 2001 From: fabrice1236 <87321357+fabrice1236@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:16:49 +0100 Subject: [PATCH 33/37] Update install/ghost-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- install/ghost-install.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index 8bb0087d..dac8eb88 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -68,12 +68,6 @@ 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 -msg_ok "Created ghost-user" - - - -# Set up Ghost -msg_info "Setting up Ghost" mkdir -p /var/www/ghost chown -R ghost-user:ghost-user /var/www/ghost chmod 775 /var/www/ghost From f45262c05ad2100cc7943282cb51c0e70f2cfc36 Mon Sep 17 00:00:00 2001 From: fabrice1236 <87321357+fabrice1236@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:17:11 +0100 Subject: [PATCH 34/37] Update install/ghost-install.sh Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- install/ghost-install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index dac8eb88..dbeb65e7 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -27,7 +27,6 @@ $STD apt-get install -y \ msg_ok "Installed Dependencies" # Allow nginx through firewall -$STD ufw allow 'Nginx Full' # Configure MySQL msg_info "Configuring MySQL" From 02ca4a75b003540a5633ff090cf84e87575b9f1e Mon Sep 17 00:00:00 2001 From: fabrice1236 <87321357+fabrice1236@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:17:24 +0100 Subject: [PATCH 35/37] Update json/ghost.json Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> --- json/ghost.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json/ghost.json b/json/ghost.json index 76db9bf4..85fae251 100644 --- a/json/ghost.json +++ b/json/ghost.json @@ -4,7 +4,7 @@ "categories": [ 12 ], - "date_created": "2025-01-07", + "date_created": "2025-01-09", "type": "ct", "updateable": true, "privileged": false, From b24b3d526214a607dd9fc2382eedae1ac72d085d Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Thu, 9 Jan 2025 20:24:02 +0100 Subject: [PATCH 36/37] Add link to detailed license + Change to Debian 12 --- ct/ghost.sh | 4 ++-- install/ghost-install.sh | 16 ++++++---------- json/ghost.json | 4 ++-- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ct/ghost.sh b/ct/ghost.sh index 5b0bcb2d..29f748c0 100644 --- a/ct/ghost.sh +++ b/ct/ghost.sh @@ -11,8 +11,8 @@ var_tags="cms;blog" var_cpu="2" var_ram="1024" var_disk="5" -var_os="ubuntu" -var_version="22.04" +var_os="debian" +var_version="12" var_unprivileged="1" # App Output & Base Settings diff --git a/install/ghost-install.sh b/install/ghost-install.sh index dbeb65e7..c7b7a021 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -3,6 +3,7 @@ # Copyright (c) 2021-2025 community-scripts ORG # Author: fabrice1236 # License: MIT +# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://ghost.org/ # Import Functions und Setup @@ -14,7 +15,7 @@ setting_up_container network_check update_os -# Install Dependencies + msg_info "Installing Dependencies" $STD apt-get install -y \ curl \ @@ -26,9 +27,7 @@ $STD apt-get install -y \ gnupg msg_ok "Installed Dependencies" -# Allow nginx through firewall -# Configure MySQL msg_info "Configuring MySQL" DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) $STD mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY '$DB_PASS';" @@ -42,27 +41,24 @@ $STD mysql -u root -p"$DB_PASS" -e "FLUSH PRIVILEGES;" msg_ok "Configured MySQL" -# Set up Node.js Repository msg_info "Setting up Node.js Repository" mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" >/etc/apt/sources.list.d/nodesource.list msg_ok "Set up Node.js Repository" -# Install Node.js (includes npm) msg_info "Installing Node.js and npm" $STD apt-get update $STD apt-get install -y nodejs -# $STD apt-get install -y npm msg_ok "Installed Node.js and npm" -# Install Ghost CLI + msg_info "Installing Ghost CLI" $STD npm install ghost-cli@latest -g msg_ok "Installed Ghost CLI" -# Create a new user for Ghost + msg_info "Creating Service" $STD adduser --disabled-password --gecos "Ghost user" ghost-user $STD usermod -aG sudo ghost-user @@ -71,14 +67,14 @@ mkdir -p /var/www/ghost chown -R ghost-user:ghost-user /var/www/ghost chmod 775 /var/www/ghost sudo -u ghost-user -H sh -c "cd /var/www/ghost && ghost install --db=mysql --dbhost=localhost --dbuser=root --dbpass=$DB_PASS --dbname=ghost --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 #Remove ghost-user for sudoers after setup (not required anymore) +rm /etc/sudoers.d/ghost-user msg_ok "Creating Service" motd_ssh customize -# Cleanup + msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean diff --git a/json/ghost.json b/json/ghost.json index 85fae251..689c8bc5 100644 --- a/json/ghost.json +++ b/json/ghost.json @@ -21,8 +21,8 @@ "cpu": 2, "ram": 1024, "hdd": 5, - "os": "Ubuntu", - "version": "22.04" + "os": "Debian", + "version": "12" } } ], From a9bc67fd3258a6e1d1ac790a60b4ba4ee8ed2796 Mon Sep 17 00:00:00 2001 From: fabrice1236 Date: Thu, 9 Jan 2025 20:38:11 +0100 Subject: [PATCH 37/37] Update license comment format in ghost-install.sh --- install/ghost-install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/install/ghost-install.sh b/install/ghost-install.sh index c7b7a021..7f9f5a1c 100644 --- a/install/ghost-install.sh +++ b/install/ghost-install.sh @@ -2,8 +2,7 @@ # Copyright (c) 2021-2025 community-scripts ORG # Author: fabrice1236 -# License: MIT -# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://ghost.org/ # Import Functions und Setup