Skip to content

Commit e8aa450

Browse files
authored
Refactor: Ghost (use now MySQL) (#5871)
* Refactor: Ghost * update mysql
1 parent 6acf854 commit e8aa450

File tree

2 files changed

+29
-24
lines changed

2 files changed

+29
-24
lines changed

ct/ghost.sh

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,31 @@ color
2020
catch_errors
2121

2222
function update_script() {
23-
header_info
24-
check_container_storage
25-
check_container_resources
26-
msg_info "Updating ${APP} LXC"
23+
header_info
24+
check_container_storage
25+
check_container_resources
2726

28-
if command -v ghost &>/dev/null; then
29-
current_version=$(ghost version | grep 'Ghost-CLI version' | awk '{print $3}')
30-
latest_version=$(npm show ghost-cli version)
31-
if [ "$current_version" != "$latest_version" ]; then
32-
msg_info "Updating ${APP} from version v${current_version} to v${latest_version}"
33-
$STD npm install -g ghost-cli@latest
34-
msg_ok "Updated Successfully"
35-
else
36-
msg_ok "${APP} is already at v${current_version}"
37-
fi
27+
if ! dpkg-query -W -f='${Status}' mariadb-server 2>/dev/null | grep -q "install ok installed"; then
28+
setup_mysql
29+
fi
30+
NODE_VERSION="22" setup_nodejs
31+
32+
msg_info "Updating ${APP} LXC"
33+
if command -v ghost &>/dev/null; then
34+
current_version=$(ghost version | grep 'Ghost-CLI version' | awk '{print $3}')
35+
latest_version=$(npm show ghost-cli version)
36+
if [ "$current_version" != "$latest_version" ]; then
37+
msg_info "Updating ${APP} from version v${current_version} to v${latest_version}"
38+
$STD npm install -g ghost-cli@latest
39+
msg_ok "Updated Successfully"
3840
else
39-
msg_error "No ${APP} Installation Found!"
40-
exit
41+
msg_ok "${APP} is already at v${current_version}"
4142
fi
43+
else
44+
msg_error "No ${APP} Installation Found!"
4245
exit
46+
fi
47+
exit
4348
}
4449

4550
start
@@ -49,4 +54,4 @@ description
4954
msg_ok "Completed Successfully!\n"
5055
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
5156
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
52-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:2368${CL}"
57+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:2368${CL}"

install/ghost-install.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ update_os
1616
msg_info "Installing Dependencies"
1717
$STD apt-get install -y \
1818
nginx \
19-
ca-certificates
19+
ca-certificates \
20+
libjemalloc2
2021
msg_ok "Installed Dependencies"
2122

22-
setup_mariadb
23+
setup_mysql
2324

2425
msg_info "Configuring Database"
2526
DB_NAME=ghost
2627
DB_USER=ghostuser
2728
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
28-
$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;"
29-
$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
30-
$STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
31-
29+
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
30+
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
31+
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
3232
{
3333
echo "Ghost-Credentials"
3434
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
3737
} >>~/ghost.creds
3838
msg_ok "Configured MySQL"
3939

40-
NODE_VERSION="20" setup_nodejs
40+
NODE_VERSION="22" setup_nodejs
4141

4242
msg_info "Installing Ghost CLI"
4343
$STD npm install ghost-cli@latest -g

0 commit comments

Comments
 (0)