diff --git a/scripts/upgrade b/scripts/upgrade new file mode 100644 index 0000000..dc67387 --- /dev/null +++ b/scripts/upgrade @@ -0,0 +1,53 @@ +#!/bin/bash + +# Exit on command errors and treat unset variables as an error +set -eu + +# Load common variables and functions +source ./_common.sh + +# Retrieve arguments +domain=$(ynh_app_setting_get "$app" domain) +path=$(ynh_app_setting_get "$app" path) +is_public=$(ynh_app_setting_get "$app" is_public) + +# Install the app + + # Copy files to the right place +final_path=/var/www/$app +extract_source + + # Files owned by root, www-data can just read +sudo chown www-data:www-data $final_path -R +sudo chmod 755 $final_path -R + + # Modify Nginx configuration file and copy it to Nginx conf directory +sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf +sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf +nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf +sudo cp ../conf/nginx.conf $nginxconf +sudo chown root: $nginxconf +sudo chmod 600 $nginxconf +pushd $final_path +sudo npm install +popd +sudo service redis-server start +sudo yunohost firewall allow Both 85 +pre_inst_scrumblr +sudo service scrumblr start +sudo systemctl start "$app".service + + + +ynh_app_setting_set "$app" is_public "$is_public" +if [ "$is_public" = 0 ]; +then + ynh_app_setting_set "$app" unprotected_uris "/" +fi + +sudo service nginx reload +sudo yunohost service add "$app" --log /var/log/"$app"/"$app".log +sudo yunohost app ssowatconf + +# Start scrumblr +sudo systemctl restart "$app".service