1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/facilmap_ynh.git synced 2024-09-03 18:36:07 +02:00

Merge pull request #5 from YunoHost-Apps/patch

Patch
This commit is contained in:
Éric Gaspar 2021-06-26 22:37:11 +02:00 committed by GitHub
commit afe7338729
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 132 additions and 262 deletions

View file

@ -8,7 +8,7 @@ about: When creating a bug report, please use the following template to provide
1. *Read this whole template first.* 1. *Read this whole template first.*
2. *Determine if you are on the right place:* 2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to facilmap itself. Refer to its documentation or repository for help.* - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.* - *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.* 3. *Delete the italic comments as you write over them below, and remove this guide.*
--- ---
@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide
- *If you performed a command from the CLI, the command itself is enough. For example:* - *If you performed a command from the CLI, the command itself is enough. For example:*
```sh ```sh
sudo yunohost app install facilmap sudo yunohost app install the_app
``` ```
- *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:* - *If the error occurs in your browser, explain what you did:*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -1,61 +1,41 @@
# FacilMap for YunoHost <!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Facilmap for YunoHost
[![Integration level](https://dash.yunohost.org/integration/facilmap.svg)](https://dash.yunohost.org/appci/app/facilmap) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/facilmap.svg)](https://dash.yunohost.org/appci/app/facilmap) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.maintain.svg)
[![Install facilmap with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=facilmap) [![Install Facilmap with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=facilmap)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install FacilMap quickly and simply on a YunoHost server. > *This package allows you to install Facilmap quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
[FacilMap](https://github.com/FacilMap/facilmap) is a privacy-friendly, open-source versatile online map that combines different services based on OpenStreetMap and makes it easy to find places, plan routes and create custom maps full of markers, lines and routes, allowing live collaboration. Think of it like [Etherpad](https://etherpad.org/), just for maps. Collaborative maps and routing with a straightforward interface
**Shipped version:** 3.1.0 **Shipped version:** 3.3.0~ynh1
**Demo:** https://facilmap.org/
## Screenshots ## Screenshots
![](https://wiki.openstreetmap.org/w/images/7/7a/FacilMap.png) ![](./doc/screenshots/screenshot.png)
## Documentation and resources
## Demo * Official app website: https://facilmap.org/
* Official user documentation: https://docs.facilmap.org/users/
* [Official demo](https://facilmap.org/) * Official admin documentation: https://docs.facilmap.org/developers/
* Upstream app code repository: https://github.com/FacilMap/facilmap
* YunoHost documentation for this app: https://yunohost.org/app_facilmap
## Documentation
* Official documentation: https://docs.facilmap.org/
## YunoHost specific features
#### Multi-user support
The app doesn't require any login, anyone can use it, unless you install it privately.
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/facilmap%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/facilmap/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/facilmap%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/facilmap/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/facilmap_ynh/issues * Report a bug: https://github.com/YunoHost-Apps/facilmap_ynh/issues
* App website: https://facilmap.org
* Upstream app repository: https://github.com/FacilMap/facilmap
* YunoHost website: https://yunohost.org/
---
## Developer info ## Developer info
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/facilmap_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/facilmap_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
@ -64,3 +44,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/facilmap_ynh/tree/tes
or or
sudo yunohost app upgrade facilmap -u https://github.com/YunoHost-Apps/facilmap_ynh/tree/testing --debug sudo yunohost app upgrade facilmap -u https://github.com/YunoHost-Apps/facilmap_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

View file

@ -1,61 +1,37 @@
# FacilMap pour YunoHost # Facilmap pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/facilmap.svg)](https://dash.yunohost.org/appci/app/facilmap) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/facilmap.svg)](https://dash.yunohost.org/appci/app/facilmap) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/facilmap.maintain.svg)
[![Installer facilmap avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=facilmap) [![Installer Facilmap avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=facilmap)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer facilmap rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer Facilmap rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble ## Vue d'ensemble
[FacilMap](https://github.com/FacilMap/facilmap) est une carte interactive polyvalente, libre et respectueuse de la vie privée qui regroupe des nombreux services basés sur les données libres de OpenStreetMap. FacilMap permet de naviguer, chercher et dessiner facilement des trajets, créer des cartes collaboratives qui peuvent être éditées par plusieurs personnes simultanément, similairement à ce qu'[Etherpad](http://etherpad.org/) propose pour l'édition collaborative de texte. Carte collaborative avec une interface simple et pratique
**Version incluse :** 3.1.0 **Version incluse :** 3.3.0~ynh1
**Démo :** https://facilmap.org/
## Captures d'écran ## Captures d'écran
![](https://wiki.openstreetmap.org/w/images/7/7a/FacilMap.png) ![](./doc/screenshots/screenshot.png)
## Documentations et ressources
## Démo * Site officiel de l'app : https://facilmap.org/
* Documentation officielle utilisateur : https://docs.facilmap.org/users/
* [Démo officielle](https://facilmap.org/) * Documentation officielle de l'admin : https://docs.facilmap.org/developers/
* Dépôt de code officiel de l'app : https://github.com/FacilMap/facilmap
* Documentation YunoHost pour cette app : https://yunohost.org/app_facilmap
## Documentation * Signaler un bug : https://github.com/YunoHost-Apps/facilmap_ynh/issues
* Documentation officielle (en Anglais) : https://docs.facilmap.org/
## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateur
Aucun login ou compte n'est nécessaire pour utiliser l'application, elle est utilisable par n'importe qui, à moins de l'installer de manière privée.
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/facilmap%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/facilmap/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/facilmap%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/facilmap/)
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/facilmap_ynh/issues
* Site de l'application : https://facilmap.org
* Dépôt de l'application principale : https://github.com/FacilMap/facilmap
* Site web YunoHost : https://yunohost.org/
---
## Informations pour les développeurs ## Informations pour les développeurs
**Seulement si vous voulez utiliser une branche de test pour le codage, au lieu de fusionner directement dans la banche principale.**
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/facilmap_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/facilmap_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
@ -64,3 +40,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/facilmap_ynh/tree/tes
ou ou
sudo yunohost app upgrade facilmap -u https://github.com/YunoHost-Apps/facilmap_ynh/tree/testing --debug sudo yunohost app upgrade facilmap -u https://github.com/YunoHost-Apps/facilmap_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,6 +1,3 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
@ -22,7 +19,6 @@
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email=squeak@eauchat.org Email=squeak@eauchat.org

View file

@ -1,3 +1,4 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
# Force usage of https # Force usage of https
@ -23,5 +24,4 @@ location __PATH__/ {
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
more_clear_input_headers 'Accept-Encoding'; more_clear_input_headers 'Accept-Encoding';
} }

View file

@ -1,13 +1,13 @@
[Unit] [Unit]
Description=Facilmap: collaborative maps with a straightforward interface Description=Facilmap: collaborative maps
After=network.target After=network.target
[Service] [Service]
Type=simple Type=simple
Environment=NODE_ENV=production
Environment=DOTENV_CONFIG_PATH=__FINALPATH__/etc/facilmap.env
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
Environment=NODE_ENV=production
Environment=DOTENV_CONFIG_PATH=__FINALPATH__/etc/facilmap.env
Environment="__YNH_NODE_LOAD_PATH__" Environment="__YNH_NODE_LOAD_PATH__"
ExecStart=__FINALPATH__/bin/facilmap-server ExecStart=__FINALPATH__/bin/facilmap-server
WorkingDirectory=__FINALPATH__ WorkingDirectory=__FINALPATH__

0
doc/DISLAIMER.md Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

View file

@ -6,8 +6,16 @@
"en": "Collaborative maps and routing with a straightforward interface", "en": "Collaborative maps and routing with a straightforward interface",
"fr": "Carte collaborative avec une interface simple et pratique" "fr": "Carte collaborative avec une interface simple et pratique"
}, },
"version": "3.1.0~ynh1", "version": "3.3.0~ynh1",
"url": "https://github.com/FacilMap/facilmap", "url": "https://github.com/FacilMap/facilmap",
"upstream": {
"license": "AGPL-3.0",
"website": "https://facilmap.org/",
"demo": "https://facilmap.org/",
"admindoc": "https://docs.facilmap.org/developers/",
"userdoc": "https://docs.facilmap.org/users/",
"code": "https://github.com/FacilMap/facilmap"
},
"license": "AGPL-3.0", "license": "AGPL-3.0",
"maintainer": { "maintainer": {
"name": "Squeak", "name": "Squeak",
@ -15,7 +23,7 @@
"url": "https://squeak.eauchat.org" "url": "https://squeak.eauchat.org"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.7" "yunohost": ">= 4.2.4"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -86,7 +94,7 @@
"name": "maxmind_license_key", "name": "maxmind_license_key",
"type": "string", "type": "string",
"help": { "help": {
"en": "License key associated to the maxmind user id you specified.", "en": "License key associated to the maxmind user ID you specified.",
"fr": "La clé de license associée à l'utilisateur maxmind que vous avez spécifié." "fr": "La clé de license associée à l'utilisateur maxmind que vous avez spécifié."
}, },
"optional": true "optional": true

View file

@ -1,16 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -8,7 +8,8 @@
pkg_dependencies="" pkg_dependencies=""
nodejs_version=14 nodejs_version=14
facilmap_version=3.1.0
facilmap_version=3.3.0
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -37,11 +37,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
ynh_print_info --message="Declaring files to be backed up..." ynh_print_info --message="Declaring files to be backed up..."
### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
### to be backuped and not an actual copy of any file. The actual backup that
### creates and fill the archive with the files happens in the core after this
### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
@ -73,9 +68,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
#================================================= #=================================================
ynh_print_info --message="Backing up the MySQL database..." ynh_print_info --message="Backing up the MySQL database..."
### (However, things like MySQL dumps *do* take some time to run, though the
### copy of the generated dump to the archive still happens later)
ynh_mysql_dump_db --database="$db_name" > db.sql ynh_mysql_dump_db --database="$db_name" > db.sql
#================================================= #=================================================

View file

@ -28,12 +28,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
@ -107,12 +101,6 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
#=================================================
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#================================================= #=================================================

View file

@ -80,21 +80,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=6 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 ynh_install_app_dependencies $pkg_dependencies
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=30
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
#================================================= #=================================================
@ -104,20 +90,25 @@ ynh_script_progression --message="Creating a MySQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name db_user=$db_name
db_pwd= # Will be set by facilmap_create_db db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name 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
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 # 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 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"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -126,14 +117,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_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 # SPECIFIC SETUP
#================================================= #=================================================
@ -141,7 +124,16 @@ facilmap_create_user
#================================================= #=================================================
ynh_script_progression --message="Building node dependencies..." --weight=200 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" 2>/dev/null
popd
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -149,24 +141,15 @@ facilmap_install_app
ynh_script_progression --message="Configuring a systemd service..." --weight=2 ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config --others_var="ynh_node_load_PATH" ynh_add_systemd_config
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding configuration..." --weight=2 ynh_script_progression --message="Adding configuration..." --weight=2
facilmap_add_config mkdir -p $final_path/etc
ynh_add_config --template="../conf/config.env" --destination="$final_path/etc/facilmap.env"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Setting app files permissions.." --weight=2
# Set permissions on app files
facilmap_set_permissions
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
@ -181,7 +164,7 @@ ynh_use_logrotate
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Collaborative maps and routing with a straightforward interface" --log="/var/log/$app/$app.log" yunohost service add $app --description="Collaborative maps and routing" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -199,22 +182,9 @@ ynh_script_progression --message="Configuring app permissions..." --weight=2
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors" ynh_permission_update --permission="main" --add="visitors"
fi 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 # RELOAD NGINX
#================================================= #=================================================

View file

@ -58,12 +58,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=3
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
#=================================================
# REMOVE NODEJS
#=================================================
ynh_script_progression --message="Removing NodeJS version for facilmap..." --weight=4
ynh_remove_nodejs ynh_remove_nodejs
#================================================= #=================================================
@ -90,16 +84,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing log files..." --weight=1
# Remove the log files
ynh_secure_remove --file="/var/log/$app/"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
@ -109,7 +93,6 @@ ynh_script_progression --message="Removing the dedicated system user..." --weigh
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app ynh_system_user_delete --username=$app
ynh_secure_remove --file="/home/$app/"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -51,13 +51,6 @@ test ! -d $final_path \
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"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=2
ynh_restore_file --origin_path="$final_path"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
@ -67,13 +60,15 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei
ynh_system_user_create --username=$app --home_dir="$final_path" ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=2
# Restore permissions on app files ynh_restore_file --origin_path="$final_path"
chown -R root:root $final_path
mkdir -p "$final_path/lib/node_modules/facilmap-server/cache" chmod 750 "$final_path"
chown -R facilmap:facilmap "$final_path/lib/node_modules/facilmap-server/cache" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
@ -84,12 +79,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=10
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# REINSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=30
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
#================================================= #=================================================
@ -98,8 +87,8 @@ ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_script_progression --message="Restoring the MySQL database..." --weight=5 ynh_script_progression --message="Restoring the MySQL database..." --weight=5
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
facilmap_create_db 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 < ./db.sql ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#================================================= #=================================================
@ -115,7 +104,7 @@ systemctl enable $app.service --quiet
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Collaborative maps and routing with a straightforward interface" --log="/var/log/$app/$app.log" yunohost service add $app --description="Collaborative maps and routing" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -124,14 +113,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=5
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Server started" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Server started"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
#ynh_restore_file --origin_path="/etc/cron.d/$app"
#ynh_restore_file --origin_path="/etc/$app/"
#================================================= #=================================================
# RESTORE THE LOGROTATE CONFIGURATION # RESTORE THE LOGROTATE CONFIGURATION
#================================================= #=================================================

View file

@ -62,16 +62,12 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
#if [ "$upgrade_type" == "UPGRADE_APP" ] # Create a dedicated user (if not existing)
#then ynh_system_user_create --username=$app --home_dir="$final_path"
# ynh_script_progression --message="Upgrading source files..." --weight=5
#
# # Download, check integrity, uncompress and patch the source from app.src
# ynh_setup_source --dest_dir="$final_path"
#fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -87,30 +83,22 @@ ynh_add_nginx_config
ynh_script_progression --message="Upgrading dependencies..." --weight=10 ynh_script_progression --message="Upgrading dependencies..." --weight=10
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# UPGRADE NODEJS
#=================================================
ynh_script_progression --message="Installing NodeJS..." --weight=40
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
facilmap_create_user
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
# BUILD NODE DEPENDENCIES # BUILD NODE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Building node dependencies..." --weight=70 ynh_script_progression --message="Install $app..." --weight=20
facilmap_install_app if [ "$upgrade_type" == "UPGRADE_APP" ]
then
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" 2>/dev/null
popd
fi
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -118,14 +106,15 @@ facilmap_install_app
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config --others_var="ynh_node_load_PATH" ynh_add_systemd_config
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Updating config files..." --weight=2 ynh_script_progression --message="Updating config files..." --weight=2
facilmap_add_config mkdir -p "$final_path/etc"
ynh_add_config --template="../conf/config.env" --destination="$final_path/etc/facilmap.env"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -135,7 +124,9 @@ facilmap_add_config
ynh_script_progression --message="Setting files permissions..." --weight=1 ynh_script_progression --message="Setting files permissions..." --weight=1
# Set permissions on app files # Set permissions on app files
facilmap_set_permissions chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
@ -150,7 +141,7 @@ ynh_use_logrotate --non-append
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Collaborative maps and routing with a straightforward interface" --log="/var/log/$app/$app.log" yunohost service add $app --description="Collaborative maps and routing" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE