From 6e7b6b4efda3fe9ac860c64ddbdeb1175d82edcb Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 16 Jun 2022 04:10:16 +0200 Subject: [PATCH] Removing service --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 5 ++-- conf/nginx.conf | 29 ++++++++------------- conf/systemd.service | 19 -------------- manifest.json | 2 +- scripts/backup | 6 ----- scripts/install | 51 ++++++++++-------------------------- scripts/remove | 20 --------------- scripts/restore | 30 ---------------------- scripts/upgrade | 61 ++++++++++++++++++++++---------------------- 11 files changed, 61 insertions(+), 166 deletions(-) delete mode 100644 conf/systemd.service diff --git a/README.md b/README.md index 3f04727..9e4b1dd 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview Luckysheet is an online spreadsheet that is powerful, simple to configure, and completely open source. -**Shipped version:** 2.0.0 +**Shipped version:** 2.1.13 ## Screenshot diff --git a/README_fr.md b/README_fr.md index 6d01d10..5b4a754 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install ## Vue d'ensemble Luckysheet est une feuille de calcul en ligne, puissante, simple à configurer et complètement open source. -**Version incluse :** 2.0.0 +**Version incluse :** 2.1.13 ## Captures d'écran diff --git a/conf/app.src b/conf/app.src index f2edea3..4f7e401 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,7 @@ -SOURCE_URL=https://github.com/mengshukeji/Luckysheet/archive/v2.0.0.tar.gz -SOURCE_SUM=697e79a4d033506074f8e0261ff94cee6e4360b7f0634cb9de53ae59edcec1fe +SOURCE_URL=https://github.com/mengshukeji/Luckysheet/archive/v2.1.13.tar.gz +SOURCE_SUM=9c996e1e2a47ca0bb37b17840f7ded82ed999899daf3bd620b07c154b71647f9 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index aaa7eb3..c6d27d9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,25 +1,16 @@ -location ^~ __PATH__/ { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { - proxy_pass http://127.0.0.1:__PORT__/; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $server_name; + # Path to source + alias __FINALPATH__/live/; - proxy_http_version 1.1; - proxy_set_header Connection "upgrade"; - proxy_set_header Upgrade $http_upgrade; + index index.html; - # setup for image upload - #client_max_body_size 256M; - #proxy_max_temp_file_size 1024M; - - #proxy_read_timeout 300; - #proxy_connect_timeout 300; + # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file + #client_max_body_size 50M; + + try_files $uri $uri/ index.html; # Include SSOWAT user panel. - #include conf.d/yunohost_panel.conf.inc; - #more_clear_input_headers 'Accept-Encoding'; + include conf.d/yunohost_panel.conf.inc; } diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index 25e40eb..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,19 +0,0 @@ -[Unit] -Description=Luckysheet: online spreadsheet -Documentation=https://github.com/mengshukeji/Luckysheet -After=network.target - -[Service] -Type=simple -User=__APP__ -Group=__APP__ -WorkingDirectory=__FINALPATH__ -Environment="__YNH_NODE_LOAD_PATH__" -Environment="NODE_ENV=production" -ExecStart=__YNH_NPM__ run build -Restart=always -PrivateTmp=true -PrivateDevices=true - -[Install] -WantedBy=multi-user.target diff --git a/manifest.json b/manifest.json index fc5d127..c7a11b8 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Online spreadsheet that is powerful, simple to configure", "fr": "Feuille de calcul en ligne, puissante, simple à configurer" }, - "version": "2.0.0~ynh5", + "version": "2.1.13~ynh1", "url": "https://github.com/mengshukeji/Luckysheet", "upstream": { "license": "MIT", diff --git a/scripts/backup b/scripts/backup index d72c557..118b2b1 100644 --- a/scripts/backup +++ b/scripts/backup @@ -49,12 +49,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP -#================================================= -# BACKUP SYSTEMD -#================================================= - -ynh_backup --src_path="/etc/systemd/system/$app.service" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index e4878de..60feb87 100644 --- a/scripts/install +++ b/scripts/install @@ -50,15 +50,6 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=2 - -# Find an available port -port=$(ynh_find_port --port=3000) -ynh_app_setting_set --app=$app --key=port --value=$port - #================================================= # INSTALL DEPENDENCIES #================================================= @@ -82,7 +73,7 @@ ynh_script_progression --message="Setting up source files..." --weight=2 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" +ynh_setup_source --dest_dir="$final_path/build" chmod 750 "$final_path" chmod -R o-rwx "$final_path" @@ -103,47 +94,33 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=20 -pushd "$final_path" +pushd "$final_path/build" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install ynh_npm install gulp -g + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build popd +ynh_exec_as $app mv "$final_path/build/dist" "$final_path/live" + +ynh_secure_remove --file="$final_path/build" + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." -ynh_add_config --template="../conf/config.example.js" --destination="$final_path/src/config.js" +ynh_add_config --template="../conf/config.example.js" --destination="$final_path/live/config.js" -chmod 400 "$final_path/src/config.js" -chown $app:$app "$final_path/src/config.js" - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - -# Create a dedicated systemd config -ynh_add_systemd_config +chmod 400 "$final_path/live/config.js" +chown $app:$app "$final_path/live/config.js" #================================================= # GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Online spreadsheet like excel" --log="/var/log/$app/$app.log" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=2 - -# Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Serving files from: dist" - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/remove b/scripts/remove index f62d80f..00820cf 100644 --- a/scripts/remove +++ b/scripts/remove @@ -17,30 +17,10 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST -#================================================= - -# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null -then - ynh_script_progression --message="Removing $app service integration..." --weight=1 - yunohost service remove $app -fi - -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - -# Remove the dedicated systemd config -ynh_remove_systemd_config - #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index cc0c9e4..8031cab 100644 --- a/scripts/restore +++ b/scripts/restore @@ -62,14 +62,6 @@ chown -R $app:www-data "$final_path" #================================================= # SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=7 - -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= @@ -77,28 +69,6 @@ ynh_script_progression --message="Restoring the NGINX configuration..." --weight ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=5 - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Online spreadsheet like excel" --log="/var/log/$app/$app.log" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Serving files from: dist" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b1ffa61..011797f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK VERSION @@ -45,13 +44,6 @@ ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -64,6 +56,17 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null +then + ynh_script_progression --message="Removing $app service integration..." --weight=1 + yunohost service remove $app +fi + +ynh_app_setting_delete --app=$app --key=port + +ynh_remove_systemd_config + #================================================= # CREATE DEDICATED USER #================================================= @@ -81,7 +84,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=20 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --keep="src/config.js" + ynh_setup_source --dest_dir="$final_path/build" fi #================================================= @@ -109,37 +112,35 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=20 - pushd "$final_path" + pushd "$final_path/build" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install ynh_npm install gulp -g + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build popd + tmpdir="$(mktemp -d)" + ynh_exec_as $app cp -af "$final_path/live/config.js" "$tmpdir/config.js" + ynh_secure_remove --file="$final_path/live" + ynh_exec_as $app mv "$final_path/build/dist" "$final_path/live" + ynh_exec_as $app cp -af "$tmpdir/config.js" "$final_path/live/config.js" fi -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" -# Create a dedicated systemd config -ynh_add_systemd_config +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." + +ynh_add_config --template="../conf/config.example.js" --destination="$final_path/live/config.js" + +chmod 400 "$final_path/live/config.js" +chown $app:$app "$final_path/live/config.js" #================================================= # GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description="Online spreadsheet like excel" --log="/var/log/$app/$app.log" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Serving files from: dist" - #================================================= # RELOAD NGINX #=================================================