From e5d78cb4967b1d6a9a46399e86c7e47b5bc0402d Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 29 Nov 2017 22:24:05 +0100 Subject: [PATCH] Fix binary and data dir; remove log --- conf/config.js | 2 +- conf/haste.sh | 5 +++-- scripts/backup | 3 ++- scripts/install | 13 +++++++------ scripts/remove | 3 ++- scripts/restore | 9 +++++---- scripts/upgrade | 3 ++- 7 files changed, 22 insertions(+), 16 deletions(-) mode change 100755 => 100644 scripts/upgrade diff --git a/conf/config.js b/conf/config.js index 144c301..daafea6 100644 --- a/conf/config.js +++ b/conf/config.js @@ -34,7 +34,7 @@ "storage": { "type": "file", - "file": "__YNH_DATA_PATH__" + "path": "__YNH_DATA_PATH__" }, "documents": { diff --git a/conf/haste.sh b/conf/haste.sh index b3c0ff7..d3e8798 100644 --- a/conf/haste.sh +++ b/conf/haste.sh @@ -3,7 +3,8 @@ set -e set -u -PASTE_URL="__YNH_HASTE_URL__" +LOCAL_PASTE_URL="http://127.0.0.1:__PORT__" +PASTE_URL="https://__YNH_HASTE_URL__" _die() { printf "Error: %s\n" "$*" @@ -15,7 +16,7 @@ check_dependencies() { } paste_data() { - json=$(curl -X POST -s -d "$1" "${PASTE_URL}/documents") + json=$(curl -kL -X POST -s -d "$1" "${LOCAL_PASTE_URL}/documents") [[ -z "$json" ]] && _die "Unable to post the data to the server." key=$(echo "$json" \ diff --git a/scripts/backup b/scripts/backup index 352e55c..b85e9d0 100755 --- a/scripts/backup +++ b/scripts/backup @@ -50,7 +50,8 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP LOGROTATE #================================================= -ynh_backup "/etc/logrotate.d/$app" +# FIXME Currently, the log is only redirected to syslog. +# ynh_backup "/etc/logrotate.d/$app" #================================================= # BACKUP DATADIR DIRECTORY diff --git a/scripts/install b/scripts/install index fb5e10e..5ff7485 100755 --- a/scripts/install +++ b/scripts/install @@ -62,7 +62,6 @@ ynh_app_setting_set $app path_url "$path_url" # Find a free port port=$(ynh_find_port 7777) ynh_app_setting_set $app port $port -echo "port=$port" >&2 #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -135,7 +134,8 @@ ynh_store_file_checksum "$final_path/config.js" # ADD HASTE AS A BINARY FILE #================================================= -ynh_replace_string "__YNH_HASTE_URL__" "${domain}${path_url}" "../conf/haste.sh" +ynh_replace_string "__YNH_HASTE_URL__" "${domain}${path_url%/}" "../conf/haste.sh" +ynh_replace_string "__PORT__" "$port" "../conf/haste.sh" sudo cp ../conf/haste.sh /usr/bin/$app sudo chmod +x /usr/bin/"$app" echo "Please use 'cmd | $app' to paste the output of the command to your Haste server." >&2 @@ -154,10 +154,11 @@ chown -R $app "$data_path" # HANDLE LOG FILES AND SETUP LOGROTATE #================================================= -mkdir -p /var/log/$app -touch /var/log/$app/$app.log -chown $app -R /var/log/$app -ynh_use_logrotate +# FIXME Currently, the log is only redirected to syslog. +# mkdir -p /var/log/$app +# touch /var/log/$app/$app.log +# chown $app -R /var/log/$app +# ynh_use_logrotate #================================================= # ENABLE SERVICE IN ADMIN PANEL diff --git a/scripts/remove b/scripts/remove index 3e8ff43..d124c1d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -53,7 +53,8 @@ ynh_remove_nginx_config # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_remove_logrotate +# FIXME Currently, the log is only redirected to syslog. +# ynh_remove_logrotate #================================================= # SPECIFIC REMOVE diff --git a/scripts/restore b/scripts/restore index 8d1fb2d..6f6fc87 100755 --- a/scripts/restore +++ b/scripts/restore @@ -68,11 +68,12 @@ ynh_system_user_create $app # HANDLE LOG FILES AND RESTORE LOGROTATE #================================================= -mkdir -p /var/log/$app -touch /var/log/$app/$app.log -chown $app -R /var/log/$app +# FIXME Currently, the log is only redirected to syslog. +# mkdir -p /var/log/$app +# touch /var/log/$app/$app.log +# chown $app -R /var/log/$app -ynh_restore_file "/etc/logrotate.d/$app" +# ynh_restore_file "/etc/logrotate.d/$app" #================================================= # INSTALL NODEJS diff --git a/scripts/upgrade b/scripts/upgrade old mode 100755 new mode 100644 index 57170e8..0ca63f9 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -105,7 +105,8 @@ npm update # SETUP LOGROTATE #================================================= -ynh_use_logrotate +# FIXME Currently, the log is only redirected to syslog. +# ynh_use_logrotate #================================================= # SETUP SYSTEMD