Fix ghost

This commit is contained in:
Bob Mottram 2017-07-30 22:08:47 +01:00
parent 11b01bfe25
commit f396203257
1 changed files with 16 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash emacs#!/bin/bash
# #
# .---. . . # .---. . .
# | | | # | | |
@ -175,10 +175,13 @@ function upgrade_ghost {
return return
fi fi
cd /var/www/$GHOST_DOMAIN_NAME/htdocs cd /var/www/$GHOST_DOMAIN_NAME/htdocs
npm i -g ghost-cli npm i -g ghost-cli
/usr/local/bin/ghost update /usr/local/bin/ghost update
ghost_replace_services ghost_replace_services
ghost_remove_offsite_links ghost_remove_offsite_links
chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs
systemctl restart ghost systemctl restart ghost
} }
@ -379,7 +382,17 @@ function install_ghost {
# now install ghost itself # now install ghost itself
npm install -g ghost-cli npm install -g ghost-cli
ghost install local
GHOST_ONION_HOSTNAME=$(add_onion_service ghost 80 ${GHOST_ONION_PORT})
ghost install local --port ${GHOST_PORT}
# kill the started ghost process
kill_pid=$(ps aux | grep "ghost run" | awk -F ' ' '{print $2}' | head -n 1)
kill $kill_pid
# NOTE: this has to be http, not https
sed -i "s|\"url\":|\"url\": \"http://${GHOST_DOMAIN_NAME}/\",|g" /var/www/${GHOST_DOMAIN_NAME}/htdocs/config.development.json
adduser --system --home=/var/www/${GHOST_DOMAIN_NAME}/htdocs/ --group ghost adduser --system --home=/var/www/${GHOST_DOMAIN_NAME}/htdocs/ --group ghost
@ -393,7 +406,7 @@ function install_ghost {
echo 'User=ghost' >> /etc/systemd/system/ghost.service echo 'User=ghost' >> /etc/systemd/system/ghost.service
echo 'Group=ghost' >> /etc/systemd/system/ghost.service echo 'Group=ghost' >> /etc/systemd/system/ghost.service
echo "WorkingDirectory=/var/www/${GHOST_DOMAIN_NAME}/htdocs" >> /etc/systemd/system/ghost.service echo "WorkingDirectory=/var/www/${GHOST_DOMAIN_NAME}/htdocs" >> /etc/systemd/system/ghost.service
echo "ExecStart=/usr/local/bin/ghost run" >> /etc/systemd/system/ghost.service echo "ExecStart=/usr/local/bin/ghost run -D" >> /etc/systemd/system/ghost.service
echo "ExecStop=/usr/local/bin/ghost stop" >> /etc/systemd/system/ghost.service echo "ExecStop=/usr/local/bin/ghost stop" >> /etc/systemd/system/ghost.service
echo "ExecRestart=/usr/local/bin/ghost restart" >> /etc/systemd/system/ghost.service echo "ExecRestart=/usr/local/bin/ghost restart" >> /etc/systemd/system/ghost.service
echo 'Restart=always' >> /etc/systemd/system/ghost.service echo 'Restart=always' >> /etc/systemd/system/ghost.service
@ -411,8 +424,6 @@ function install_ghost {
systemctl daemon-reload systemctl daemon-reload
systemctl start ghost systemctl start ghost
GHOST_ONION_HOSTNAME=$(add_onion_service ghost 80 ${GHOST_ONION_PORT})
if [[ ${ONION_ONLY} == "no" ]]; then if [[ ${ONION_ONLY} == "no" ]]; then
function_check nginx_http_redirect function_check nginx_http_redirect
nginx_http_redirect ${GHOST_DOMAIN_NAME} nginx_http_redirect ${GHOST_DOMAIN_NAME}