mirror of
https://github.com/YunoHost-Apps/distbin_ynh.git
synced 2024-09-03 18:26:10 +02:00
Various fix
This commit is contained in:
parent
04d35617c8
commit
481c0c5ce6
8 changed files with 24 additions and 35 deletions
|
@ -24,29 +24,17 @@
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a domain name for Distbin",
|
|
||||||
"fr": "Choisissez un nom de domaine pour Distbin"
|
|
||||||
},
|
|
||||||
"example": "example.com"
|
"example": "example.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"ask": {
|
|
||||||
"en": "Choose a path for Distbin",
|
|
||||||
"fr": "Choisissez un chemin pour Distbin"
|
|
||||||
},
|
|
||||||
"example": "/distbin",
|
"example": "/distbin",
|
||||||
"default": "/distbin"
|
"default": "/distbin"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
|
||||||
"en": "Is it a public application?",
|
|
||||||
"fr": "Est-ce une application publique ?"
|
|
||||||
},
|
|
||||||
"default": true
|
"default": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies="ca-certificates curl sudo"
|
pkg_dependencies="ca-certificates curl sudo"
|
||||||
|
|
||||||
nodejs_version=10
|
NODEJS_VERSION=10
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
|
|
@ -6,7 +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
|
# 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
|
||||||
|
|
||||||
|
|
|
@ -33,15 +33,16 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..."
|
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
# restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
|
|
@ -65,7 +65,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
ynh_script_progression --message="Installing dependencies..."
|
ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -81,7 +81,7 @@ ynh_setup_source --dest_dir="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..."
|
ynh_script_progression --message="Configuring NGINX web server..."
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -90,7 +90,7 @@ ynh_add_nginx_config
|
||||||
ynh_script_progression --message="Configuring system user..."
|
ynh_script_progression --message="Configuring system user..."
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create --username="$app" --home_dir="$final_path"
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
@ -120,13 +120,13 @@ chown -R "$app":"$app" "$final_path"
|
||||||
|
|
||||||
pushd $final_path
|
pushd $final_path
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts
|
ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts
|
||||||
sudo -u $app $ynh_node_load_PATH $ynh_npm run build
|
ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm run build
|
||||||
cp package* dist/
|
cp package* dist/
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd $final_path/dist
|
pushd $final_path/dist
|
||||||
sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts --production
|
ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts --production
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -152,7 +152,7 @@ ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
|
||||||
ynh_script_progression --message="Securing files and directories..."
|
ynh_script_progression --message="Securing files and directories..."
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R "$app":"$app" "$final_path"
|
chown -R $app:$app $final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
|
|
@ -26,7 +26,7 @@ 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 integration..."
|
ynh_script_progression --message="Removing $app service integration..."
|
||||||
|
|
|
@ -6,7 +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
|
# 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
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the NGINX configuration..."
|
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
ynh_script_progression --message="Restoring user rights..."
|
ynh_script_progression --message="Restoring user rights..."
|
||||||
|
|
||||||
# Restore permissions on app files
|
# Restore permissions on app files
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app $final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE LOG FOLDER
|
# CREATE LOG FOLDER
|
||||||
|
@ -90,7 +90,7 @@ ynh_script_progression --message="Reinstalling dependencies..."
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
|
|
|
@ -48,9 +48,9 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
# restore it if the upgrade fails
|
# restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
ynh_clean_check_starting
|
|
||||||
}
|
}
|
||||||
# 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
|
||||||
|
@ -90,7 +90,7 @@ ynh_add_nginx_config
|
||||||
ynh_script_progression --message="Upgrading dependencies..."
|
ynh_script_progression --message="Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
@ -130,13 +130,13 @@ chown -R "$app":"$app" "$final_path"
|
||||||
|
|
||||||
pushd $final_path
|
pushd $final_path
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts
|
ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts
|
||||||
sudo -u $app $ynh_node_load_PATH $ynh_npm run build
|
ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm run build
|
||||||
cp package* dist/
|
cp package* dist/
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd $final_path/dist
|
pushd $final_path/dist
|
||||||
sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts --production
|
ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts --production
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -148,9 +148,9 @@ ynh_script_progression --message="Upgrading systemd configuration..."
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Modifying config file..."
|
ynh_script_progression --message="Updating a config file..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
|
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue