Check for install success

This commit is contained in:
Bob Mottram 2016-11-08 13:19:46 +00:00
parent 60114b020e
commit b5b9a1f04d
2 changed files with 16 additions and 9 deletions

View File

@ -284,9 +284,6 @@ function install_ghost {
# for the avatar changing command
apt-get -yq install unzip wget
function_check install_nodejs
install_nodejs ghost
if [ ! -d /var/www/$GHOST_DOMAIN_NAME/htdocs ]; then
mkdir -p /var/www/$GHOST_DOMAIN_NAME/htdocs
fi
@ -301,7 +298,18 @@ function install_ghost {
echo $'ghost failed to unzip'
exit 63835
fi
function_check install_nodejs
install_nodejs ghost
ghost_create_config
npm install --production
if [ ! "$?" = "0" ]; then
function_check remove_nodejs
remove_nodejs ghost
echo $'Failed to install ghost'
exit 7383563
fi
function_check install_mariadb
install_mariadb
@ -311,10 +319,9 @@ function install_ghost {
function_check ghost_create_database
ghost_create_database
ghost_create_config
adduser --system --home=/var/www/$GHOST_DOMAIN_NAME/htdocs/ --group ghost
chown -R ghost: /var/www/$GHOST_DOMAIN_NAME/htdocs/
adduser --system --home=/var/www/${GHOST_DOMAIN_NAME}/htdocs/ --group ghost
chown -R ghost: /var/www/${GHOST_DOMAIN_NAME}/htdocs/
echo '[Unit]' > /etc/systemd/system/ghost.service
echo 'Description=Ghost Blog' >> /etc/systemd/system/ghost.service
@ -327,7 +334,7 @@ function install_ghost {
echo 'User=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 "ExecStart=/usr/bin/node /var/www/${GHOST_DOMAIN_NAME}/htdocs/index.js" >> /etc/systemd/system/ghost.service
echo "ExecStart=/usr/local/bin/node /var/www/${GHOST_DOMAIN_NAME}/htdocs/index.js" >> /etc/systemd/system/ghost.service
echo 'Restart=always' >> /etc/systemd/system/ghost.service
echo 'RestartSec=60' >> /etc/systemd/system/ghost.service
echo "Environment=NODE_ENV=production PORT=${GHOST_PORT}" >> /etc/systemd/system/ghost.service

View File

@ -240,14 +240,14 @@ function restore_local_htmly {
fi
set_user_permissions
backup_unmount_drive
exit 593
exit 54675
fi
rm -rf ${temp_restore_dir}
if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content ]; then
echo $"No content directory found after restoring htmly"
set_user_permissions
backup_unmount_drive
exit 287
exit 34578
fi
chown -R www-data:www-data /var/www/${HTMLY_DOMAIN_NAME}/htdocs
# Ensure that the bundled SSL cert is being used