From e4702b0b6365d4d457f8cad3986f0854e8adc50e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 22 Jan 2023 10:54:32 +0100 Subject: [PATCH 1/6] Fix linter --- manifest.json | 5 ++--- scripts/backup | 19 +++++++++---------- scripts/install | 13 +++++++------ scripts/restore | 8 +++++--- scripts/upgrade | 14 ++++++-------- 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/manifest.json b/manifest.json index 46146c9..7658d31 100644 --- a/manifest.json +++ b/manifest.json @@ -21,7 +21,7 @@ "email": "jean-baptiste@holcroft.fr" }], "requirements": { - "yunohost": ">= 4.1.2" + "yunohost": ">= 11.0.9" }, "multi_instance": true, "services": [ @@ -31,8 +31,7 @@ "install" : [ { "name": "domain", - "type": "domain", - "example": "domain.org" + "type": "domain" }, { "name": "path", diff --git a/scripts/backup b/scripts/backup index 5a22674..24fb748 100644 --- a/scripts/backup +++ b/scripts/backup @@ -32,29 +32,28 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_print_info --message="Backing up the main app directory..." + ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Backing up nginx web server configuration..." -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP THE MYSQL DATABASE -#================================================= -ynh_print_info --message="Backing up the MySQL database..." -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP #================================================= -# BACKUP THE systemd FILES -ynh_print_info --message="Backing up systemd..." ynh_backup --src_path="/etc/systemd/system/$app.service" +#================================================= +# BACKUP THE MYSQL DATABASE +#================================================= +ynh_print_info --message="Backing up the MySQL database..." + +ynh_mysql_dump_db --database="$db_name" > db.sql + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 107aa82..8613238 100644 --- a/scripts/install +++ b/scripts/install @@ -49,12 +49,11 @@ ynh_app_setting_set --app $app --key web_port --value $port #================================================= # STANDARD MODIFICATIONS -#================================================= - #================================================= # INSTALL DEPENDENCIES #================================================= ynh_script_progression --message="Installing dependencies..." --weight=7 + ynh_install_app_dependencies $pkg_dependencies #================================================= @@ -72,7 +71,6 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= ynh_script_progression --message="Installing sources files..." --weight=10 - ynh_app_setting_set --app=$app --key=final_path --value=$final_path install_sources @@ -83,7 +81,8 @@ install_sources #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx" +ynh_script_progression --message="Configuring NGINX" + if [ "$path_url" == "/" ] then # $finalnginxconf comes from ynh_add_nginx_config @@ -98,15 +97,16 @@ ynh_add_nginx_config 'is_subpath' # CREATE DEDICATED USER #================================================= ynh_script_progression --message="Configuring system user..." + # Create a system user ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # SPECIFIC SETUP #================================================= +ynh_script_progression --message="Configuring application..." # create config file syncserver.ini -ynh_script_progression --message="Configuring application..." ynh_add_config --template="syncserver.ini" --destination="$final_path/syncserver.ini" # Configure init script @@ -135,14 +135,15 @@ set_permissions # SETUP SSOWAT #================================================= ynh_script_progression --message="Configuring permissions" -# accessible by everyone (authentification is done by firefox accounts) +# accessible by everyone (authentification is done by firefox accounts) ynh_permission_update --permission=main --add=visitors --protected=true --show_tile=true #================================================= # RELOAD Services #================================================= ynh_script_progression --message="Restart services..." + ynh_systemd_action --service_name=nginx --action=reload ynh_script_progression --message="Starting $app services..." --weight=3 diff --git a/scripts/restore b/scripts/restore index e42080b..cda9942 100644 --- a/scripts/restore +++ b/scripts/restore @@ -30,21 +30,23 @@ db_user=$db_name #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= + test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS #================================================= +ynh_script_progression --message="Restoring files..." --weight=5 # Restore all config and data -ynh_script_progression --message="Restoring files..." --weight=5 ynh_restore #================================================= # RECREATE THE DEDICATED USER #================================================= ynh_script_progression --message="Recreating the dedicated system user..." + ynh_system_user_create --username="$app" usermod --append --groups www-data "$app" @@ -77,8 +79,8 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./ #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= - ynh_script_progression --message="Reloading services..." --weight=3 + systemctl daemon-reload systemctl enable --quiet $app.service yunohost service add "$app" @@ -88,8 +90,8 @@ yunohost service add "$app" #================================================= # RELOAD NGINX AND UWSGI #================================================= - ynh_script_progression --message="Starting pgadmin services..." --weight=3 + ynh_systemd_action --service_name "$app.service" \ --line_match "Booting worker with pid" --log_path "systemd" ynh_systemd_action --service_name=nginx --action=reload -t 20 diff --git a/scripts/upgrade b/scripts/upgrade index fa25c9c..91ecca3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,7 +28,6 @@ db_user=$app #================================================= # CHECK VERSION #================================================= -ynh_print_info --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -113,21 +112,19 @@ fi #================================================= # STANDARD UPGRADE STEPS -#================================================= - - #================================================= # UPGRADE DEPENDENCIES #================================================= ynh_script_progression --message="Upgrading dependencies..." + ynh_install_app_dependencies $pkg_dependencies #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=6 # Download, check integrity, uncompress and patch the source from app.src -ynh_script_progression --message="Upgrading source files..." --weight=6 if [ -e $final_path/syncserver.ini ]; then config_backup="$(cat $final_path/syncserver.ini)" install_sources @@ -139,7 +136,8 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx" +ynh_script_progression --message="Configuring NGINX" + if [ "$path_url" == "/" ] then # $finalnginxconf comes from ynh_add_nginx_config @@ -159,9 +157,9 @@ ynh_system_user_create --username="$app" #================================================= # SPECIFIC UPGRADE #================================================= -# SETUP UWSGI ynh_script_progression --message="Configuring application..." +# SETUP UWSGI # create config file syncserver.ini ynh_script_progression --message="Configuring application..." ynh_add_config --template="syncserver.ini" --destination="$final_path/syncserver.ini" @@ -187,8 +185,8 @@ set_permissions #================================================= # Migrate legacy permissions to new system #================================================= - ynh_script_progression --message="Set permissions..." + if ynh_legacy_permissions_exists then ynh_legacy_permissions_delete_all From 48d0a1556a7465b07e2ade798340e24af4218741 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 22 Jan 2023 10:58:29 +0100 Subject: [PATCH 2/6] Add README --- doc/DESCRIPTION.md | 3 +++ doc/DESCRIPTION_fr.md | 3 +++ doc/DISCLAIMER.md | 3 +++ doc/DISCLAIMER_fr.md | 3 +++ manifest.json | 7 ++++++- 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 doc/DESCRIPTION.md create mode 100644 doc/DESCRIPTION_fr.md create mode 100644 doc/DISCLAIMER.md create mode 100644 doc/DISCLAIMER_fr.md diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..43ff5c5 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1,3 @@ +The Sync Server provides a replacement for Firefox’s default server (hosted at Mozilla). + +By default, a server set up will defer authentication to the Mozilla-hosted accounts server at [https://accounts.firefox.com](https://accounts.firefox.com). So you will still have to authenticate at Mozilla, but _the storage of your information will be done on your host_. \ No newline at end of file diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..55a0a14 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1,3 @@ +Le serveur de synchronisation permet un remplacement du serveur par défaut de Firefox (hébergé par Mozilla). + +Par défaut, le serveur reporte l'authentification aux serveurs de comptes de Mozilla à https://accounts.firefox.com. vous vous authentifierez donc sur les serveurs de Mozilla, mais _le stockage de vos informations se fera sur votre serveur_. \ No newline at end of file diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..9cae433 --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,3 @@ +## Configuration + +Once installed, reaching `http://domain.tld/path` should show a page explaining how to configure it. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..403fa05 --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,3 @@ +## Configuration + +Une fois installé, la page `http://domain.tld/path` vous explique comment l'utiliser. \ No newline at end of file diff --git a/manifest.json b/manifest.json index 7658d31..121a991 100644 --- a/manifest.json +++ b/manifest.json @@ -4,10 +4,15 @@ "packaging_format": 1, "description": { "en": "Mozilla’s Sync-Server to host your Firefox account data", - "fr": "Le serveur de synchronisation de Mozilla, pour héberger vos données Firefox" + "fr": "Serveur de synchronisation de Mozilla, pour héberger vos données Firefox" }, "version": "1.9.1~ynh3", "url": "https://github.com/mozilla-services/syncserver", + "upstream": { + "license": "MPL-2.0", + "admindoc": "https://mozilla-services.readthedocs.io/en/latest/howtos/run-sync-1.5.html", + "code": "https://github.com/mozilla-services/syncserver" + }, "license": "MPL-2.0", "maintainer": { "name": "Josué Tille", From 44833016eaeaba59204ddbb4a83233ed79cda141 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 22 Jan 2023 09:58:34 +0000 Subject: [PATCH 3/6] Auto-update README --- README.md | 65 ++++++++++++++++++++++------------------------------ README_fr.md | 53 ++++++++++++++++++++++-------------------- 2 files changed, 55 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 3501fe9..3fb7eda 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,17 @@ -# Mozilla’s Sync Server for YunoHost + -[![Integration level](https://dash.yunohost.org/integration/ffsync.svg)](https://dash.yunohost.org/appci/app/ffsync) ![](https://ci-apps.yunohost.org/ci/badges/ffsync.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ffsync.maintain.svg) -[![Install ffsync with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ffsync) +# Firefox Sync Server for YunoHost + +[![Integration level](https://dash.yunohost.org/integration/ffsync.svg)](https://dash.yunohost.org/appci/app/ffsync) ![Working status](https://ci-apps.yunohost.org/ci/badges/ffsync.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/ffsync.maintain.svg) +[![Install Firefox Sync Server with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ffsync) *[Lire ce readme en français.](./README_fr.md)* -> *This package allow you to install ffsync quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* + +> *This package allows you to install Firefox Sync Server 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.* ## Overview @@ -13,51 +19,34 @@ The Sync Server provides a replacement for Firefox’s default server (hosted at By default, a server set up will defer authentication to the Mozilla-hosted accounts server at [https://accounts.firefox.com](https://accounts.firefox.com). So you will still have to authenticate at Mozilla, but _the storage of your information will be done on your host_. -**Shipped version:** 1.9.1 - -## Documentation - - * Official documentation: https://mozilla-services.readthedocs.io/en/latest/howtos/run-sync-1.5.html - * YunoHost documentation: https://yunohost.org/#/app_ffsync +**Shipped version:** 1.9.1~ynh3 +## Disclaimers / important information ## Configuration Once installed, reaching `http://domain.tld/path` should show a page explaining how to configure it. -## Links +## :red_circle: Antifeatures - * Report a bug about this package: https://github.com/YunoHost-Apps/ffsync_ynh/issues - * Upstream app repository: https://github.com/mozilla-services/syncserver - * YunoHost website: https://yunohost.org/ +- **Upstream not maintained**: This software is not maintained anymore. Expect it to break down over time, be exposed to unfixed security breaches, etc. ---- +## Documentation and resources -## Developers info +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: + +## Developer info + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/ffsync_ynh/tree/testing). -Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/ffsync_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/ffsync_ynh/tree/testing --debug or sudo yunohost app upgrade ffsync -u https://github.com/YunoHost-Apps/ffsync_ynh/tree/testing --debug ``` -### Solving problems with Android - -The sure-fire way to know what Sync on Android is really doing is to observe the Android device log using adb logcat. You’ll want to bump your log-level: -``` -adb shell setprop log.tag.FxAccounts VERBOSE -``` - -Then, you can observe the log using: -``` -adb logcat | grep FxAccounts -``` - -It’s best to observe the log while you force a sync from the Android Settings App. You should see output like: - -``` -D FxAccounts(...) fennec :: BaseResource :: HTTP GET https://token.stage.mozaws.net/1.0/sync/1.5 -... -D FxAccounts(...) fennec :: BaseResource :: HTTP GET https://sync-4-us-east-1.stage.mozaws.net/ -``` +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index 84b3024..d1a2d12 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,48 +1,51 @@ -# Serveur de synchronisation de Firefox pour YunoHost + -[![Integration level](https://dash.yunohost.org/integration/ffsync.svg)](https://dash.yunohost.org/appci/app/ffsync) ![](https://ci-apps.yunohost.org/ci/badges/ffsync.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ffsync.maintain.svg) -[![Install ffsync with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ffsync) +# Firefox Sync Server pour YunoHost + +[![Niveau d’intégration](https://dash.yunohost.org/integration/ffsync.svg)](https://dash.yunohost.org/appci/app/ffsync) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/ffsync.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/ffsync.maintain.svg) +[![Installer Firefox Sync Server avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ffsync) *[Read this readme in english.](./README.md)* -> *Ce package vous permet d'installer ffsync rapidement et simplement sur un serveur Yunohost. -Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* -## Vue d'ensemble +> *Ce package vous permet d’installer Firefox Sync Server rapidement et simplement sur un serveur YunoHost. +Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.* + +## Vue d’ensemble Le serveur de synchronisation permet un remplacement du serveur par défaut de Firefox (hébergé par Mozilla). Par défaut, le serveur reporte l'authentification aux serveurs de comptes de Mozilla à https://accounts.firefox.com. vous vous authentifierez donc sur les serveurs de Mozilla, mais _le stockage de vos informations se fera sur votre serveur_. -**Version incluse :** 1.9.1 - -## Documentation - - * Documentation officialle : https://mozilla-services.readthedocs.io/en/latest/howtos/run-sync-1.5.html - * Documentation YunoHost : https://yunohost.org/#/app_ffsync +**Version incluse :** 1.9.1~ynh3 +## Avertissements / informations importantes ## Configuration Une fois installé, la page `http://domain.tld/path` vous explique comment l'utiliser. +## :red_circle: Fonctions indésirables -#### Architectures supportées +- **Upstream not maintained**: This software is not maintained anymore. Expect it to break down over time, be exposed to unfixed security breaches, etc. -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/ffsync%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/ffsync/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/ffsync%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/ffsync/) +## Documentations et ressources -## Liens - - * Rapporter un bug : https://github.com/YunoHost-Apps/ffsync_ynh/issues - * Dépôt de Sync Server : https://github.com/mozilla-services/syncserver - * Site de YunoHost : https://yunohost.org/ - ---- +* Documentation officielle de l’admin : +* Dépôt de code officiel de l’app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs -Merci de faire votre « pull request » sur la [branche testing](https://github.com/YunoHost-Apps/ffsync_ynh/tree/testing). -Pour tester la branche testing, faites comme ceci. -``` +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/ffsync_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/ffsync_ynh/tree/testing --debug ou sudo yunohost app upgrade ffsync -u https://github.com/YunoHost-Apps/ffsync_ynh/tree/testing --debug ``` + +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file From 8b4e4a2d50dee753da1618ccd298ca91a09d4506 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 22 Jan 2023 11:00:04 +0100 Subject: [PATCH 4/6] Update DISCLAIMER.md --- doc/DISCLAIMER.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 9cae433..443a08d 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,3 +1,23 @@ ## Configuration Once installed, reaching `http://domain.tld/path` should show a page explaining how to configure it. + +### Solving problems with Android + +The sure-fire way to know what Sync on Android is really doing is to observe the Android device log using adb logcat. You’ll want to bump your log-level: +``` +adb shell setprop log.tag.FxAccounts VERBOSE +``` + +Then, you can observe the log using: +``` +adb logcat | grep FxAccounts +``` + +It’s best to observe the log while you force a sync from the Android Settings App. You should see output like: + +``` +D FxAccounts(...) fennec :: BaseResource :: HTTP GET https://token.stage.mozaws.net/1.0/sync/1.5 +... +D FxAccounts(...) fennec :: BaseResource :: HTTP GET https://sync-4-us-east-1.stage.mozaws.net/ +``` From c6716b1930e49783412b2f6236002159f981b5a8 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 22 Jan 2023 10:00:17 +0000 Subject: [PATCH 5/6] Auto-update README --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 3fb7eda..43c2e70 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,26 @@ By default, a server set up will defer authentication to the Mozilla-hosted acco Once installed, reaching `http://domain.tld/path` should show a page explaining how to configure it. +### Solving problems with Android + +The sure-fire way to know what Sync on Android is really doing is to observe the Android device log using adb logcat. You’ll want to bump your log-level: +``` +adb shell setprop log.tag.FxAccounts VERBOSE +``` + +Then, you can observe the log using: +``` +adb logcat | grep FxAccounts +``` + +It’s best to observe the log while you force a sync from the Android Settings App. You should see output like: + +``` +D FxAccounts(...) fennec :: BaseResource :: HTTP GET https://token.stage.mozaws.net/1.0/sync/1.5 +... +D FxAccounts(...) fennec :: BaseResource :: HTTP GET https://sync-4-us-east-1.stage.mozaws.net/ +``` + ## :red_circle: Antifeatures - **Upstream not maintained**: This software is not maintained anymore. Expect it to break down over time, be exposed to unfixed security breaches, etc. From 8052adfa9faea15016772b430b94102352d1f2e1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 22 Jan 2023 11:00:36 +0100 Subject: [PATCH 6/6] Update check_process --- check_process | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index 7038a13..15e83ae 100644 --- a/check_process +++ b/check_process @@ -1,7 +1,7 @@ ;; Test name ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) + domain="domain.tld" + path="/path" ; Checks pkg_linter=1 setup_sub_dir=1