diff --git a/conf/systemd.service b/conf/systemd.service index 94ad361..5c78a8e 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,8 +7,8 @@ Type=simple User=__APP__ Group=__APP__ Environment=NODE_PORT=__PORT__ -WorkingDirectory=__INSTALL_DIR__ -Environment=PATH=__ENV_PATH__ +WorkingDirectory=__INSTALL_DIR__/ +Environment="__YNH_NODE_LOAD_PATH__" Environment=NODE_ENV=production ExecStart=__YNH_NPM__ run start diff --git a/scripts/backup b/scripts/backup index f8e82aa..a032119 100755 --- a/scripts/backup +++ b/scripts/backup @@ -27,10 +27,6 @@ ynh_backup --src_path="$install_dir" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= diff --git a/scripts/install b/scripts/install index c6b81ab..41ce49c 100755 --- a/scripts/install +++ b/scripts/install @@ -33,7 +33,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" +ynh_add_config --template=".env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown $app:$app "$install_dir/.env" @@ -45,8 +45,8 @@ ynh_script_progression --message="Installing $app..." --weight=10 pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH npm install - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH npm run build + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm install + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH $ynh_npm run build popd chmod -R 750 "$install_dir" @@ -61,7 +61,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=3 # Create a dedicated NGINX config ynh_add_nginx_config -env_path="$PATH" # Create a dedicated systemd config ynh_add_systemd_config diff --git a/scripts/remove b/scripts/remove index 04dca7f..d2f5c3e 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,10 +10,9 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEM CONFIGURATIONS #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # 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 diff --git a/scripts/upgrade b/scripts/upgrade index b4142f4..b6faa97 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,12 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -27,14 +21,10 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=4 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=4 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep=".env" -fi +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" --keep=".env" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir"