Add NOPASSWD for ghost-user during install and enable Ghost on all interfaces

This commit is contained in:
fabrice1236 2025-01-07 21:38:56 +01:00
parent 3cbc4768cd
commit 5ba3173869
3 changed files with 8 additions and 26 deletions

View File

@ -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}"
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}"

View File

@ -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 <<EOF >/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

View File

@ -20,7 +20,7 @@
"resources": {
"cpu": 2,
"ram": 1024,
"hdd": 4,
"hdd": 5,
"os": "Ubuntu",
"version": "24.04"
}