Use ghost-cli's systemd set up

This commit is contained in:
fabrice1236 2025-01-07 20:58:30 +01:00
parent 03bffdd063
commit 3cbc4768cd

View File

@ -67,30 +67,30 @@ msg_info "Setting up Ghost"
mkdir -p /var/www/ghost mkdir -p /var/www/ghost
chown -R ghost-user:ghost-user /var/www/ghost chown -R ghost-user:ghost-user /var/www/ghost
chmod 775 /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" msg_ok "Ghost setup completed"
# Creating Service (if needed) # Creating Service (if needed)
msg_info "Creating Service" # msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/${APPLICATION}.service # cat <<EOF >/etc/systemd/system/${APPLICATION}.service
[Unit] # [Unit]
Description=${APPLICATION} Service # Description=${APPLICATION} Service
After=network.target # After=network.target
[Service] # [Service]
Type=simple # Type=simple
Environment="NODE_ENV=production" # Environment="NODE_ENV=production"
ExecStart=/usr/bin/node /usr/bin/ghost run # ExecStart=/usr/bin/node /usr/bin/ghost run
WorkingDirectory=/var/www/ghost # WorkingDirectory=/var/www/ghost
User=ghost-user # User=ghost-user
Group=ghost-user # Group=ghost-user
Restart=always # Restart=always
[Install] # [Install]
WantedBy=multi-user.target # WantedBy=multi-user.target
EOF # EOF
systemctl enable -q --now ${APPLICATION}.service # systemctl enable -q --now ${APPLICATION}.service
msg_ok "Created Service" # msg_ok "Created Service"
motd_ssh motd_ssh
customize customize