1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/luckysheet_ynh.git synced 2024-09-03 19:36:21 +02:00

Removing service

This commit is contained in:
yalh76 2022-06-16 04:10:16 +02:00
parent a358ef2fa3
commit 6e7b6b4efd
11 changed files with 61 additions and 166 deletions

View file

@ -11,7 +11,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview ## Overview
Luckysheet is an online spreadsheet that is powerful, simple to configure, and completely open source. 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 ## Screenshot

View file

@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install
## Vue d'ensemble ## Vue d'ensemble
Luckysheet est une feuille de calcul en ligne, puissante, simple à configurer et complètement open source. 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 ## Captures d'écran

View file

@ -1,6 +1,7 @@
SOURCE_URL=https://github.com/mengshukeji/Luckysheet/archive/v2.0.0.tar.gz SOURCE_URL=https://github.com/mengshukeji/Luckysheet/archive/v2.1.13.tar.gz
SOURCE_SUM=697e79a4d033506074f8e0261ff94cee6e4360b7f0634cb9de53ae59edcec1fe SOURCE_SUM=9c996e1e2a47ca0bb37b17840f7ded82ed999899daf3bd620b07c154b71647f9
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME= SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,25 +1,16 @@
location ^~ __PATH__/ { #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__/; # Path to source
proxy_redirect off; alias __FINALPATH__/live/;
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;
proxy_http_version 1.1; index index.html;
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
# setup for image upload # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
#client_max_body_size 256M; #client_max_body_size 50M;
#proxy_max_temp_file_size 1024M;
try_files $uri $uri/ index.html;
#proxy_read_timeout 300;
#proxy_connect_timeout 300;
# Include SSOWAT user panel. # Include SSOWAT user panel.
#include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
#more_clear_input_headers 'Accept-Encoding';
} }

View file

@ -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

View file

@ -6,7 +6,7 @@
"en": "Online spreadsheet that is powerful, simple to configure", "en": "Online spreadsheet that is powerful, simple to configure",
"fr": "Feuille de calcul en ligne, puissante, simple à configurer" "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", "url": "https://github.com/mengshukeji/Luckysheet",
"upstream": { "upstream": {
"license": "MIT", "license": "MIT",

View file

@ -49,12 +49,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -50,15 +50,6 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
#================================================= #=================================================
# STANDARD MODIFICATIONS # 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 # 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 ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # 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 750 "$final_path"
chmod -R o-rwx "$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 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_use_nodejs
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install
ynh_npm install gulp -g ynh_npm install gulp -g
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build
popd 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 # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." 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" chmod 400 "$final_path/live/config.js"
chown $app:$app "$final_path/src/config.js" chown $app:$app "$final_path/live/config.js"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config
#================================================= #=================================================
# GENERIC FINALIZATION # 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 # SETUP SSOWAT
#================================================= #=================================================

View file

@ -17,30 +17,10 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) 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) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# STANDARD REMOVE # 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 # REMOVE APP MAIN DIR
#================================================= #=================================================

View file

@ -62,14 +62,6 @@ chown -R $app:www-data "$final_path"
#================================================= #=================================================
# SPECIFIC RESTORATION # 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 # 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" 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 # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -45,13 +44,6 @@ ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # 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 # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -64,6 +56,17 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public ynh_app_setting_delete --app=$app --key=is_public
fi 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 # CREATE DEDICATED USER
#================================================= #=================================================
@ -81,7 +84,7 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=20 ynh_script_progression --message="Upgrading source files..." --weight=20
# Download, check integrity, uncompress and patch the source from app.src # 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 fi
#================================================= #=================================================
@ -109,37 +112,35 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=20 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_use_nodejs
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install
ynh_npm install gulp -g ynh_npm install gulp -g
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build
popd 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 fi
#================================================= chmod 750 "$final_path"
# SETUP SYSTEMD chmod -R o-rwx "$final_path"
#================================================= chown -R $app:www-data "$final_path"
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
# 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 # 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 # RELOAD NGINX
#================================================= #=================================================