diff --git a/README.md b/README.md
index a58f66d..5cd7068 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,10 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
Invidious is an interface allowing access to Youtube videos without going through youtube.com
-In addition to constituting an advantage in terms of confidentiality (the data does not pass directly through the services of the giant), this interface offers several features:
+In addition to constituting an advantage in terms of confidentiality (the data does not pass directly through the services of the giant).
+
+### Features:
+
- Audio only mode,
- Dark mode,
- Ability to display Reddit comments instead of YouTube comments,
@@ -32,22 +35,13 @@ In addition to constituting an advantage in terms of confidentiality (the data d
![Screenshot of Invidious](./doc/screenshots/screenshot.png)
-## Disclaimers / important information
-
-## Configuration
-
-You can configure Invidious by modifying the configuration file `/var/www/invidious/config/config.yml` with the help of this [documentation](https://docs.invidious.io/Configuration.md).
-
-## Limitations
-
-* Invidious needs more than 2GB of RAM to build.
-
## :red_circle: Antifeatures
- **Non-free Network Services**: Promotes or depends entirely on a non-free network service.
## Documentation and resources
+* Official app website:
* Official user documentation:
* Official admin documentation:
* Upstream app code repository:
diff --git a/README_fr.md b/README_fr.md
index 2565cfa..848e51a 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -17,7 +17,9 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
## Vue d’ensemble
Invidious est une interface permettant d'accéder aux vidéos Youtube sans passer par youtube.com
-En plus de constituer un avantage sur le plan de la confidentialité (les données ne transitent pas directement par les services du géant), cette interface offre plusieurs fonctionnalités :
+En plus de constituer un avantage sur le plan de la confidentialité (les données ne transitent pas directement par les services du géant).
+
+### Fonctionnalités :
- Mode audio seul,
- Mode sombre,
- Possibilité d'afficher les commentaires Reddit plutôt que les commentaires YouTube,
@@ -31,22 +33,13 @@ En plus de constituer un avantage sur le plan de la confidentialité (les donné
![Capture d’écran de Invidious](./doc/screenshots/screenshot.png)
-## Avertissements / informations importantes
-
-## Configuration
-
-Vous pouvez configurer Invidious en modifiant le fichier de configuration `/var/www/invidious/config/config.yaml` avec l'aide de cette [documentation](https://docs.invidious.io/Configuration.md).
-
-## Limitations
-
-* Invidious a besoin de plus de 3Go de RAM pour être installé.
-
## :red_circle: Fonctions indésirables
- **Non-free Network Services**: Promotes or depends entirely on a non-free network service.
## Documentations et ressources
+* Site officiel de l’app :
* Documentation officielle utilisateur :
* Documentation officielle de l’admin :
* Dépôt de code officiel de l’app :
diff --git a/check_process b/check_process
deleted file mode 100644
index da63c8d..0000000
--- a/check_process
+++ /dev/null
@@ -1,25 +0,0 @@
-;; Test complet
- ; Manifest
- domain="domain.tld"
- path="/"
- is_public=1
- language="fr"
- ; Checks
- pkg_linter=1
- setup_sub_dir=0
- setup_root=1
- setup_nourl=0
- setup_private=1
- setup_public=1
- upgrade=1
- #upgrade=1 from_commit=d0b65b69558b6a1a98761eb7be0b34b4ccb7d6b3
- backup_restore=1
- multi_instance=0
- change_url=0
-;;; Options
-Email=
-Notification=none
-;;; Upgrade options
- ; commit=d0b65b69558b6a1a98761eb7be0b34b4ccb7d6b3
- name=Testing (#36)
- manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
diff --git a/conf/systemd.service b/conf/systemd.service
index 23fdd32..b53066c 100644
--- a/conf/systemd.service
+++ b/conf/systemd.service
@@ -1,5 +1,5 @@
[Unit]
-Description=Invidious: Alternative YouTube front-end
+Description=Invidious: alternative YouTube front-end
After=syslog.target
After=network.target
@@ -7,8 +7,8 @@ After=network.target
Type=simple
User=__APP__
Group=__APP__
-WorkingDirectory=__FINALPATH__
-ExecStart=__FINALPATH__/invidious -o invidious.log
+WorkingDirectory=__INSTALL_DIR__
+ExecStart=__INSTALL_DIR__/invidious -o invidious.log
RestartSec=2s
Restart=always
diff --git a/config_panel.toml b/config_panel.toml
index 14e71f1..48f96ec 100644
--- a/config_panel.toml
+++ b/config_panel.toml
@@ -13,7 +13,7 @@ services = ["__APP__"]
yes = "true"
no = "false"
help = "Allow/Forbid Invidious (local) account creation"
- bind = "registration_enabled:__FINALPATH__/config/config.yml"
+ bind = "registration_enabled:__INSTALL_DIR__/config/config.yml"
[main.config.login_enabled]
ask = "Enable login"
@@ -21,7 +21,7 @@ services = ["__APP__"]
yes = "true"
no = "false"
help = "Allow/Forbid users to log-in"
- bind = "login_enabled:__FINALPATH__/config/config.yml"
+ bind = "login_enabled:__INSTALL_DIR__/config/config.yml"
[main.config.captcha_enabled]
ask = "Enable captcha"
@@ -29,4 +29,4 @@ services = ["__APP__"]
yes = "true"
no = "false"
help = "Enable/Disable the captcha challenge on the login page"
- bind = "captcha_enabled:__FINALPATH__/config/config.yml"
\ No newline at end of file
+ bind = "captcha_enabled:__INSTALL_DIR__/config/config.yml"
\ No newline at end of file
diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md
similarity index 68%
rename from doc/DISCLAIMER.md
rename to doc/ADMIN.md
index f247f41..af87001 100644
--- a/doc/DISCLAIMER.md
+++ b/doc/ADMIN.md
@@ -1,7 +1 @@
-## Configuration
-
You can configure Invidious by modifying the configuration file `/var/www/invidious/config/config.yml` with the help of this [documentation](https://docs.invidious.io/Configuration.md).
-
-## Limitations
-
-* Invidious needs more than 2GB of RAM to build.
diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md
similarity index 66%
rename from doc/DISCLAIMER_fr.md
rename to doc/ADMIN_fr.md
index 1e8f872..374b515 100644
--- a/doc/DISCLAIMER_fr.md
+++ b/doc/ADMIN_fr.md
@@ -1,7 +1 @@
-## Configuration
-
Vous pouvez configurer Invidious en modifiant le fichier de configuration `/var/www/invidious/config/config.yaml` avec l'aide de cette [documentation](https://docs.invidious.io/Configuration.md).
-
-## Limitations
-
-* Invidious a besoin de plus de 3Go de RAM pour être installé.
diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md
index a89e725..ebb0c83 100644
--- a/doc/DESCRIPTION.md
+++ b/doc/DESCRIPTION.md
@@ -1,5 +1,8 @@
Invidious is an interface allowing access to Youtube videos without going through youtube.com
-In addition to constituting an advantage in terms of confidentiality (the data does not pass directly through the services of the giant), this interface offers several features:
+In addition to constituting an advantage in terms of confidentiality (the data does not pass directly through the services of the giant).
+
+### Features:
+
- Audio only mode,
- Dark mode,
- Ability to display Reddit comments instead of YouTube comments,
diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md
index 6ce01db..7027cc4 100644
--- a/doc/DESCRIPTION_fr.md
+++ b/doc/DESCRIPTION_fr.md
@@ -1,5 +1,7 @@
Invidious est une interface permettant d'accéder aux vidéos Youtube sans passer par youtube.com
-En plus de constituer un avantage sur le plan de la confidentialité (les données ne transitent pas directement par les services du géant), cette interface offre plusieurs fonctionnalités :
+En plus de constituer un avantage sur le plan de la confidentialité (les données ne transitent pas directement par les services du géant).
+
+### Fonctionnalités :
- Mode audio seul,
- Mode sombre,
- Possibilité d'afficher les commentaires Reddit plutôt que les commentaires YouTube,
diff --git a/manifest.json b/manifest.json
deleted file mode 100644
index d008375..0000000
--- a/manifest.json
+++ /dev/null
@@ -1,60 +0,0 @@
-{
- "name": "Invidious",
- "id": "invidious",
- "packaging_format": 1,
- "description": {
- "en": "Alternative front-end to YouTube",
- "fr": "Front-end alternatif à YouTube"
- },
- "version": "23.02.14~ynh1",
- "url": "https://invidio.us/",
- "upstream": {
- "license": "GPL-3.0-only",
- "demo": "https://invidious.site/",
- "admindoc": "https://docs.invidious.io/",
- "userdoc": "https://github.com/iv-org/documentation",
- "code": "https://github.com/iv-org/invidious"
- },
- "license": "GPL-3.0-only",
- "maintainer": {
- "name": "eric_G"
- },
- "requirements": {
- "yunohost": ">= 11.0.9"
- },
- "multi_instance": false,
- "services": [
- "nginx"
- ],
- "arguments": {
- "install" : [
- {
- "name": "domain",
- "type": "domain"
- },
- {
- "name": "admin",
- "type": "user"
- },
- {
- "name": "is_public",
- "type": "boolean",
- "help": {
- "en": "If enabled, Invidious will be accessible by people who do not have an account. This can be changed later via the webadmin.",
- "fr": "Si cette case est cochée, Invidious sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
- },
- "default": true
- },
- {
- "name": "language",
- "type": "string",
- "ask": {
- "en": "Choose the application language",
- "fr": "Choisissez la langue de l'application"
- },
- "choices": ["de", "en-US", "es", "fr", "it", "nl", "pt-PT"],
- "default": "fr"
- }
- ]
- }
-}
diff --git a/manifest.toml b/manifest.toml
new file mode 100644
index 0000000..4d62e3c
--- /dev/null
+++ b/manifest.toml
@@ -0,0 +1,70 @@
+packaging_format = 2
+
+id = "invidious"
+name = "Invidious"
+description.en = "Alternative front-end to YouTube"
+description.fr = "Front-end alternatif à YouTube"
+
+version = "23.02.14~ynh1"
+
+maintainers = ["eric_G"]
+
+[upstream]
+license = "GPL-3.0-only"
+demo = "https://invidious.site/"
+admindoc = "https://docs.invidious.io/"
+userdoc = "https://github.com/iv-org/documentation"
+code = "https://github.com/iv-org/invidious"
+website = "https://invidio.us/"
+
+[integration]
+yunohost = ">= 11.1.15"
+architectures = ["amd64"]
+multi_instance = false
+ldap = false
+sso = false
+disk = "50M"
+ram.build = "2G"
+ram.runtime = "50M"
+
+[install]
+ [install.domain]
+ type = "domain"
+ full_domain = true
+
+ [install.admin]
+ type = "user"
+
+ [install.init_main_permission]
+ help.en = "If enabled, Invidious will be accessible by people who do not have an account. This can be changed later via the webadmin."
+ help.fr = "Si cette case est cochée, Invidious sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
+ type = "group"
+ default = "visitors"
+
+ [install.language]
+ ask.en = "Choose the application language"
+ ask.fr = "Choisissez la langue de l'application"
+ type = "string"
+ choices = ["de", "en-US", "es", "fr", "it", "nl", "pt-PT"]
+ default = "fr"
+
+[resources]
+ [resources.system_user]
+
+ [resources.install_dir]
+
+ [resources.ports]
+
+ [resources.permissions]
+ main.url = "/"
+
+ api.url = "/api"
+ api.show_tile = false
+ api.allowed = ["visitors"]
+ api.protected = true
+
+ [resources.apt]
+ packages = "apt-transport-https libssl-dev libxml2-dev libyaml-dev libgmp-dev libreadline-dev postgresql librsvg2-bin imagemagick libsqlite3-dev zlib1g-dev libevent-dev pkg-config libpcre3-dev"
+
+ [resources.database]
+ type = "postgresql"
diff --git a/scripts/_common.sh b/scripts/_common.sh
index ffdbf1d..f76ee04 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -5,8 +5,6 @@
#=================================================
version_commit=7993784701686c057b85c57704537135e6326de9
-# dependencies used by the app
-pkg_dependencies="apt-transport-https libssl-dev libxml2-dev libyaml-dev libgmp-dev libreadline-dev postgresql librsvg2-bin imagemagick libsqlite3-dev zlib1g-dev libevent-dev pkg-config libpcre3-dev"
#=================================================
# PERSONAL HELPERS
diff --git a/scripts/backup b/scripts/backup
index 42b66cd..7f7edc0 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -9,27 +9,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
- ynh_clean_check_starting
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_print_info --message="Loading installation settings..."
-
-app=$YNH_APP_INSTANCE_NAME
-
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-db_name=$(ynh_app_setting_get --app=$app --key=db_name)
-
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@@ -39,7 +18,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
-ynh_backup --src_path="$final_path"
+ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
diff --git a/scripts/change_url b/scripts/change_url
index 345af2a..7e14c62 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -9,60 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-old_domain=$YNH_APP_OLD_DOMAIN
-old_path=$YNH_APP_OLD_PATH
-
-new_domain=$YNH_APP_NEW_DOMAIN
-new_path="/"
-
-app=$YNH_APP_INSTANCE_NAME
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=1
-
-# Needed for helper "ynh_add_nginx_config"
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-port=$(ynh_app_setting_get --app=$app --key=port)
-
-#=================================================
-# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
-#=================================================
-ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
-
-# Backup the current version of the app
-ynh_backup_before_upgrade
-ynh_clean_setup () {
- # 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
- ynh_restore_upgradebackup
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# CHECK WHICH PARTS SHOULD BE CHANGED
-#=================================================
-
-change_domain=0
-if [ "$old_domain" != "$new_domain" ]
-then
- change_domain=1
-fi
-
-change_path=0
-if [ "$old_path" != "$new_path" ]
-then
- change_path=1
-fi
-
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@@ -77,29 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
-nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
-
-# Change the path in the NGINX config file
-if [ $change_path -eq 1 ]
-then
- # Make a backup of the original NGINX config file if modified
- ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
- # Set global variables for NGINX helper
- domain="$old_domain"
- path_url="$new_path"
- # Create a dedicated NGINX config
- ynh_add_nginx_config
-fi
-
-# Change the domain for NGINX
-if [ $change_domain -eq 1 ]
-then
- # Delete file checksum for the old conf file location
- ynh_delete_file_checksum --file="$nginx_conf_path"
- mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
- # Store file checksum for the new config file location
- ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
-fi
+ynh_change_url_nginx_config
#=================================================
# GENERIC FINALISATION
@@ -110,13 +34,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=1
-
-ynh_systemd_action --service_name=nginx --action=reload
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/install b/scripts/install
index 6e42f4c..54463d2 100644
--- a/scripts/install
+++ b/scripts/install
@@ -9,124 +9,58 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
- ynh_clean_check_starting
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
-domain=$YNH_APP_ARG_DOMAIN
-path_url="/"
-is_public=$YNH_APP_ARG_IS_PUBLIC
-language=$YNH_APP_ARG_LANGUAGE
-admin=$YNH_APP_ARG_ADMIN
email=$(ynh_user_get_info --username=$admin --key=mail)
-
-app=$YNH_APP_INSTANCE_NAME
-
registration_enabled="true"
login_enabled="true"
captcha_enabled="true"
-#=================================================
-# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
-#=================================================
-ynh_script_progression --message="Validating installation parameters..." --weight=1
-
-final_path=/var/www/$app
-test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
-
-# Register (book) web path
-ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
-
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2
-ynh_app_setting_set --app=$app --key=domain --value=$domain
-ynh_app_setting_set --app=$app --key=path --value=$path_url
-ynh_app_setting_set --app=$app --key=language --value=$language
-ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=email --value=$email
ynh_app_setting_set --app=$app --key=registration_enabled --value=$registration_enabled
ynh_app_setting_set --app=$app --key=login_enabled --value=$login_enabled
ynh_app_setting_set --app=$app --key=captcha_enabled --value=$captcha_enabled
-#=================================================
-# STANDARD MODIFICATIONS
-#=================================================
-# FIND AND OPEN A PORT
-#=================================================
-ynh_script_progression --message="Finding an available port..." --weight=0
-
-# Find an available port
-port=$(ynh_find_port --port=3000)
-ynh_app_setting_set --app=$app --key=port --value=$port
-
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=15
-ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
-
ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- --channel=stable
-#=================================================
-# CREATE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Configuring system user..." --weight=1
-
-# Create a system user
-ynh_system_user_create --username=$app --home_dir="$final_path"
-
-#=================================================
-# CREATE A POSTGRESQL DATABASE
-#=================================================
-ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
-
-db_name=$(ynh_sanitize_dbid --db_name=$app)
-db_user=$db_name
-ynh_app_setting_set --app=$app --key=db_name --value=$db_name
-ynh_psql_test_if_first_run
-ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
-
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=4
-ynh_app_setting_set --app=$app --key=final_path --value=$final_path
+mkdir -p "$install_dir"
+chown -R $app:www-data "$install_dir"
-mkdir -p "$final_path"
-chown -R $app:www-data "$final_path"
-
-git config --system --add safe.directory $final_path
+git config --system --add safe.directory $install_dir
# Download, check integrity, uncompress and patch the source from GitHub
-ynh_exec_as $app git clone https://github.com/iv-org/invidious "$final_path" --quiet
+#ynh_exec_as $app
+git clone https://github.com/iv-org/invidious "$install_dir" --quiet
-pushd "$final_path"
- ynh_exec_as $app git reset --hard --quiet $version_commit
+pushd "$install_dir"
+ #ynh_exec_as $app
+ git reset --hard --quiet $version_commit
popd
-for i in $final_path/config/sql/*.sql ; do
+for i in $install_dir/config/sql/*.sql ; do
ynh_replace_string --match_string="kemal" --replace_string=$db_user --target_file="$i" ;
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < "$i" ;
done
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:www-data "$final_path"
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
@@ -143,51 +77,35 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Building Invidious.. (this will take some time and resources!)" --weight=60
-pushd "$final_path"
+pushd "$install_dir"
ynh_exec_warn_less shards install --production
- ynh_exec_warn_less crystal build $final_path/src/invidious.cr --release
+ ynh_exec_warn_less crystal build $install_dir/src/invidious.cr --release
popd
+#=================================================
+# SYSTEM CONFIGURATION
+#=================================================
+ynh_script_progression --message="Adding system configurations related to $app ..." --weight=10
+
+ynh_add_config --template="../conf/cron_invidious" --destination="/etc/cron.d/$app"
+chown root: "/etc/cron.d/$app"
+chmod 644 "/etc/cron.d/$app"
+
+ynh_use_logrotate
+
+ynh_add_systemd_config
+
+yunohost service add $app --description="Invidious is an alternative front-end to YouTube" --log="/var/log/$app/$app.log"
+
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=1
-ynh_add_config --template="../conf/config.yml" --destination="$final_path/config/config.yml"
+ynh_add_config --template="../conf/config.yml" --destination="$install_dir/config/config.yml"
-chmod 600 "$final_path/config/config.yml"
-chown $app:$app "$final_path/config/config.yml"
-
-#=================================================
-# SETUP SYSTEMD
-#=================================================
-ynh_script_progression --message="Configuring a systemd service..." --weight=1
-
-ynh_add_systemd_config
-
-#=================================================
-# SETUP CRON
-#=================================================
-ynh_script_progression --message="Setuping a cron..." --weight=1
-
-ynh_add_config --template="../conf/cron_invidious" --destination="/etc/cron.d/$app"
-chown root: "/etc/cron.d/$app"
-chmod 644 "/etc/cron.d/$app"
-
-#=================================================
-# SETUP LOGROTATE
-#=================================================
-ynh_script_progression --message="Configuring log rotation..." --weight=1
-
-# Use logrotate to manage application logfile(s)
-ynh_use_logrotate
-
-#=================================================
-# INTEGRATE SERVICE IN YUNOHOST
-#=================================================
-ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
-
-yunohost service add $app --description="Invidious is an alternative front-end to YouTube" --log="/var/log/$app/$app.log"
+chmod 600 "$install_dir/config/config.yml"
+chown $app:$app "$install_dir/config/config.yml"
#=================================================
# START SYSTEMD SERVICE
@@ -197,26 +115,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path=systemd
-#=================================================
-# SETUP SSOWAT
-#=================================================
-ynh_script_progression --message="Configuring permissions..." --weight=1
-
-# Make app public if necessary or protect it
-if [ $is_public -eq 1 ]
-then
- ynh_permission_update --permission="main" --add="visitors"
-fi
-
-ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
-
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=2
-
-ynh_systemd_action --service_name=nginx --action=reload
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/remove b/scripts/remove
index 2382b33..95cc5e2 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -9,19 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=1
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-port=$(ynh_app_setting_get --app=$app --key=port)
-db_name=$(ynh_app_setting_get --app=$app --key=db_name)
-db_user=$db_name
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-
#=================================================
# STANDARD REMOVE
#=================================================
@@ -36,73 +23,24 @@ then
fi
#=================================================
-# STOP AND REMOVE SERVICE
+# REMOVE SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
+ynh_script_progression --message="Removing system configurations related to $app..." --weight=10
+
+dpkg --remove crystal
# Remove the dedicated systemd config
ynh_remove_systemd_config
-#=================================================
-# REMOVE THE POSTGRESQL DATABASE
-#=================================================
-ynh_script_progression --message="Removing the PostgreSQL database..." --weight=2
-
-# Remove a database if it exists, along with the associated user
-ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
-
-#=================================================
-# REMOVE DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Removing dependencies..." --weight=1
-
-# Remove metapackage and its dependencies
-ynh_remove_app_dependencies
-
-dpkg --remove crystal
-
-#=================================================
-# REMOVE APP MAIN DIR
-#=================================================
-ynh_script_progression --message="Removing Invidious main directory..." --weight=6
-
-# Remove the app directory securely
-ynh_secure_remove --file="$final_path"
-
-#=================================================
-# REMOVE NGINX CONFIGURATION
-#=================================================
-ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5
-
# Remove the dedicated NGINX config
ynh_remove_nginx_config
-#=================================================
-# REMOVE LOGROTATE CONFIGURATION
-#=================================================
-ynh_script_progression --message="Removing logrotate configuration..." --weight=1
-
# Remove the app-specific logrotate config
ynh_remove_logrotate
-#=================================================
-# REMOVE VARIOUS FILES
-#=================================================
-ynh_script_progression --message="Removing the cron file..." --weight=1
-
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# REMOVE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Removing the dedicated system user..." --weight=1
-
-# Delete a system user
-ynh_system_user_delete --username=$app
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/restore b/scripts/restore
index 78969f0..d97cae5 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -9,37 +9,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
- ynh_clean_check_starting
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading settings..." --weight=1
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-path_url=$(ynh_app_setting_get --app=$app --key=path)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-db_name=$(ynh_app_setting_get --app=$app --key=db_name)
-db_user=$db_name
-db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
-
-#=================================================
-# CHECK IF THE APP CAN BE RESTORED
-#=================================================
-ynh_script_progression --message="Validating restoration parameters..." --weight=2
-
-test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
-
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
@@ -49,24 +18,16 @@ ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
-#=================================================
-# RECREATE THE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
-
-# Create the dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir="$final_path"
-
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
-ynh_script_progression --message="Restoring Invidious main directory..." --weight=4
+ynh_script_progression --message="Restoring the app main directory..." --weight=4
-ynh_restore_file --origin_path="$final_path"
+ynh_restore_file --origin_path="$install_dir"
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:www-data "$final_path"
+chmod 750 "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
#=================================================
# SPECIFIC RESTORATION
@@ -75,9 +36,6 @@ chown -R $app:www-data "$final_path"
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
-# Define and install dependencies
-ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
-
ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- --channel=stable
#=================================================
@@ -85,54 +43,32 @@ ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- -
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
-ynh_psql_test_if_first_run
-ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#=================================================
-# RESTORE SYSTEMD
+# RESTORE SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Restoring the systemd configuration..." --weight=5
+ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
-#=================================================
-# RESTORE VARIOUS FILES
-#=================================================
-ynh_script_progression --message="Restoring various files..." --weight=1
-
ynh_restore_file --origin_path="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
-#=================================================
-# RESTORE THE LOGROTATE CONFIGURATION
-#=================================================
-ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
-
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
-#=================================================
-# INTEGRATE SERVICE IN YUNOHOST
-#=================================================
-ynh_script_progression --message="Integrating service in YunoHost..."
-
yunohost service add $app --description="Invidious is an alternative front-end to YouTube" --log="/var/log/$app/$app.log"
-#=================================================
-# START SYSTEMD SERVICE
-#=================================================
-ynh_script_progression --message="Starting a systemd service..." --weight=1
-
-ynh_systemd_action --service_name=$app --action=start --log_path=systemd
-
#=================================================
# GENERIC FINALIZATION
#=================================================
-# RELOAD NGINX
+# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=1
+ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
+
+ynh_systemd_action --service_name=$app --action=start --log_path=systemd
ynh_systemd_action --service_name=nginx --action=reload
diff --git a/scripts/upgrade b/scripts/upgrade
index b3c4107..0b80206 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -9,48 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=2
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-path_url=$(ynh_app_setting_get --app=$app --key=path)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-admin=$(ynh_app_setting_get --app=$app --key=admin)
-port=$(ynh_app_setting_get --app=$app --key=port)
-language=$(ynh_app_setting_get --app=$app --key=language)
-db_name=$(ynh_app_setting_get --app=$app --key=db_name)
-db_user=$db_name
-db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
-email=$(ynh_app_setting_get --app=$app --key=email)
-
-registration_enabled=$(ynh_app_setting_get --app=$app --key=registration_enabled)
-login_enabled=$(ynh_app_setting_get --app=$app --key=login_enabled)
-captcha_enabled=$(ynh_app_setting_get --app=$app --key=captcha_enabled)
-
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
-#=================================================
-# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
-#=================================================
-ynh_script_progression --message="Backing up Invidious before upgrading..." --weight=4
-
-# Backup the current version of the app
-ynh_backup_before_upgrade
-ynh_clean_setup () {
- # restore it if the upgrade fails
- ynh_restore_upgradebackup
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@@ -65,43 +29,26 @@ ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
-if [ -z "$registration_enabled" ]; then
+if [ -z "${registration_enabled:-}" ]; then
registration_enabled="true"
ynh_app_setting_set --app=$app --key=registration_enabled --value=$registration_enabled
fi
-if [ -z "$login_enabled" ]; then
+if [ -z "${login_enabled:-}" ]; then
login_enabled="true"
ynh_app_setting_set --app=$app --key=login_enabled --value=$login_enabled
fi
-if [ -z "$captcha_enabled" ]; then
+if [ -z "${captcha_enabled:-}" ]; then
captcha_enabled="true"
ynh_app_setting_set --app=$app --key=captcha_enabled --value=$captcha_enabled
fi
-# Cleaning legacy permissions
-if ynh_legacy_permissions_exists; then
- ynh_legacy_permissions_delete_all
-
- ynh_app_setting_delete --app=$app --key=is_public
-fi
-
-#=================================================
-# CREATE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
-
-# Create a dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir="$final_path"
-
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=8
-ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
-
ynh_exec_warn_less curl -fsSL https://crystal-lang.org/install.sh | bash -s -- --channel=stable
#=================================================
@@ -112,72 +59,47 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=5
- pushd $final_path
- chown -R $app:www-data "$final_path"
- git config --system --add safe.directory $final_path
+ pushd $install_dir
+ chown -R $app:www-data "$install_dir"
+ git config --system --add safe.directory $install_dir
ynh_exec_as $app git fetch
#git checkout master
ynh_exec_as $app git reset --hard --quiet $version_commit
ynh_exec_as $app git pull
ynh_exec_warn_less shards install --production
- ynh_exec_warn_less crystal build $final_path/src/invidious.cr --release
+ ynh_exec_warn_less crystal build $install_dir/src/invidious.cr --release
popd
fi
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:www-data "$final_path"
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
#=================================================
-# NGINX CONFIGURATION
+# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
+ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
+ynh_add_systemd_config
+
+ynh_add_config --template="../conf/cron_invidious" --destination="/etc/cron.d/$app"
+chown root: "/etc/cron.d/$app"
+chmod 644 "/etc/cron.d/$app"
+
+ynh_use_logrotate --non-append
+
+yunohost service add $app --description="Invidious is an alternative front-end to YouTube" --log="/var/log/$app/$app.log"
+
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..."
-ynh_add_config --template="../conf/config.yml" --destination="$final_path/config/config.yml"
-chmod 600 $final_path/config/config.yml
-
-#=================================================
-# SETUP SYSTEMD
-#=================================================
-ynh_script_progression --message="Configuring a systemd service..." --weight=2
-
-# Create a dedicated systemd config
-ynh_add_systemd_config
-
-#=================================================
-# SETUP CRON
-#=================================================
-ynh_script_progression --message="Setuping a cron..." --weight=1
-
-ynh_add_config --template="../conf/cron_invidious" --destination="/etc/cron.d/$app"
-chown root: "/etc/cron.d/$app"
-chmod 644 "/etc/cron.d/$app"
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# SETUP LOGROTATE
-#=================================================
-ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
-
-# Use logrotate to manage app-specific logfile(s)
-ynh_use_logrotate --non-append
-
-#=================================================
-# INTEGRATE SERVICE IN YUNOHOST
-#=================================================
-ynh_script_progression --message="Integrating service in YunoHost..." --weight=3
-
-yunohost service add $app --description="Invidious is an alternative front-end to YouTube" --log="/var/log/$app/$app.log"
+ynh_add_config --template="../conf/config.yml" --destination="$install_dir/config/config.yml"
+chmod 600 $install_dir/config/config.yml
#=================================================
# START SYSTEMD SERVICE
@@ -186,13 +108,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=restart --log_path=systemd
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=1
-
-ynh_systemd_action --service_name=nginx --action=reload
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/tests.toml b/tests.toml
new file mode 100644
index 0000000..c7f3170
--- /dev/null
+++ b/tests.toml
@@ -0,0 +1,9 @@
+test_format = 1.0
+
+[default]
+
+ # -------------------------------
+ # Commits to test upgrade from
+ # -------------------------------
+
+ test_upgrade_from.f468e338.name = "Upgrade from #111"