diff --git a/README.md b/README.md
index c0c7962..1ac24aa 100644
--- a/README.md
+++ b/README.md
@@ -27,19 +27,6 @@ BookWyrm is a social network for tracking your reading, talking about books, wri

-## Disclaimers / important information
-
-This project is still young and isn't, at the moment, very stable, so please proceed with caution when running in production.
-
-Generate the admin code with `sudo -u bookwyrm /var/www/bookwyrm/venv/bin/python3 /var/www/bookwyrm/manage.py admin_code`,
-and copy the admin code to use when you create your admin account. You can get your code
-at any time by re-running that command. Here's an example output:
-```
-*******************************************
-Use this code to create your admin account:
-c6c35779-af3a-4091-b330-c026610920d6
-*******************************************
-```
## Documentation and resources
* Official app website:
diff --git a/README_fr.md b/README_fr.md
index 8641247..9bc5d36 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -27,20 +27,6 @@ BookWyrm est un réseau social pour garder la trace de vos lectures, parler de l

-## Avertissements / informations importantes
-
-Ce projet est encore jeune et n'est pas, pour le moment, très stable, faites preuve de prudence lors de son utilisation en production.
-
-Générez le code administrateur avec `sudo -u bookwyrm /var/www/bookwyrm/venv/bin/python3 /var/www/bookwyrm/manage.py admin_code`,
-et copiez le code administrateur à utiliser lors de la création de votre compte administrateur. Vous pouvez obtenir votre code
-à tout moment en réexécutant cette commande. Voici un exemple de sortie :
-```
-*******************************************
-Use this code to create your admin account:
-c6c35779-af3a-4091-b330-c026610920d6
-*******************************************
-```
-
## Documentations et ressources
* Site officiel de l’app :
diff --git a/check_process b/check_process
deleted file mode 100644
index 0d5791b..0000000
--- a/check_process
+++ /dev/null
@@ -1,25 +0,0 @@
-;; Test complet
- ; Manifest
- domain="domain.tld"
- is_public=1
- language="fr-fr"
- admin="john"
- ; Checks
- pkg_linter=1
- setup_sub_dir=0
- setup_root=1
- setup_nourl=0
- setup_private=1
- setup_public=1
- upgrade=1
- # 0.5.3ynh1
- upgrade=1 from_commit=2292d0d68f5ba9e48f4cbb6105db64b4da4eba74
- backup_restore=1
- multi_instance=0
- change_url=0
-;;; Options
-Email=oufmilo@protonmail.com
-Notification=all
-;;; Upgrade options
- ; commit=2292d0d68f5ba9e48f4cbb6105db64b4da4eba74
- name=0.5.3~ynh1
\ No newline at end of file
diff --git a/conf/.env.production b/conf/.env.production
index 222eb53..c05bcbf 100644
--- a/conf/.env.production
+++ b/conf/.env.production
@@ -15,7 +15,7 @@ DEFAULT_LANGUAGE="English"
## Leave unset to allow all hosts
#ALLOWED_HOSTS="localhost,127.0.0.1,[::1]"
-MEDIA_ROOT=__FINALPATH__/images/
+MEDIA_ROOT=__INSTALL_DIR__/images/
# Database configuration
PGPORT=5432
diff --git a/conf/bookwyrm-beat.service b/conf/bookwyrm-beat.service
index 49a1ba7..71e574f 100644
--- a/conf/bookwyrm-beat.service
+++ b/conf/bookwyrm-beat.service
@@ -7,9 +7,9 @@ PartOf=__APP__.target
[Service]
User=__APP__
Group=__APP__
-WorkingDirectory=__FINALPATH__/
-EnvironmentFile=__FINALPATH__/.env
-ExecStart=__FINALPATH__/venv/bin/celery -A celerywyrm beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler
+WorkingDirectory=__INSTALL_DIR__/
+EnvironmentFile=__INSTALL_DIR__/.env
+ExecStart=__INSTALL_DIR__/venv/bin/celery -A celerywyrm beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler
NoNewPrivileges=yes
PrivateTmp=yes
diff --git a/conf/bookwyrm-server.service b/conf/bookwyrm-server.service
index 289fe6a..568143c 100644
--- a/conf/bookwyrm-server.service
+++ b/conf/bookwyrm-server.service
@@ -7,9 +7,9 @@ PartOf=__APP__.target
[Service]
User=__APP__
Group=__APP__
-WorkingDirectory=__FINALPATH__/
-EnvironmentFile=__FINALPATH__/.env
-ExecStart=__FINALPATH__/venv/bin/gunicorn bookwyrm.wsgi:application --bind 127.0.0.1:__PORT__
+WorkingDirectory=__INSTALL_DIR__/
+EnvironmentFile=__INSTALL_DIR__/.env
+ExecStart=__INSTALL_DIR__/venv/bin/gunicorn bookwyrm.wsgi:application --bind 127.0.0.1:__PORT__
[Install]
WantedBy=multi-user.target
diff --git a/conf/bookwyrm-worker.service b/conf/bookwyrm-worker.service
index 6bec4bd..739c43d 100644
--- a/conf/bookwyrm-worker.service
+++ b/conf/bookwyrm-worker.service
@@ -7,9 +7,9 @@ PartOf=__APP__.target
[Service]
User=__APP__
Group=__APP__
-WorkingDirectory=__FINALPATH__/
-EnvironmentFile=__FINALPATH__/.env
-ExecStart=__FINALPATH__/venv/bin/celery -A celerywyrm worker -l info -Q high_priority,medium_priority,low_priority
+WorkingDirectory=__INSTALL_DIR__/
+EnvironmentFile=__INSTALL_DIR__/.env
+ExecStart=__INSTALL_DIR__/venv/bin/celery -A celerywyrm worker -l info -Q high_priority,medium_priority,low_priority
NoNewPrivileges=yes
PrivateTmp=yes
diff --git a/conf/nginx.conf b/conf/nginx.conf
index 8ad14a9..4f85de8 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -8,9 +8,9 @@ location __PATH__/ {
}
location /images/ {
- alias __FINALPATH__/images/;
+ alias __INSTALL_DIR__/images/;
}
location /static/ {
- alias __FINALPATH__/static/;
+ alias __INSTALL_DIR__/static/;
}
diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md
deleted file mode 100644
index d29e6a3..0000000
--- a/doc/DISCLAIMER.md
+++ /dev/null
@@ -1,11 +0,0 @@
-This project is still young and isn't, at the moment, very stable, so please proceed with caution when running in production.
-
-Generate the admin code with `sudo -u bookwyrm /var/www/bookwyrm/venv/bin/python3 /var/www/bookwyrm/manage.py admin_code`,
-and copy the admin code to use when you create your admin account. You can get your code
-at any time by re-running that command. Here's an example output:
-```
-*******************************************
-Use this code to create your admin account:
-c6c35779-af3a-4091-b330-c026610920d6
-*******************************************
-```
\ No newline at end of file
diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md
deleted file mode 100644
index 14042b6..0000000
--- a/doc/DISCLAIMER_fr.md
+++ /dev/null
@@ -1,11 +0,0 @@
-Ce projet est encore jeune et n'est pas, pour le moment, très stable, faites preuve de prudence lors de son utilisation en production.
-
-Générez le code administrateur avec `sudo -u bookwyrm /var/www/bookwyrm/venv/bin/python3 /var/www/bookwyrm/manage.py admin_code`,
-et copiez le code administrateur à utiliser lors de la création de votre compte administrateur. Vous pouvez obtenir votre code
-à tout moment en réexécutant cette commande. Voici un exemple de sortie :
-```
-*******************************************
-Use this code to create your admin account:
-c6c35779-af3a-4091-b330-c026610920d6
-*******************************************
-```
diff --git a/manifest.json b/manifest.json
deleted file mode 100644
index 2e1a619..0000000
--- a/manifest.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "name": "BookWyrm",
- "id": "bookwyrm",
- "packaging_format": 1,
- "description": {
- "en": "Platform for social reading",
- "fr": "Plateforme de lecture sociale"
- },
- "version": "0.5.4~ynh1",
- "url": "https://github.com/bookwyrm-social/bookwyrm",
- "upstream": {
- "license": "AGPL-3.0-or-later",
- "website": "https://joinbookwyrm.com/fr/",
- "demo": "https://joinbookwyrm.com/fr/",
- "admindoc": "https://docs.joinbookwyrm.com/",
- "code": "https://github.com/bookwyrm-social/bookwyrm"
- },
- "license": "AGPL-3.0-or-later",
- "maintainer": {
- "name": "oufmilo"
- },
- "requirements": {
- "yunohost": ">= 11.0.9"
- },
- "multi_instance": true,
- "services": [
- "nginx",
- "postgresql"
- ],
- "arguments": {
- "install": [
- {
- "name": "domain",
- "type": "domain"
- },
- {
- "name": "is_public",
- "type": "boolean",
- "default": true
- },
- {
- "name": "language",
- "type": "string",
- "ask": {
- "en": "Choose the application language",
- "fr": "Choisissez la langue de l'application"
- },
- "choices": [
- "de-de",
- "en-us",
- "es-es",
- "fr-fr",
- "it-it",
- "pt-pt",
- "zh-hans"
- ],
- "default": "fr-fr"
- },
- {
- "name": "admin",
- "type": "user"
- }
- ]
- }
-}
diff --git a/manifest.toml b/manifest.toml
new file mode 100644
index 0000000..0d2985b
--- /dev/null
+++ b/manifest.toml
@@ -0,0 +1,67 @@
+packaging_format = 2
+
+id = "bookwyrm"
+name = "BookWyrm"
+description.en = "Platform for social reading"
+description.fr = "Plateforme de lecture sociale"
+
+version = "0.5.4~ynh1"
+
+maintainers = ["oufmilo"]
+
+[upstream]
+license = "AGPL-3.0-or-later"
+website = "https://joinbookwyrm.com/fr/"
+demo = "https://joinbookwyrm.com/fr/"
+admindoc = "https://docs.joinbookwyrm.com/"
+code = "https://github.com/bookwyrm-social/bookwyrm"
+
+[integration]
+yunohost = ">= 11.0.9"
+architectures = "all"
+multi_instance = false
+ldap = "not_relevant"
+sso = "not_relevant"
+disk = "50M"
+ram.build = "50M"
+ram.runtime = "50M"
+
+[install]
+ [install.domain]
+ # this is a generic question - ask strings are automatically handled by Yunohost's core
+ type = "domain"
+ full_domain = true
+
+ [install.init_main_permission]
+ type = "group"
+ default = "visitors"
+
+ [install.language]
+ ask.en = "Choose the application language"
+ ask.fr = "Choisissez la langue de l'application"
+ type = "string"
+ choices = ["de-de", "en-us", "es-es", "fr-fr", "it-it", "pt-pt", "zh-hans"]
+ default = "fr-fr"
+
+ [install.admin]
+ # this is a generic question - ask strings are automatically handled by Yunohost's core
+ type = "user"
+
+[resources]
+ [resources.system_user]
+
+ [resources.install_dir]
+
+ [resources.data_dir]
+
+ [resources.permissions]
+ main.url = "/"
+
+ [resources.ports]
+ main.default = 8000
+
+ [resources.apt]
+ packages = "postgresql, postgresql-contrib, python3-venv, libpq-dev"
+
+ [resources.database]
+ type = "postgresql"
\ No newline at end of file
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 2bccbe6..944a65e 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -4,9 +4,6 @@
# COMMON VARIABLES
#=================================================
-# dependencies used by the app
-pkg_dependencies="postgresql postgresql-contrib python3-venv libpq-dev"
-
#=================================================
# PERSONAL HELPERS
#=================================================
diff --git a/scripts/backup b/scripts/backup
index d66eaf1..5d28395 100755
--- a/scripts/backup
+++ b/scripts/backup
@@ -10,28 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
- ### Remove this function if there's nothing to clean before calling the remove script.
- true
-}
-# 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
#=================================================
@@ -41,7 +19,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/install b/scripts/install
index a994bb8..d89d281 100755
--- a/scripts/install
+++ b/scripts/install
@@ -9,131 +9,46 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
- ### Remove this function if there's nothing to clean before calling the remove script.
- true
-}
-# 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
-
-app=$YNH_APP_INSTANCE_NAME
admin_mail=$(ynh_user_get_info --username=$admin --key=username)
key=$(ynh_string_random --length=32)
-#=================================================
-# 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=1
-
-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
-
-#=================================================
-# STANDARD MODIFICATIONS
-#=================================================
-# FIND AND OPEN A PORT
-#=================================================
-ynh_script_progression --message="Finding an available port..." --weight=1
-
-port=$(ynh_find_port --port=8000)
-ynh_app_setting_set --app=$app --key=port --value=$port
-
-#=================================================
-# INSTALL DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Installing dependencies..." --weight=1
-
-ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
-
-#=================================================
-# 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=1
-
-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=1
-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"
+ynh_setup_source --dest_dir="$install_dir"
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app:www-data "$final_path"
+# Set permissions to app files
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
#=================================================
# CONFIGURE THEN INSTALL SCRIPT AND DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing service script..." --weight=1
-ynh_add_config --template="../conf/.env.production" --destination="$final_path/.env"
-chmod 600 $final_path/.env
-chown $app:www-data "$final_path/.env"
+ynh_add_config --template="../conf/.env.production" --destination="$install_dir/.env"
+chmod 600 $install_dir/.env
+chown $app:www-data "$install_dir/.env"
-set -a; source "$final_path/.env"; set +a
+set -a; source "$install_dir/.env"; set +a
-mkdir "$final_path/venv"
-python3 -m venv "$final_path/venv"
-$final_path/venv/bin/pip3 install -r "$final_path/requirements.txt"
+mkdir "$install_dir/venv"
+python3 -m venv "$install_dir/venv"
+$install_dir/venv/bin/pip3 install -r "$install_dir/requirements.txt"
#=================================================
# INITIALIZE DATABASE
#=================================================
ynh_script_progression --message="Initializing database..." --weight=1
-$final_path/venv/bin/python3 "$final_path/manage.py" migrate
-$final_path/venv/bin/python3 "$final_path/manage.py" initdb
-$final_path/venv/bin/python3 "$final_path/manage.py" collectstatic --no-input
+$install_dir/venv/bin/python3 "$install_dir/manage.py" migrate
+$install_dir/venv/bin/python3 "$install_dir/manage.py" initdb
+$install_dir/venv/bin/python3 "$install_dir/manage.py" collectstatic --no-input
-#=================================================
-# SET PERMISSIONS ON BOOKWYRM DIRECTORY
-#=================================================
-
-chown -R $app:www-data $final_path
#=================================================
# NGINX CONFIGURATION
@@ -176,30 +91,6 @@ ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="sys
ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid"
ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="ready"
-#=================================================
-# SETUP SSOWAT
-#=================================================
-ynh_script_progression --message="Configuring permissions..." --weight=1
-
-
-if [ $is_public -eq 1 ]
-then
- # Everyone can access the app.
- # The "main" permission is automatically created before the install script.
- ynh_permission_update --permission="main" --add="visitors"
-fi
-
-ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
-
-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=1
-
-ynh_systemd_action --service_name=nginx --action=reload
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/remove b/scripts/remove
index 1101469..804edb6 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -9,18 +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
@@ -51,29 +39,13 @@ ynh_remove_systemd_config --service="${app}-worker"
ynh_secure_remove --file="/etc/systemd/system/$app.target"
-#=================================================
-# REMOVE LOGROTATE CONFIGURATION
-#=================================================
-ynh_script_progression --message="Removing logrotate configuration..." --weight=1
-
-# Remove the app-specific logrotate config
-ynh_remove_logrotate
-
-#=================================================
-# REMOVE THE POSTGRESQL DATABASE
-#=================================================
-ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
-
-# Remove a database if it exists, along with the associated user
-ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
-
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
-ynh_secure_remove --file="$final_path"
+ynh_secure_remove --file="$install_dir"
#=================================================
# REMOVE NGINX CONFIGURATION
@@ -83,24 +55,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config
ynh_remove_nginx_config
-#=================================================
-# REMOVE DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Removing dependencies..." --weight=1
-
-# Remove metapackage and its dependencies
-ynh_remove_app_dependencies
-
-#=================================================
-# 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 9ef1b92..2e544a4 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -10,38 +10,7 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
- #### Remove this function if there's nothing to clean before calling the remove script.
- true
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# 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)
-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=1
-
-test ! -d $final_path \
- || ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
@@ -53,42 +22,22 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
-# RECREATE THE DEDICATED USER
+# RESTORE THE POSTGRESQL DATABASE
#=================================================
-ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
+ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
-# Create the dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir="$final_path"
+ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
-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"
-
-#=================================================
-# SPECIFIC RESTORATION
-#=================================================
-# REINSTALL DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Reinstalling dependencies..." --weight=1
-
-# Define and install dependencies
-ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
-
-#=================================================
-# RESTORE THE POSTGRESQL DATABASE
-#=================================================
-ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
-
-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
+chmod 750 "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE SYSTEMD
diff --git a/scripts/upgrade b/scripts/upgrade
index 20361dd..b5203b6 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -12,16 +12,6 @@ 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)
-path_url=$(ynh_app_setting_get --app=$app --key=path)
-language=$(ynh_app_setting_get --app=$app --key=language)
-admin=$(ynh_app_setting_get --app=$app --key=admin)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-port=$(ynh_app_setting_get --app=$app --key=port)
admin_mail=$(ynh_user_get_info --username=$admin --key=username)
@@ -31,20 +21,6 @@ admin_mail=$(ynh_user_get_info --username=$admin --key=username)
upgrade_type=$(ynh_check_app_version_changed)
-#=================================================
-# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
-#=================================================
-ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
-
-# 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
#=================================================
@@ -56,21 +32,6 @@ ynh_systemd_action --action="stop" --service_name="${app}-beat" --log_path="syst
ynh_systemd_action --action="stop" --service_name="${app}-server" --log_path="systemd" --line_match="Stopped"
ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="systemd" --line_match="Stopped"
-#=================================================
-# UPGRADE DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Upgrading dependencies..." --weight=1
-
-ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
-
-#=================================================
-# 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"
-
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@@ -80,12 +41,12 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
- ynh_setup_source --dest_dir="$final_path" --keep=".env"
+ ynh_setup_source --dest_dir="$install_dir" --keep=".env"
fi
-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"
#=================================================
@@ -93,25 +54,25 @@ chown -R $app:www-data "$final_path"
#=================================================
ynh_script_progression --message="Installing service script..." --weight=1
-ynh_secure_remove --file="$final_path/venv"
-mkdir "$final_path/venv"
-python3 -m venv "$final_path/venv"
-$final_path/venv/bin/pip3 install -r "$final_path/requirements.txt"
+ynh_secure_remove --file="$install_dir/venv"
+mkdir "$install_dir/venv"
+python3 -m venv "$install_dir/venv"
+$install_dir/venv/bin/pip3 install -r "$install_dir/requirements.txt"
#=================================================
# Update DATABASE
#=================================================
ynh_script_progression --message="Upgrading database..." --weight=1
-$final_path/venv/bin/python3 "$final_path/manage.py" migrate
-$final_path/venv/bin/python3 "$final_path/manage.py" collectstatic --no-input
-$final_path/venv/bin/python3 "$final_path/manage.py" populate_streams
+$install_dir/venv/bin/python3 "$install_dir/manage.py" migrate
+$install_dir/venv/bin/python3 "$install_dir/manage.py" collectstatic --no-input
+$install_dir/venv/bin/python3 "$install_dir/manage.py" populate_streams
#=================================================
# SET PERMISSIONS ON BOOKWYRM DIRECTORY
#=================================================
-chown -R $app:www-data $final_path
+chown -R $app:www-data $install_dir
#=================================================
# NGINX CONFIGURATION
@@ -153,13 +114,6 @@ ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="sys
ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid"
ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="ready"
-#=================================================
-# 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..0988045
--- /dev/null
+++ b/tests.toml
@@ -0,0 +1,20 @@
+test_format = 1.0
+
+[default]
+
+ # ------------
+ # Tests to run
+ # ------------
+
+ exclude = ["change_url"]
+
+ # -------------------------------
+ # Default args to use for install
+ # -------------------------------
+
+
+ # -------------------------------
+ # Commits to test upgrade from
+ # -------------------------------
+
+ test_upgrade_from.2292d0d.name = "Upgrade from 0.5.3"
\ No newline at end of file