From 941c13267eb3f263f27b2370203a9ca36d0dd205 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 4 Nov 2016 17:20:36 +0000 Subject: [PATCH] Remove logging settings which cause crashes --- src/freedombone-app-etherpad | 22 +--------------------- src/freedombone-utils-nodejs | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/freedombone-app-etherpad b/src/freedombone-app-etherpad index 9a6698be..fec4fffd 100755 --- a/src/freedombone-app-etherpad +++ b/src/freedombone-app-etherpad @@ -181,27 +181,7 @@ function create_etherpad_settings { echo ' ["timeslider_export", "timeslider_returnToPad"]' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json echo ' ]' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json echo ' },' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' "loglevel": "INFO",' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' "logconfig" :' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' { "appenders": [' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' { "type": "console"' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' //, "category": "access"// only logs pad access' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' },' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' { "type": "logLevelFilter"' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' , "level": "error" // filters out all log messages that have a lower level than "error"' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' , "appender":' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' { "type": "smtp"' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' , "subject": "[Admin] An error occured in your Etherpad instance!"' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo " , \"recipients\": \"admin@${DEFAULT_DOMAIN_NAME}\"" >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' , "sendInterval": 300 // 60 * 5 = 5 minutes -- will buffer log messages; set to 0 to send a mail for every message' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' , "transport": "SMTP", "SMTP": { // see https://github.com/andris9/Nodemailer#possible-transport-methods' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' "host": "localhost", "port": 25,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' "secureConnection": false,' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' }' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' }' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' }' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' ]' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json - echo ' }' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json + echo ' "loglevel": "INFO"' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json echo '}' >> /var/www/${ETHERPAD_DOMAIN_NAME}/htdocs/settings.json } diff --git a/src/freedombone-utils-nodejs b/src/freedombone-utils-nodejs index 7cd12481..4b872885 100755 --- a/src/freedombone-utils-nodejs +++ b/src/freedombone-utils-nodejs @@ -33,8 +33,11 @@ VARIANTS='mesh' -NODEJS_VERSION='6.2.2' +# change these versions at your peril. Things will often crash if you don't +# have specifically the correct versions +NODEJS_VERSION='6.9.0' NODEJS_N_VERSION='2.1.4' +NPM_VERSION='4.0.2' # This file keeps track of the apps needing nodejs # so that it can be removed if tere are no apps which need it @@ -79,6 +82,16 @@ function remove_nodejs { fi sed -i "/install_${1}/d" $NODEJS_INSTALLED_APPS_FILE if ! grep "install_" $NODEJS_INSTALLED_APPS_FILE; then + cat < /root/remove-nodejs.sh +#!/bin/bash +PATH="/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/bin" +NODE_PATH="/usr/lib/node_modules" +npm uninstall -g --save +exit 0 +EOF + chmod +x /root/remove-nodejs.sh + /root/remove-nodejs.sh + apt-get -yq remove --purge nodejs if [ -f /usr/bin/nodejs ]; then @@ -125,6 +138,7 @@ cp /usr/bin/nodejs /usr/bin/node /usr/bin/curl -0 -L https://npmjs.org/install.sh | sh npm install -g n@${NODEJS_N_VERSION} --save n ${NODEJS_VERSION} +npm update -g npm@{NPM_VERSION} exit 0 EOF chmod +x /root/install-nodejs.sh