1
0
Fork 0
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:
yalh76 2021-03-23 20:16:47 +01:00
parent 04d35617c8
commit 481c0c5ce6
8 changed files with 24 additions and 35 deletions

View file

@ -24,29 +24,17 @@
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for Distbin",
"fr": "Choisissez un nom de domaine pour Distbin"
},
"example": "example.com"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Distbin",
"fr": "Choisissez un chemin pour Distbin"
},
"example": "/distbin",
"default": "/distbin"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true
}
]

View file

@ -7,7 +7,7 @@
# dependencies used by the app
pkg_dependencies="ca-certificates curl sudo"
nodejs_version=10
NODEJS_VERSION=10
#=================================================
# PERSONAL HELPERS

View file

@ -33,15 +33,16 @@ port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# 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
ynh_backup_before_upgrade
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.
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
}
# Exit if an error occurs during the execution of the script

View file

@ -65,7 +65,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
ynh_script_progression --message="Installing 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
@ -81,7 +81,7 @@ ynh_setup_source --dest_dir="$final_path"
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
@ -90,7 +90,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Configuring 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
@ -120,13 +120,13 @@ chown -R "$app":"$app" "$final_path"
pushd $final_path
ynh_use_nodejs
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 install --ignore-scripts
ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm run build
cp package* dist/
popd
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
#=================================================
@ -152,7 +152,7 @@ ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R "$app":"$app" "$final_path"
chown -R $app:$app $final_path
#=================================================
# SETUP LOGROTATE

View file

@ -26,7 +26,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# 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
then
ynh_script_progression --message="Removing $app service integration..."

View file

@ -46,7 +46,7 @@ test ! -d $final_path \
#=================================================
# 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"
@ -71,7 +71,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app:$app "$final_path"
chown -R $app:$app $final_path
#=================================================
# CREATE LOG FOLDER
@ -90,7 +90,7 @@ ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
#=================================================
# RESTORE SYSTEMD

View file

@ -48,9 +48,9 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# 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
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -90,7 +90,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
#=================================================
# CREATE DEDICATED USER
@ -130,13 +130,13 @@ chown -R "$app":"$app" "$final_path"
pushd $final_path
ynh_use_nodejs
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 install --ignore-scripts
ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm run build
cp package* dist/
popd
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
#=================================================
@ -148,9 +148,9 @@ ynh_script_progression --message="Upgrading systemd configuration..."
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"