diff --git a/check_process b/check_process index 232d16c..366d1ab 100644 --- a/check_process +++ b/check_process @@ -1,6 +1,3 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - ;; Test complet ; Manifest domain="domain.tld" @@ -22,7 +19,6 @@ upgrade=1 backup_restore=1 multi_instance=1 - port_already_use=0 change_url=1 ;;; Options Email=squeak@eauchat.org diff --git a/manifest.json b/manifest.json index 0047428..f9188f0 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "url": "https://squeak.eauchat.org" }, "requirements": { - "yunohost": ">= 4.1.7" + "yunohost": ">= 4.2.4" }, "multi_instance": true, "services": [ diff --git a/scripts/install b/scripts/install index bbd6497..fb71df8 100755 --- a/scripts/install +++ b/scripts/install @@ -80,21 +80,8 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=6 -### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. -### Those deb packages will be installed as dependencies of this package. -### If you're not using this helper: -### - Remove the section "REMOVE DEPENDENCIES" in the remove script -### - Remove the variable "pkg_dependencies" in _common.sh -### - As well as the section "REINSTALL DEPENDENCIES" in the restore script -### - And the section "UPGRADE DEPENDENCIES" in the upgrade script - ynh_install_app_dependencies $pkg_dependencies -#================================================= -# INSTALL NODEJS -#================================================= -ynh_script_progression --message="Installing NodeJS..." --weight=30 - ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= @@ -104,20 +91,31 @@ ynh_script_progression --message="Creating a MySQL database..." --weight=2 db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name -db_pwd= # Will be set by facilmap_create_db ynh_app_setting_set --app=$app --key=db_name --value=$db_name -facilmap_create_db +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name + +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=1 + +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -#ynh_script_progression --message="Setting up source files..." --weight=100 +ynh_script_progression --message="Setting up source files..." --weight=100 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src #ynh_setup_source --dest_dir="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -126,14 +124,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -facilmap_create_user - #================================================= # SPECIFIC SETUP #================================================= @@ -141,7 +131,12 @@ facilmap_create_user #================================================= ynh_script_progression --message="Building node dependencies..." --weight=200 -facilmap_install_app +mkdir -p $final_path +chown -R $app $final_path + +pushd $final_path + ynh_exec_as $app "$ynh_node_load_PATH" $ynh_npm install --prefix "$final_path" -g facilmap-server@"$facilmap_version" +popd #================================================= # SETUP SYSTEMD @@ -149,24 +144,15 @@ facilmap_install_app ynh_script_progression --message="Configuring a systemd service..." --weight=2 # Create a dedicated systemd config -ynh_add_systemd_config --others_var="ynh_node_load_PATH" +ynh_add_systemd_config #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding configuration..." --weight=2 -facilmap_add_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Setting app files permissions.." --weight=2 - -# Set permissions on app files -facilmap_set_permissions +mkdir -p $final_path/etc +ynh_add_config --template="../conf/config.env" --destination="$final_path/etc/facilmap.env" #================================================= # SETUP LOGROTATE @@ -199,22 +185,9 @@ ynh_script_progression --message="Configuring app permissions..." --weight=2 # Make app public if necessary if [ $is_public -eq 1 ] then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi -# ### N.B. : the following extra permissions only make sense if your app -# ### does have for example an admin interface or an api. -# -# # Only the admin can access the admin panel of the app (if the app has an admin panel) -# ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin -# -# # Everyone can access to the api part -# # We don't want to display the tile in the sso so we put --show_tile="false" -# # And we don't want that the YunoHost Admin can remove visitors group to this permission, so we put --protected="true" -# ynh_permission_create --permission="api" --url "/api" --allowed="visitors" --show_tile="false" --protected="true" - #================================================= # RELOAD NGINX #=================================================