forked from Git/send_ynh
Apply last example_ynh
This commit is contained in:
parent
f28e087a30
commit
219301790e
@ -10,13 +10,14 @@
|
|||||||
setup_private=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
|
# 3.4.14~ynh1
|
||||||
upgrade=1 from_commit=6e2eba4a9b6b455b35ce9d8e558c454a001bfacf
|
upgrade=1 from_commit=6e2eba4a9b6b455b35ce9d8e558c454a001bfacf
|
||||||
|
# 3.4.18~ynh1
|
||||||
|
upgrade=1 from_commit=674f8d3211ba98b10f169deea3127a8b378c6c3c
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
|
port_already_use=0
|
||||||
change_url=1
|
change_url=1
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
;;; Upgrade options
|
Notification=none
|
||||||
; commit=6e2eba4a9b6b455b35ce9d8e558c454a001bfacf
|
|
||||||
name=3.4.14
|
|
||||||
manifest_arg=domain=DOMAIN&is_public=1&
|
|
||||||
|
@ -3,3 +3,5 @@ SOURCE_SUM=d8b485383f5f2fdca98501e1abdacec158b2eb04a7a8a4dabae2a0d4f542c6e4
|
|||||||
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_EXTRACT=true
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
const convict = require('convict');
|
const convict = require('convict');
|
||||||
|
const convict_format_with_validator = require('convict-format-with-validator');
|
||||||
const { tmpdir } = require('os');
|
const { tmpdir } = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { randomBytes } = require('crypto');
|
const { randomBytes } = require('crypto');
|
||||||
|
|
||||||
|
convict.addFormats(convict_format_with_validator);
|
||||||
|
|
||||||
convict.addFormat({
|
convict.addFormat({
|
||||||
name: 'positive-int-array',
|
name: 'positive-int-array',
|
||||||
coerce: ints => {
|
coerce: ints => {
|
||||||
@ -239,6 +242,68 @@ const conf = convict({
|
|||||||
format: String,
|
format: String,
|
||||||
default: 'https://github.com/timvisee/send',
|
default: 'https://github.com/timvisee/send',
|
||||||
env: 'SEND_FOOTER_SOURCE_URL'
|
env: 'SEND_FOOTER_SOURCE_URL'
|
||||||
|
},
|
||||||
|
ui_color_primary: {
|
||||||
|
format: String,
|
||||||
|
default: '#0a84ff',
|
||||||
|
env: 'UI_COLOR_PRIMARY'
|
||||||
|
},
|
||||||
|
ui_color_accent: {
|
||||||
|
format: String,
|
||||||
|
default: '#003eaa',
|
||||||
|
env: 'UI_COLOR_ACCENT'
|
||||||
|
},
|
||||||
|
ui_custom_assets: {
|
||||||
|
android_chrome_192px: {
|
||||||
|
format: String,
|
||||||
|
default: '',
|
||||||
|
env: 'UI_CUSTOM_ASSETS_ANDROID_CHROME_192PX'
|
||||||
|
},
|
||||||
|
android_chrome_512px: {
|
||||||
|
format: String,
|
||||||
|
default: '',
|
||||||
|
env: 'UI_CUSTOM_ASSETS_ANDROID_CHROME_512PX'
|
||||||
|
},
|
||||||
|
apple_touch_icon: {
|
||||||
|
format: String,
|
||||||
|
default: '',
|
||||||
|
env: 'UI_CUSTOM_ASSETS_APPLE_TOUCH_ICON'
|
||||||
|
},
|
||||||
|
favicon_16px: {
|
||||||
|
format: String,
|
||||||
|
default: '',
|
||||||
|
env: 'UI_CUSTOM_ASSETS_FAVICON_16PX'
|
||||||
|
},
|
||||||
|
favicon_32px: {
|
||||||
|
format: String,
|
||||||
|
default: '',
|
||||||
|
env: 'UI_CUSTOM_ASSETS_FAVICON_32PX'
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
format: String,
|
||||||
|
default: '',
|
||||||
|
env: 'UI_CUSTOM_ASSETS_ICON'
|
||||||
|
},
|
||||||
|
safari_pinned_tab: {
|
||||||
|
format: String,
|
||||||
|
default: '',
|
||||||
|
env: 'UI_CUSTOM_ASSETS_SAFARI_PINNED_TAB'
|
||||||
|
},
|
||||||
|
facebook: {
|
||||||
|
format: String,
|
||||||
|
default: '',
|
||||||
|
env: 'UI_CUSTOM_ASSETS_FACEBOOK'
|
||||||
|
},
|
||||||
|
twitter: {
|
||||||
|
format: String,
|
||||||
|
default: '',
|
||||||
|
env: 'UI_CUSTOM_ASSETS_TWITTER'
|
||||||
|
},
|
||||||
|
wordmark: {
|
||||||
|
format: String,
|
||||||
|
default: '',
|
||||||
|
env: 'UI_CUSTOM_ASSETS_WORDMARK'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
BIN
doc/.DS_Store
vendored
BIN
doc/.DS_Store
vendored
Binary file not shown.
@ -4,7 +4,10 @@
|
|||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
nodejs_version=18
|
# dependencies used by the app
|
||||||
|
pkg_dependencies="redis-server"
|
||||||
|
|
||||||
|
nodejs_version=16.13
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ source /usr/share/yunohost/helpers
|
|||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
true
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
@ -32,9 +32,9 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
|||||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up $app before changing its URL (may take a while)..." --weight=1
|
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
@ -102,6 +102,8 @@ then
|
|||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -121,7 +123,7 @@ chown $app:$app "$final_path/server/config.js"
|
|||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
@ -56,7 +56,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
|
|||||||
ynh_script_progression --message="Finding an available port..." --weight=2
|
ynh_script_progression --message="Finding an available port..." --weight=2
|
||||||
|
|
||||||
# Find an available port
|
# Find an available port
|
||||||
port=$(ynh_find_port --port=1443)
|
port=$(ynh_find_port --port=8095)
|
||||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -64,9 +64,17 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
|||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=20
|
ynh_script_progression --message="Installing dependencies..." --weight=20
|
||||||
|
|
||||||
# Install Nodejs
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||||
|
|
||||||
|
# Create a system user
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A REDIS DATABASE
|
# CREATE A REDIS DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -76,14 +84,6 @@ ynh_script_progression --message="Creating a Redis database..." --weight=5
|
|||||||
redis_db=$(ynh_redis_get_free_db)
|
redis_db=$(ynh_redis_get_free_db)
|
||||||
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=3
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -91,7 +91,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"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
@ -106,6 +106,21 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
|||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
|
#=================================================
|
||||||
|
# BUILD APP
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=20
|
||||||
|
|
||||||
|
pushd "$final_path"
|
||||||
|
ynh_use_nodejs
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --production
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm cache clean --force
|
||||||
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -114,26 +129,14 @@ ynh_script_progression --message="Adding a configuration file..." --weight=2
|
|||||||
ynh_add_config --template="../conf/config.js" --destination="$final_path/server/config.js"
|
ynh_add_config --template="../conf/config.js" --destination="$final_path/server/config.js"
|
||||||
|
|
||||||
chmod 400 "$final_path/server/config.js"
|
chmod 400 "$final_path/server/config.js"
|
||||||
chown $app "$final_path/server/config.js"
|
chown $app: "$final_path/server/config.js"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC SETUP
|
|
||||||
#==============================================
|
|
||||||
# INSTALL HEDGEDOC
|
|
||||||
#==============================================
|
|
||||||
ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20
|
|
||||||
|
|
||||||
pushd "$final_path"
|
|
||||||
ynh_use_nodejs
|
|
||||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install
|
|
||||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build
|
|
||||||
popd
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -157,17 +160,19 @@ yunohost service add $app --description="Simple, private file sharing" --log="/v
|
|||||||
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||||
|
|
||||||
# Make app public if necessary or protect it
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_permission_update --permission "main" --add "visitors"
|
# Everyone can access the app.
|
||||||
|
# The "main" permission is automatically created before the install script.
|
||||||
|
ynh_permission_update --permission="main" --add="visitors"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||||
|
@ -26,10 +26,10 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
|
# 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
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service..." --weight=1
|
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -49,13 +49,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
|
|||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
|
||||||
|
|
||||||
ynh_remove_nodejs
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE REDIS DATABASE
|
# REMOVE THE REDIS DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -76,9 +69,18 @@ ynh_secure_remove --file="$final_path"
|
|||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5
|
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||||
|
|
||||||
|
# Remove metapackage and its dependencies
|
||||||
|
ynh_remove_app_dependencies
|
||||||
|
ynh_remove_nodejs
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
@ -40,13 +41,6 @@ test ! -d $final_path \
|
|||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the NGINX configuration..."
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -74,9 +68,17 @@ chmod +x "$final_path/server/bin/prod.js"
|
|||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
|
||||||
|
|
||||||
# Install Nodejs
|
# Define and install dependencies
|
||||||
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the NGINX configuration..."
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -104,7 +106,7 @@ yunohost service add $app --description="Simple, private file sharing" --log="/v
|
|||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -24,9 +24,25 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
|||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Checking version..."
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10
|
||||||
|
|
||||||
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
|
# Restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -36,20 +52,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
|||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=10
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -75,6 +77,14 @@ chmod -R o-rwx "$final_path"
|
|||||||
chown -R $app:www-data "$final_path"
|
chown -R $app:www-data "$final_path"
|
||||||
chmod +x "$final_path/server/bin/prod.js"
|
chmod +x "$final_path/server/bin/prod.js"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..." --weight=18
|
||||||
|
|
||||||
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -83,19 +93,11 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=18
|
|
||||||
|
|
||||||
# Install Nodejs
|
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#================================================
|
#=================================================
|
||||||
# INSTALL SEND
|
# INSTALL SEND
|
||||||
#================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
@ -105,17 +107,21 @@ then
|
|||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install
|
||||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --production
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm cache clean --force
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -136,7 +142,7 @@ yunohost service add $app --description="Simple, private file sharing" --log="/v
|
|||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
Loading…
Reference in New Issue
Block a user