mirror of
https://github.com/YunoHost-Apps/linuxdash_ynh.git
synced 2024-09-03 19:36:07 +02:00
Merge 03c5f44d58
into 1bd99828d5
This commit is contained in:
commit
da67f557d3
10 changed files with 93 additions and 165 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
*~
|
||||
*.sw[op]
|
||||
.DS_Store
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[program:__APP__]
|
||||
directory=__INSTALL_DIR__/app/server/
|
||||
command=__YNH_NODE__ index.js --port __PORT__
|
||||
command=__NODEJS_DIR__/node index.js --port __PORT__
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=__APP__
|
||||
|
|
|
@ -16,7 +16,8 @@ admindoc = "https://github.com/afaqurk/linux-dash/wiki"
|
|||
code = "https://github.com/afaqurk/linux-dash"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.20"
|
||||
yunohost = ">= 11.2.18"
|
||||
helpers_version = "2.1"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = false
|
||||
|
|
|
@ -1,24 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# COMMON VARIABLES
|
||||
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||
#=================================================
|
||||
|
||||
nodejs_version=18
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
||||
|
||||
# Create a dedicated supervisor config
|
||||
#
|
||||
# usage: ynh_add_supervisor_config [--service=service] [--template=template]
|
||||
|
@ -27,13 +14,13 @@ nodejs_version=18
|
|||
#
|
||||
# This will use the template `../conf/<templatename>.service`.
|
||||
#
|
||||
# See the documentation of `ynh_add_config` for a description of the template
|
||||
# See the documentation of `ynh_config_add` for a description of the template
|
||||
# format and how placeholders are replaced with actual variables.
|
||||
#
|
||||
# Requires YunoHost version 2.7.11 or higher.
|
||||
ynh_add_supervisor_config () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=stv
|
||||
#REMOVEME? local legacy_args=stv
|
||||
local -A args_array=( [s]=service= [t]=template= [v]=others_var=)
|
||||
local service
|
||||
local template
|
||||
|
@ -44,9 +31,9 @@ ynh_add_supervisor_config () {
|
|||
local template="${template:-supervisor.service}"
|
||||
others_var="${others_var:-}"
|
||||
|
||||
[[ -z "$others_var" ]] || ynh_print_warn --message="Packagers: using others var is unecessary since Yunohost 4.2"
|
||||
[[ -z "$others_var" ]] || ynh_print_warn "Packagers: using others var is unecessary since Yunohost 4.2"
|
||||
|
||||
ynh_add_config --template="$YNH_APP_BASEDIR/conf/$template" --destination="/etc/supervisor/conf.d/$service.conf"
|
||||
ynh_config_add --template="$YNH_APP_BASEDIR/conf/$template" --destination="/etc/supervisor/conf.d/$service.conf"
|
||||
|
||||
supervisorctl reread
|
||||
supervisorctl update
|
||||
|
@ -60,7 +47,7 @@ ynh_add_supervisor_config () {
|
|||
# Requires YunoHost version 2.7.2 or higher.
|
||||
ynh_remove_supervisor_config () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=s
|
||||
#REMOVEME? local legacy_args=s
|
||||
local -A args_array=( [s]=service= )
|
||||
local service
|
||||
# Manage arguments with getopts
|
||||
|
@ -70,8 +57,8 @@ ynh_remove_supervisor_config () {
|
|||
local finalsupervisorconf="/etc/supervisor/conf.d/$service.conf"
|
||||
if [ -e "$finalsupervisorconf" ]
|
||||
then
|
||||
ynh_supervisor_action --service_name=$service --action=stop
|
||||
ynh_secure_remove --file="$finalsupervisorconf"
|
||||
ynh_supervisor_action --service=$service --action=stop
|
||||
ynh_safe_rm "$finalsupervisorconf"
|
||||
supervisorctl reread
|
||||
supervisorctl update
|
||||
fi
|
||||
|
@ -79,10 +66,10 @@ ynh_remove_supervisor_config () {
|
|||
|
||||
# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started
|
||||
#
|
||||
# usage: ynh_supervisor_action [--service_name=service_name] [--action=action] [ [--line_match="line to match"] [--log_path=log_path] [--timeout=300] [--length=20] ]
|
||||
# | arg: -n, --service_name= - Name of the service to start. Default : `$app`
|
||||
# usage: ynh_supervisor_action [--service=service_name] [--action=action] [ [--wait_until="line to match"] [--log_path=log_path] [--timeout=300] [--length=20] ]
|
||||
# | arg: -n, --service= - Name of the service to start. Default : `$app`
|
||||
# | arg: -a, --action= - Action to perform with supervisorctl. Default: start
|
||||
# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot. If not defined it don't wait until the service is completely started.
|
||||
# | arg: -l, --wait_until= - Line to match - The line to find in the log to attest the service have finished to boot. If not defined it don't wait until the service is completely started.
|
||||
# | arg: -p, --log_path= - Log file - Path to the log file. Default : `/var/log/$app/$app.log`
|
||||
# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds.
|
||||
# | arg: -e, --length= - Length of the error log : Default : 20
|
||||
|
@ -90,7 +77,7 @@ ynh_remove_supervisor_config () {
|
|||
# Requires YunoHost version 3.5.0 or higher.
|
||||
ynh_supervisor_action() {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=nalpte
|
||||
#REMOVEME? local legacy_args=nalpte
|
||||
declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= )
|
||||
local service_name
|
||||
local action
|
||||
|
@ -155,7 +142,7 @@ ynh_supervisor_action() {
|
|||
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
||||
if grep --extended-regexp --quiet "$line_match" "$templog"
|
||||
then
|
||||
ynh_print_info --message="The service $service_name has correctly executed the action ${action}."
|
||||
ynh_print_info "The service $service_name has correctly executed the action ${action}."
|
||||
break
|
||||
fi
|
||||
if [ $i -eq 3 ]; then
|
||||
|
@ -172,16 +159,15 @@ ynh_supervisor_action() {
|
|||
fi
|
||||
if [ $i -eq $timeout ]
|
||||
then
|
||||
ynh_print_warn --message="The service $service_name didn't fully executed the action ${action} before the timeout."
|
||||
ynh_print_warn --message="Please find here an extract of the end of the log of the service $service_name:"
|
||||
ynh_print_warn "The service $service_name didn't fully executed the action ${action} before the timeout."
|
||||
ynh_print_warn "Please find here an extract of the end of the log of the service $service_name:"
|
||||
ynh_exec_warn journalctl --quiet --no-hostname --no-pager --lines=$length --unit=$service_name
|
||||
if [ -e "$log_path" ]
|
||||
then
|
||||
ynh_print_warn --message="\-\-\-"
|
||||
ynh_print_warn "\-\-\-"
|
||||
ynh_exec_warn tail --lines=$length "$log_path"
|
||||
fi
|
||||
fi
|
||||
ynh_clean_check_starting
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -1,31 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# 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 /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
ynh_print_info "Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$install_dir"
|
||||
ynh_backup "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
|
@ -33,10 +24,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/supervisor/conf.d/$app.conf"
|
||||
ynh_backup "/etc/supervisor/conf.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -1,41 +1,31 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
ynh_script_progression "Stopping $app's systemd service..."
|
||||
|
||||
ynh_supervisor_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
ynh_supervisor_action --service=$app --action="stop"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||
ynh_script_progression "Updating NGINX web server configuration..."
|
||||
|
||||
ynh_change_url_nginx_config
|
||||
ynh_config_change_url_nginx
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
ynh_supervisor_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
ynh_supervisor_action --service=$app --action="start"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app"
|
||||
ynh_script_progression "Change of URL completed for $app"
|
||||
|
|
|
@ -1,87 +1,78 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..."
|
||||
ynh_script_progression "Installing dependencies..."
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_nodejs_install
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..."
|
||||
ynh_script_progression "Setting up source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
ynh_script_progression "Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# REMOVE GOOGLE !!!
|
||||
#=================================================
|
||||
ynh_script_progression --message="Remobing Google..."
|
||||
ynh_script_progression "Remobing Google..."
|
||||
|
||||
sed --in-place "/googlecode\|googleapis/d" "$install_dir/index.html"
|
||||
|
||||
#=================================================
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building app..."
|
||||
ynh_script_progression "Building app..."
|
||||
|
||||
pushd "$install_dir"
|
||||
ynh_use_nodejs
|
||||
#ynh_exec_warn_less ynh_npm install --production
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --production
|
||||
|
||||
#ynh_hide_warnings npm install --production
|
||||
ynh_hide_warnings ynh_exec_as_app node_load_PATH npm install --production
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..."
|
||||
ynh_script_progression "Configuring $app's systemd service..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_supervisor_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
ynh_script_progression "Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="Monitoring web dashboard" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_supervisor_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
ynh_supervisor_action --service=$app --action="start"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed"
|
||||
ynh_script_progression "Installation of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -16,16 +10,16 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
# 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_hide_warnings yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..."
|
||||
ynh_script_progression "Removing $app service integration..."
|
||||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||
ynh_script_progression "Stopping and removing the systemd service..."
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_supervisor_config
|
||||
|
@ -33,21 +27,21 @@ ynh_remove_supervisor_config
|
|||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
ynh_script_progression "Removing NGINX web server configuration..."
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
ynh_config_remove_nginx
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
ynh_script_progression "Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_nodejs
|
||||
ynh_nodejs_remove
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed"
|
||||
ynh_script_progression "Removal of $app completed"
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# 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 /usr/share/yunohost/helpers
|
||||
|
@ -13,64 +7,61 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
ynh_script_progression "Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
ynh_restore "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
ynh_script_progression "Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_nodejs_install
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
ynh_script_progression "Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||
ynh_script_progression "Restoring $app's systemd service..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/supervisor/conf.d/$app.conf"
|
||||
ynh_restore "/etc/supervisor/conf.d/$app.conf"
|
||||
supervisorctl reread
|
||||
supervisorctl update
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
ynh_script_progression "Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="Monitoring web dashboard" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
ynh_supervisor_action --service_name=$app --action="start" --log_path="systemd"
|
||||
ynh_supervisor_action --service=$app --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression "Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemctl --service=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app"
|
||||
ynh_script_progression "Restoration completed for $app"
|
||||
|
|
|
@ -1,61 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
ynh_script_progression "Stopping $app's systemd service..."
|
||||
|
||||
ynh_supervisor_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
ynh_supervisor_action --service=$app --action="stop"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
|
||||
if ynh_app_upstream_version_changed
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
ynh_script_progression "Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
fi
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
ynh_script_progression "Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
ynh_config_add_nginx
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
ynh_script_progression "Upgrading dependencies..."
|
||||
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_nodejs_install
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# REMOVE GOOGLE !!!
|
||||
#=================================================
|
||||
|
@ -65,39 +49,37 @@ sed --in-place "/googlecode\|googleapis/d" "$install_dir/index.html"
|
|||
#=================================================
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building app..."
|
||||
ynh_script_progression "Building app..."
|
||||
|
||||
pushd "$install_dir"
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --production
|
||||
|
||||
ynh_hide_warnings ynh_exec_as_app node_load_PATH npm install --production
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||
ynh_script_progression "Upgrading systemd configuration..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_supervisor_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
ynh_script_progression "Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="Monitoring web dashboard" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression "Starting $app's systemd service..."
|
||||
|
||||
ynh_supervisor_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
ynh_supervisor_action --service=$app --action="start"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed"
|
||||
ynh_script_progression "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue