mirror of
				https://github.com/community-scripts/ProxmoxVE.git
				synced 2025-11-04 10:22:50 +00:00 
			
		
		
		
	Refactor: Ghost (use now MySQL) (#5871)
* Refactor: Ghost * update mysql
This commit is contained in:
		
							
								
								
									
										39
									
								
								ct/ghost.sh
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								ct/ghost.sh
									
									
									
									
									
								
							@@ -20,26 +20,31 @@ color
 | 
				
			|||||||
catch_errors
 | 
					catch_errors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function update_script() {
 | 
					function update_script() {
 | 
				
			||||||
    header_info
 | 
					  header_info
 | 
				
			||||||
    check_container_storage
 | 
					  check_container_storage
 | 
				
			||||||
    check_container_resources
 | 
					  check_container_resources
 | 
				
			||||||
    msg_info "Updating ${APP} LXC"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if command -v ghost &>/dev/null; then
 | 
					  if ! dpkg-query -W -f='${Status}' mariadb-server 2>/dev/null | grep -q "install ok installed"; then
 | 
				
			||||||
        current_version=$(ghost version | grep 'Ghost-CLI version' | awk '{print $3}')
 | 
					    setup_mysql
 | 
				
			||||||
        latest_version=$(npm show ghost-cli version)
 | 
					  fi
 | 
				
			||||||
        if [ "$current_version" != "$latest_version" ]; then
 | 
					  NODE_VERSION="22" setup_nodejs
 | 
				
			||||||
            msg_info "Updating ${APP} from version v${current_version} to v${latest_version}"
 | 
					
 | 
				
			||||||
            $STD npm install -g ghost-cli@latest
 | 
					  msg_info "Updating ${APP} LXC"
 | 
				
			||||||
            msg_ok "Updated Successfully"
 | 
					  if command -v ghost &>/dev/null; then
 | 
				
			||||||
        else
 | 
					    current_version=$(ghost version | grep 'Ghost-CLI version' | awk '{print $3}')
 | 
				
			||||||
            msg_ok "${APP} is already at v${current_version}"
 | 
					    latest_version=$(npm show ghost-cli version)
 | 
				
			||||||
        fi
 | 
					    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
 | 
					    else
 | 
				
			||||||
        msg_error "No ${APP} Installation Found!"
 | 
					      msg_ok "${APP} is already at v${current_version}"
 | 
				
			||||||
        exit
 | 
					 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    msg_error "No ${APP} Installation Found!"
 | 
				
			||||||
    exit
 | 
					    exit
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					  exit
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
start
 | 
					start
 | 
				
			||||||
@@ -49,4 +54,4 @@ description
 | 
				
			|||||||
msg_ok "Completed Successfully!\n"
 | 
					msg_ok "Completed Successfully!\n"
 | 
				
			||||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
 | 
					echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
 | 
				
			||||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
 | 
					echo -e "${INFO}${YW} Access it using the following URL:${CL}"
 | 
				
			||||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:2368${CL}"
 | 
					echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:2368${CL}"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,19 +16,19 @@ update_os
 | 
				
			|||||||
msg_info "Installing Dependencies"
 | 
					msg_info "Installing Dependencies"
 | 
				
			||||||
$STD apt-get install -y \
 | 
					$STD apt-get install -y \
 | 
				
			||||||
  nginx \
 | 
					  nginx \
 | 
				
			||||||
  ca-certificates
 | 
					  ca-certificates \
 | 
				
			||||||
 | 
					  libjemalloc2
 | 
				
			||||||
msg_ok "Installed Dependencies"
 | 
					msg_ok "Installed Dependencies"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
setup_mariadb
 | 
					setup_mysql
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Configuring Database"
 | 
					msg_info "Configuring Database"
 | 
				
			||||||
DB_NAME=ghost
 | 
					DB_NAME=ghost
 | 
				
			||||||
DB_USER=ghostuser
 | 
					DB_USER=ghostuser
 | 
				
			||||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
 | 
					DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
 | 
				
			||||||
$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;"
 | 
					$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
 | 
				
			||||||
$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
 | 
					$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
 | 
				
			||||||
$STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
 | 
					$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
 | 
				
			||||||
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  echo "Ghost-Credentials"
 | 
					  echo "Ghost-Credentials"
 | 
				
			||||||
  echo "Ghost Database User: $DB_USER"
 | 
					  echo "Ghost Database User: $DB_USER"
 | 
				
			||||||
@@ -37,7 +37,7 @@ $STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUS
 | 
				
			|||||||
} >>~/ghost.creds
 | 
					} >>~/ghost.creds
 | 
				
			||||||
msg_ok "Configured MySQL"
 | 
					msg_ok "Configured MySQL"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
NODE_VERSION="20" setup_nodejs
 | 
					NODE_VERSION="22" setup_nodejs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Installing Ghost CLI"
 | 
					msg_info "Installing Ghost CLI"
 | 
				
			||||||
$STD npm install ghost-cli@latest -g
 | 
					$STD npm install ghost-cli@latest -g
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user