From 776f3c731924bcdf921d4692f3297eb0e74be0dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 17 Jan 2023 22:18:59 +0100 Subject: [PATCH 01/46] Set the image dir --- conf/.env.production | 2 +- conf/nginx.conf | 2 +- scripts/install | 29 +++++++++++++++-------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/conf/.env.production b/conf/.env.production index 89703b3..b02f964 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=images/ +MEDIA_ROOT=__DATADIR__/images/ # Database configuration PGPORT=5432 diff --git a/conf/nginx.conf b/conf/nginx.conf index 8ad14a9..570608a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -8,7 +8,7 @@ location __PATH__/ { } location /images/ { - alias __FINALPATH__/images/; + alias __DATADIR__/images/; } location /static/ { diff --git a/scripts/install b/scripts/install index 03b297e..745c2ff 100755 --- a/scripts/install +++ b/scripts/install @@ -106,6 +106,21 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# CREATE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Creating a data directory..." --weight=1 + +datadir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=datadir --value=$datadir + +mkdir -p $datadir +mkdir -p $datadir/images + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" + #================================================= # CONFIGURE THEN INSTALL SCRIPT AND DEPENDENCIES #================================================= @@ -144,20 +159,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Creating a data directory..." --weight=1 - -datadir=/home/yunohost.app/$app -ynh_app_setting_set --app=$app --key=datadir --value=$datadir - -mkdir -p $datadir - -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" - #================================================= # SETUP SYSTEMD #================================================= From 4d73254f8ee12a339b9576446527f9a6d6668c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 19 Jan 2023 10:38:11 +0100 Subject: [PATCH 02/46] Fix formating --- doc/DISCLAIMER.md | 2 +- doc/DISCLAIMER_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index d0d6c25..d29e6a3 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,6 +1,6 @@ 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', +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: ``` diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md index 0986abb..14042b6 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/DISCLAIMER_fr.md @@ -1,6 +1,6 @@ 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', +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 : ``` From ecf1e51e3783bd796dc77c7f0a22690146a22abd Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 19 Jan 2023 09:38:16 +0000 Subject: [PATCH 03/46] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1e38e8f..2100e62 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ BookWyrm is a social network for tracking your reading, talking about books, wri 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', +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: ``` diff --git a/README_fr.md b/README_fr.md index 25b0cfe..475f7a0 100644 --- a/README_fr.md +++ b/README_fr.md @@ -30,7 +30,7 @@ BookWyrm est un réseau social pour garder la trace de vos lectures, parler de l 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', +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 : ``` From 4f3d9cbb8eb8ea971cbe7e608db28ea21049e549 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 19 Jan 2023 09:39:22 +0000 Subject: [PATCH 04/46] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1e38e8f..2100e62 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ BookWyrm is a social network for tracking your reading, talking about books, wri 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', +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: ``` diff --git a/README_fr.md b/README_fr.md index 25b0cfe..475f7a0 100644 --- a/README_fr.md +++ b/README_fr.md @@ -30,7 +30,7 @@ BookWyrm est un réseau social pour garder la trace de vos lectures, parler de l 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', +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 : ``` From cf356151f842185bf0bf3029a4604665c93aa606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 22 Jan 2023 18:23:37 +0100 Subject: [PATCH 05/46] Update upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index f9d2ad2..eb5a03b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #db_user=$(ynh_app_setting_get --app=$app --key=db_user) #db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin_mail=$(ynh_user_get_info --username=$admin --key=username) From 51cdf21dd56a976d1059241c23e8918adde3c279 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 22 Jan 2023 17:23:41 +0000 Subject: [PATCH 06/46] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2100e62..8c883e1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # BookWyrm for YunoHost -[![Integration level](https://dash.yunohost.org/integration/bookwyrm.svg)](https://dash.yunohost.org/appci/app/bookwyrm) ![Working status](https://ci-apps.yunohost.org/ci/badges/bookwyrm.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/bookwyrm.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/bookwyrm.svg)](https://dash.yunohost.org/appci/app/bookwyrm) ![Working status](https://ci-apps.yunohost.org/ci/badges/bookwyrm.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/bookwyrm.maintain.svg) [![Install BookWyrm with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=bookwyrm) *[Lire ce readme en français.](./README_fr.md)* diff --git a/README_fr.md b/README_fr.md index 475f7a0..9634ff7 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # BookWyrm pour YunoHost -[![Niveau d’intégration](https://dash.yunohost.org/integration/bookwyrm.svg)](https://dash.yunohost.org/appci/app/bookwyrm) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/bookwyrm.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/bookwyrm.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/bookwyrm.svg)](https://dash.yunohost.org/appci/app/bookwyrm) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/bookwyrm.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/bookwyrm.maintain.svg) [![Installer BookWyrm avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=bookwyrm) *[Read this readme in english.](./README.md)* From abce1a8a334a6938d9acaca1b3854a16b023191e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 27 Jan 2023 06:10:23 +0000 Subject: [PATCH 07/46] Upgrade to v0.5.4 --- conf/app.src | 4 ++-- manifest.json | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/conf/app.src b/conf/app.src index 649cbe2..4bc4e4d 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.3.tar.gz -SOURCE_SUM=41E263369BB3E0ED23AF6D6E112BD35EDE082BD5BECFE1BE9BBA152E47EE4E86 +SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.4.tar.gz +SOURCE_SUM=2dafdcf26de6c041611d16ed48b751cf8d4dfbee1f5cf4aa5975592bc080261d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 8a43020..2e1a619 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Platform for social reading", "fr": "Plateforme de lecture sociale" }, - "version": "0.5.3~ynh1", + "version": "0.5.4~ynh1", "url": "https://github.com/bookwyrm-social/bookwyrm", "upstream": { "license": "AGPL-3.0-or-later", @@ -22,8 +22,8 @@ "requirements": { "yunohost": ">= 11.0.9" }, - "multi_instance": true, - "services": [ + "multi_instance": true, + "services": [ "nginx", "postgresql" ], @@ -33,7 +33,6 @@ "name": "domain", "type": "domain" }, - { "name": "is_public", "type": "boolean", @@ -46,7 +45,15 @@ "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"], + "choices": [ + "de-de", + "en-us", + "es-es", + "fr-fr", + "it-it", + "pt-pt", + "zh-hans" + ], "default": "fr-fr" }, { From 2c95c193afe365c46a6f13ca50d8722468159af3 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 27 Jan 2023 06:10:29 +0000 Subject: [PATCH 08/46] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8c883e1..c71ae4f 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in BookWyrm is a social network for tracking your reading, talking about books, writing reviews, and discovering what to read next. -**Shipped version:** 0.5.3~ynh1 +**Shipped version:** 0.5.4~ynh1 **Demo:** https://joinbookwyrm.com/fr/ diff --git a/README_fr.md b/README_fr.md index 9634ff7..0e6d9c6 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po BookWyrm est un réseau social pour garder la trace de vos lectures, parler de livres, écrire des critiques et découvrir quoi lire ensuite. -**Version incluse :** 0.5.3~ynh1 +**Version incluse :** 0.5.4~ynh1 **Démo :** https://joinbookwyrm.com/fr/ From 5cef9c313c6f20d444d71e2cc05856f28f87b220 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Sat, 28 Jan 2023 23:42:59 +0100 Subject: [PATCH 09/46] Upgrade --- scripts/upgrade | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index f9d2ad2..88ea9ff 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -77,6 +77,9 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" --keep=".env" + ynh_exec_warn_less ynh_exec_as $app ./bw-dev update + ynh_exec_warn_less ynh_exec_as $app ./bw-dev populate_streams + fi chmod 750 "$final_path" @@ -99,6 +102,7 @@ mkdir "$final_path/venv" python3 -m venv "$final_path/venv" $final_path/venv/bin/pip3 install -r "$final_path/requirements.txt" + #================================================= # SET PERMISSIONS ON BOOKWYRM DIRECTORY #================================================= From 1c4abec6ad47da7436b97b725de341e7d13d8e0b Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 30 Jan 2023 15:51:29 +0100 Subject: [PATCH 10/46] Testing Git + update --- conf/app.src | 7 ------- scripts/_common.sh | 2 ++ scripts/install | 6 +++++- scripts/upgrade | 5 +++-- 4 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 conf/app.src diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 649cbe2..0000000 --- a/conf/app.src +++ /dev/null @@ -1,7 +0,0 @@ -SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.3.tar.gz -SOURCE_SUM=41E263369BB3E0ED23AF6D6E112BD35EDE082BD5BECFE1BE9BBA152E47EE4E86 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= -SOURCE_EXTRACT=true diff --git a/scripts/_common.sh b/scripts/_common.sh index 2bccbe6..4dcb681 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,8 @@ # COMMON VARIABLES #================================================= +COMMIT="cad83a339ea53cd50aed9aa45a85e9f5b6443b64" + # dependencies used by the app pkg_dependencies="postgresql postgresql-contrib python3-venv libpq-dev" diff --git a/scripts/install b/scripts/install index defe995..7b3a2a2 100755 --- a/scripts/install +++ b/scripts/install @@ -98,8 +98,12 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name ynh_script_progression --message="Setting up source files..." --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# Note: We use git instead of ynh_setup_source, cause this repo use submodules +git clone https://github.com/bookwyrm-social/bookwyrm.git "$final_path" --quiet -ynh_setup_source --dest_dir="$final_path" +pushd "$final_path" + git checkout $COMMIT +popd chmod 750 "$final_path" chmod -R o-rwx "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index 88ea9ff..b6f1812 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -77,8 +77,9 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" --keep=".env" - ynh_exec_warn_less ynh_exec_as $app ./bw-dev update - ynh_exec_warn_less ynh_exec_as $app ./bw-dev populate_streams + pushd "$final_path" + ./bw-dev update + popd fi From 186e7fd6f80e5f178bcba6674d25568363448e07 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 30 Jan 2023 19:02:09 +0100 Subject: [PATCH 11/46] Add app.src --- conf/app.src | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 conf/app.src diff --git a/conf/app.src b/conf/app.src new file mode 100644 index 0000000..649cbe2 --- /dev/null +++ b/conf/app.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.3.tar.gz +SOURCE_SUM=41E263369BB3E0ED23AF6D6E112BD35EDE082BD5BECFE1BE9BBA152E47EE4E86 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true From 21b4fc790c67af5a76acc9a3a2bdf5e6d1d596d9 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 30 Jan 2023 20:11:01 +0100 Subject: [PATCH 12/46] Fix app.src --- conf/app.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/app.src b/conf/app.src index 649cbe2..63b0145 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.3.tar.gz -SOURCE_SUM=41E263369BB3E0ED23AF6D6E112BD35EDE082BD5BECFE1BE9BBA152E47EE4E86 +SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.4.tar.gz +SOURCE_SUM=593D257E5DB8518A6204B8E3A0D212A2844F0091C7FF403D89D7CBC01C8066B0 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true From 3c5b00e8699b375c4e622b954081fe0bc7143fc4 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 30 Jan 2023 21:06:12 +0100 Subject: [PATCH 13/46] Fix upgrade --- scripts/upgrade | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index b6f1812..df37377 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -78,6 +78,9 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" --keep=".env" pushd "$final_path" + git checkout production + git pull --quiet + git checkout $COMMIT ./bw-dev update popd From 95ea146b23714aaf85e59f93f6998487971183e1 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 30 Jan 2023 21:53:55 +0100 Subject: [PATCH 14/46] Fix update 0.5.4 --- check_process | 3 ++- scripts/_common.sh | 2 -- scripts/install | 6 +----- scripts/upgrade | 7 ------- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/check_process b/check_process index 1a5eefe..23fedde 100644 --- a/check_process +++ b/check_process @@ -12,7 +12,8 @@ setup_private=1 setup_public=1 upgrade=1 - #upgrade=1 from_commit=CommitHash + # 0.5.3ynh1 + upgrade=1 from_commit=ac72525a476648c6ccc9d9b52d68fdbd638b1d31 backup_restore=1 multi_instance=0 change_url=0 diff --git a/scripts/_common.sh b/scripts/_common.sh index 4dcb681..2bccbe6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,6 @@ # COMMON VARIABLES #================================================= -COMMIT="cad83a339ea53cd50aed9aa45a85e9f5b6443b64" - # dependencies used by the app pkg_dependencies="postgresql postgresql-contrib python3-venv libpq-dev" diff --git a/scripts/install b/scripts/install index 7b3a2a2..defe995 100755 --- a/scripts/install +++ b/scripts/install @@ -98,12 +98,8 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name ynh_script_progression --message="Setting up source files..." --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path -# Note: We use git instead of ynh_setup_source, cause this repo use submodules -git clone https://github.com/bookwyrm-social/bookwyrm.git "$final_path" --quiet -pushd "$final_path" - git checkout $COMMIT -popd +ynh_setup_source --dest_dir="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index df37377..5440159 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -77,13 +77,6 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" --keep=".env" - pushd "$final_path" - git checkout production - git pull --quiet - git checkout $COMMIT - ./bw-dev update - popd - fi chmod 750 "$final_path" From 3eda545999b6d3bc0fd0754d0971579aaaa2e01f Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 30 Jan 2023 22:34:34 +0100 Subject: [PATCH 15/46] Fix upgrade --- check_process | 7 +++++-- conf/app.src | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/check_process b/check_process index 23fedde..91aaf23 100644 --- a/check_process +++ b/check_process @@ -12,11 +12,14 @@ setup_private=1 setup_public=1 upgrade=1 - # 0.5.3ynh1 - upgrade=1 from_commit=ac72525a476648c6ccc9d9b52d68fdbd638b1d31 + # 0.5.4ynh1 + 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.4~ynh1 \ No newline at end of file diff --git a/conf/app.src b/conf/app.src index 63b0145..649cbe2 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.4.tar.gz -SOURCE_SUM=593D257E5DB8518A6204B8E3A0D212A2844F0091C7FF403D89D7CBC01C8066B0 +SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.3.tar.gz +SOURCE_SUM=41E263369BB3E0ED23AF6D6E112BD35EDE082BD5BECFE1BE9BBA152E47EE4E86 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true From db4f164422570a440969d283c345ef43294a7b32 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 30 Jan 2023 22:41:47 +0100 Subject: [PATCH 16/46] Fix install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index defe995..54de061 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name 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" chmod 750 "$final_path" From 2685d8266279a6047c2a876e51c4b1e564d2d8ed Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 30 Jan 2023 23:10:10 +0100 Subject: [PATCH 17/46] Fix check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 91aaf23..af0772e 100644 --- a/check_process +++ b/check_process @@ -13,7 +13,7 @@ setup_public=1 upgrade=1 # 0.5.4ynh1 - upgrade=1 from_commit=2292d0d68f5ba9e48f4cbb6105db64b4da4eba74 + # upgrade=1 from_commit=2292d0d68f5ba9e48f4cbb6105db64b4da4eba74 backup_restore=1 multi_instance=0 change_url=0 From 221488fce143ccb068a65498a854cf2bb4405ea1 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 30 Jan 2023 23:14:15 +0100 Subject: [PATCH 18/46] Fix app.src + check_process --- check_process | 6 +++--- conf/app.src | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/check_process b/check_process index af0772e..0d5791b 100644 --- a/check_process +++ b/check_process @@ -12,8 +12,8 @@ setup_private=1 setup_public=1 upgrade=1 - # 0.5.4ynh1 - # upgrade=1 from_commit=2292d0d68f5ba9e48f4cbb6105db64b4da4eba74 + # 0.5.3ynh1 + upgrade=1 from_commit=2292d0d68f5ba9e48f4cbb6105db64b4da4eba74 backup_restore=1 multi_instance=0 change_url=0 @@ -22,4 +22,4 @@ Email=oufmilo@protonmail.com Notification=all ;;; Upgrade options ; commit=2292d0d68f5ba9e48f4cbb6105db64b4da4eba74 - name=0.5.4~ynh1 \ No newline at end of file + name=0.5.3~ynh1 \ No newline at end of file diff --git a/conf/app.src b/conf/app.src index 649cbe2..63b0145 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.3.tar.gz -SOURCE_SUM=41E263369BB3E0ED23AF6D6E112BD35EDE082BD5BECFE1BE9BBA152E47EE4E86 +SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.4.tar.gz +SOURCE_SUM=593D257E5DB8518A6204B8E3A0D212A2844F0091C7FF403D89D7CBC01C8066B0 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true From 25194343416bde627438ffbb9d24e0bbc3fdf227 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Fri, 3 Feb 2023 21:23:00 +0100 Subject: [PATCH 19/46] Fix app.src --- conf/app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/app.src b/conf/app.src index 63b0145..1e6ed74 100644 --- a/conf/app.src +++ b/conf/app.src @@ -4,4 +4,4 @@ SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true SOURCE_FILENAME= -SOURCE_EXTRACT=true +SOURCE_EXTRACT=true \ No newline at end of file From ea612479432fffbc6d4e0f044293b45fc4504807 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Fri, 3 Feb 2023 21:41:33 +0100 Subject: [PATCH 20/46] Fix app.src --- conf/app.src | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/app.src b/conf/app.src index 1e6ed74..3a57150 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,5 +3,4 @@ SOURCE_SUM=593D257E5DB8518A6204B8E3A0D212A2844F0091C7FF403D89D7CBC01C8066B0 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= SOURCE_EXTRACT=true \ No newline at end of file From 307858d9f3df59f6524e70ea101c65217667e11d Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Fri, 3 Feb 2023 22:41:43 +0100 Subject: [PATCH 21/46] Fix --- conf/app.src | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/app.src b/conf/app.src index 3a57150..26b6346 100644 --- a/conf/app.src +++ b/conf/app.src @@ -2,5 +2,4 @@ SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.4. SOURCE_SUM=593D257E5DB8518A6204B8E3A0D212A2844F0091C7FF403D89D7CBC01C8066B0 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_EXTRACT=true \ No newline at end of file +SOURCE_IN_SUBDIR=true \ No newline at end of file From c8bd6444dcca828eb9569cd6ad097cb40e3734b9 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Fri, 3 Feb 2023 23:08:15 +0100 Subject: [PATCH 22/46] Fix source_sum --- conf/app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/app.src b/conf/app.src index 26b6346..153b1ed 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.4.tar.gz -SOURCE_SUM=593D257E5DB8518A6204B8E3A0D212A2844F0091C7FF403D89D7CBC01C8066B0 +SOURCE_SUM=2DAFDCF26DE6C041611D16ED48B751CF8D4DFBEE1F5CF4AA5975592BC080261D SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true \ No newline at end of file From 59541d19f94722b1c46a77e40b2a50c4304f920d Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 4 Feb 2023 06:09:15 +0000 Subject: [PATCH 23/46] Upgrade to v0.5.4 --- conf/app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/app.src b/conf/app.src index 153b1ed..0b8cbc3 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ SOURCE_URL=https://github.com/bookwyrm-social/bookwyrm/archive/refs/tags/v0.5.4.tar.gz -SOURCE_SUM=2DAFDCF26DE6C041611D16ED48B751CF8D4DFBEE1F5CF4AA5975592BC080261D +SOURCE_SUM=2dafdcf26de6c041611d16ed48b751cf8d4dfbee1f5cf4aa5975592bc080261d SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true \ No newline at end of file From f2209f567ab1f1cdfc08110f597aa082ebc638a0 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Sun, 5 Feb 2023 20:49:55 +0100 Subject: [PATCH 24/46] Fix upgrade --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index ba5e74a..1a87a58 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -89,9 +89,9 @@ chown -R $app:www-data "$final_path" #================================================= 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="$final_path/.env" +chmod 600 $final_path/.env +chown $app:www-data "$final_path/.env" set -a; source "$final_path/.env"; set +a From 4a26690a51df297d7c57b50647b3ba1fed1bd743 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Sun, 5 Feb 2023 21:34:39 +0100 Subject: [PATCH 25/46] Fix --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 1a87a58..34555aa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,9 +21,9 @@ 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) -#db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$(ynh_app_setting_get --app=$app --key=db_user) -#db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$(ynh_app_setting_get --app=$app --key=db_user) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) From 74833ced7713d1d38ec1b77985ae4e194bb7150b Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Sun, 5 Feb 2023 22:35:37 +0100 Subject: [PATCH 26/46] Update upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 34555aa..1736718 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,6 +28,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin_mail=$(ynh_user_get_info --username=$admin --key=username) +key=$(ynh_string_random --length=32) #================================================= # CHECK VERSION From bd29a3b8eb256a7e034cf5921d1ef389a2335e32 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 00:05:36 +0100 Subject: [PATCH 27/46] Fix --- scripts/upgrade | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 34555aa..0600feb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,9 +21,9 @@ 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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$(ynh_app_setting_get --app=$app --key=db_user) -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#db_user=$(ynh_app_setting_get --app=$app --key=db_user) +#db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) @@ -89,9 +89,9 @@ chown -R $app:www-data "$final_path" #================================================= 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="$final_path/.env" +#chmod 600 $final_path/.env +#chown $app:www-data "$final_path/.env" set -a; source "$final_path/.env"; set +a @@ -100,6 +100,15 @@ mkdir "$final_path/venv" python3 -m venv "$final_path/venv" $final_path/venv/bin/pip3 install -r "$final_path/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" compile_themes +$final_path/venv/bin/python3 "$final_path/manage.py" collectstatic --no-input +$final_path/venv/bin/python3 "$final_path/manage.py" populate_streams #================================================= # SET PERMISSIONS ON BOOKWYRM DIRECTORY From 3bcdcd29ca2a4d028efc4f46160c372c6dd5dec4 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 00:07:47 +0100 Subject: [PATCH 28/46] Fix --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index fa2bee2..7337733 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,7 +28,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin_mail=$(ynh_user_get_info --username=$admin --key=username) -key=$(ynh_string_random --length=32) +#key=$(ynh_string_random --length=32) #================================================= # CHECK VERSION From fdc6ba9804ef828772bf9ea8f4d2cb1aec08c4ca Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 00:24:49 +0100 Subject: [PATCH 29/46] Fix --- scripts/upgrade | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 7337733..3319c1f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,14 +21,14 @@ 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) -#db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$(ynh_app_setting_get --app=$app --key=db_user) -#db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$(ynh_app_setting_get --app=$app --key=db_user) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin_mail=$(ynh_user_get_info --username=$admin --key=username) -#key=$(ynh_string_random --length=32) +key=$(ynh_string_random --length=32) #================================================= # CHECK VERSION @@ -90,9 +90,9 @@ chown -R $app:www-data "$final_path" #================================================= 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="$final_path/.env" +chmod 600 $final_path/.env +chown $app:www-data "$final_path/.env" set -a; source "$final_path/.env"; set +a From e948290ce65b88e66fe7b9ccdc7406b2d7da5b74 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 00:35:22 +0100 Subject: [PATCH 30/46] Fix --- scripts/upgrade | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 3319c1f..0aa1a8c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,14 +21,14 @@ 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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$(ynh_app_setting_get --app=$app --key=db_user) -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#db_user=$(ynh_app_setting_get --app=$app --key=db_user) +#db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin_mail=$(ynh_user_get_info --username=$admin --key=username) -key=$(ynh_string_random --length=32) +#key=$(ynh_string_random --length=32) #================================================= # CHECK VERSION @@ -90,9 +90,9 @@ chown -R $app:www-data "$final_path" #================================================= 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="$final_path/.env" +#chmod 600 $final_path/.env +#chown $app:www-data "$final_path/.env" set -a; source "$final_path/.env"; set +a @@ -109,7 +109,6 @@ 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" compile_themes $final_path/venv/bin/python3 "$final_path/manage.py" collectstatic --no-input -$final_path/venv/bin/python3 "$final_path/manage.py" populate_streams #================================================= # SET PERMISSIONS ON BOOKWYRM DIRECTORY From 6c7c8bbd49bc04a2bfc3fef312057663ca01a6bd Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 00:57:21 +0100 Subject: [PATCH 31/46] Fix --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0aa1a8c..eca436e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -107,8 +107,8 @@ $final_path/venv/bin/pip3 install -r "$final_path/requirements.txt" 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" compile_themes $final_path/venv/bin/python3 "$final_path/manage.py" collectstatic --no-input +$final_path/venv/bin/python3 "$final_path/manage.py" populate_streams #================================================= # SET PERMISSIONS ON BOOKWYRM DIRECTORY From f2ab7aac45a41c68c82b412d4b23c92fc204b132 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 01:08:43 +0100 Subject: [PATCH 32/46] Fix --- scripts/upgrade | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index eca436e..baa6bd4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,14 +21,14 @@ 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) -#db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$(ynh_app_setting_get --app=$app --key=db_user) -#db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$(ynh_app_setting_get --app=$app --key=db_user) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin_mail=$(ynh_user_get_info --username=$admin --key=username) -#key=$(ynh_string_random --length=32) +key=$(ynh_string_random --length=32) #================================================= # CHECK VERSION @@ -90,9 +90,9 @@ chown -R $app:www-data "$final_path" #================================================= 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="$final_path/.env" +chmod 600 $final_path/.env +chown $app:www-data "$final_path/.env" set -a; source "$final_path/.env"; set +a From 4add5b20537324135d1c724cccd39cf057616ead Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 01:21:33 +0100 Subject: [PATCH 33/46] Fix --- scripts/upgrade | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index baa6bd4..b49e7a0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -50,6 +50,30 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# If db_name doesn't exist, create it +if [ -z "$db_name" ]; then + db_name=$(ynh_sanitize_dbid --db_name=$app) + ynh_app_setting_set --app=$app --key=db_name --value=$db_name +fi + +# If final_path doesn't exist, create it +if [ -z "$final_path" ]; then + final_path=/var/www/$app + ynh_app_setting_set --app=$app --key=final_path --value=$final_path +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 + #================================================= # STANDARD UPGRADE STEPS #================================================= From 2ccf0e3108800a8ed9b2f66982c6907a43df0c01 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 01:26:04 +0100 Subject: [PATCH 34/46] Fix --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index b49e7a0..4574d25 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,7 +28,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin_mail=$(ynh_user_get_info --username=$admin --key=username) -key=$(ynh_string_random --length=32) +key=$(ynh_app_setting_get --app=$app --key=key) #================================================= # CHECK VERSION From b048b94efdc8eb03b84727ef61bbbfdc5924f003 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 01:36:24 +0100 Subject: [PATCH 35/46] Fix --- scripts/upgrade | 53 ++++++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 4574d25..0ac7996 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,14 +21,14 @@ 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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$(ynh_app_setting_get --app=$app --key=db_user) -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#db_user=$(ynh_app_setting_get --app=$app --key=db_user) +#db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin_mail=$(ynh_user_get_info --username=$admin --key=username) -key=$(ynh_app_setting_get --app=$app --key=key) +#key=$(ynh_string_random --length=32) #================================================= # CHECK VERSION @@ -50,30 +50,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path -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 - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -109,14 +85,29 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# CREATE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Creating a data directory..." --weight=1 + +datadir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=datadir --value=$datadir + +mkdir -p $datadir +mkdir -p $datadir/images + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" + #================================================= # 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="$final_path/.env" +#chmod 600 $final_path/.env +#chown $app:www-data "$final_path/.env" set -a; source "$final_path/.env"; set +a From 3c03204791e250de98f0bf7029cae2bd8c665a3e Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 01:58:53 +0100 Subject: [PATCH 36/46] Fix --- scripts/upgrade | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0ac7996..d58aa56 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,14 +21,14 @@ 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) -#db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$(ynh_app_setting_get --app=$app --key=db_user) -#db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$(ynh_app_setting_get --app=$app --key=db_user) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin_mail=$(ynh_user_get_info --username=$admin --key=username) -#key=$(ynh_string_random --length=32) +key=$(ynh_string_random --length=32) #================================================= # CHECK VERSION @@ -85,41 +85,21 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# CREATE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Creating a data directory..." --weight=1 - -datadir=/home/yunohost.app/$app -ynh_app_setting_set --app=$app --key=datadir --value=$datadir - -mkdir -p $datadir -mkdir -p $datadir/images - -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" #================================================= # 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" - -set -a; source "$final_path/.env"; set +a - 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" #================================================= -# INITIALIZE DATABASE +# Update DATABASE #================================================= -ynh_script_progression --message="Initializing database..." --weight=1 +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 @@ -146,6 +126,18 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=1 ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a config file..." --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" + +set -a; source "$final_path/.env"; set +a + #================================================= # SETUP SYSTEMD #================================================= From 52745ff463bc6355fc6e48af7deaa5c78eade132 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:27:40 +0100 Subject: [PATCH 37/46] Fix --- scripts/upgrade | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index d58aa56..9fb54e3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -61,6 +61,13 @@ 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 #================================================= @@ -85,7 +92,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" - #================================================= # CONFIGURE THEN INSTALL SCRIPT AND DEPENDENCIES #================================================= @@ -119,14 +125,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=1 - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - - #================================================= # UPDATE A CONFIG FILE #================================================= From 202b5e63c51aa1621235c2a914dd193e69e92e06 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:30:45 +0100 Subject: [PATCH 38/46] Test --- scripts/_common.sh | 2 +- scripts/upgrade | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 2bccbe6..1f9ef1e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="postgresql postgresql-contrib python3-venv libpq-dev" +pkg_dependencies="postgresql postgresql-contrib python3-venv libpq-dev docker-compose" #================================================= # PERSONAL HELPERS diff --git a/scripts/upgrade b/scripts/upgrade index 9fb54e3..ab13e68 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -107,9 +107,12 @@ $final_path/venv/bin/pip3 install -r "$final_path/requirements.txt" #================================================= 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 +pushd "$final_path" + docker-compose build + $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 +popd #================================================= # SET PERMISSIONS ON BOOKWYRM DIRECTORY From b5c68c2edf4ab5946bd879ad2ff877176f08d4b9 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:32:54 +0100 Subject: [PATCH 39/46] test --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index ab13e68..59a328b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -112,6 +112,8 @@ pushd "$final_path" $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 + docker-compose down + docker-compose up -d popd #================================================= From c88c65f9b9f7190c8c0ca944f6515dd40f8037af Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:36:20 +0100 Subject: [PATCH 40/46] test --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 1f9ef1e..5af64d4 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="postgresql postgresql-contrib python3-venv libpq-dev docker-compose" +pkg_dependencies="postgresql postgresql-contrib python3 python3-venv libpq-dev docker docker-compose" #================================================= # PERSONAL HELPERS From 2cc16ee4a159b8a4064ca7eab5e94d22462fb1c5 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:38:56 +0100 Subject: [PATCH 41/46] test --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 5af64d4..7fda5fa 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="postgresql postgresql-contrib python3 python3-venv libpq-dev docker docker-compose" +pkg_dependencies="postgresql postgresql-contrib python3 python3-venv libpq-dev docker-compose" #================================================= # PERSONAL HELPERS From 3e7bfebec9719ebb943c472105d5f8676abac458 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:45:54 +0100 Subject: [PATCH 42/46] test --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 7fda5fa..4946a6e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="postgresql postgresql-contrib python3 python3-venv libpq-dev docker-compose" +pkg_dependencies="postgresql postgresql-contrib python3 python3-venv libpq-dev docker-compose-plugin" #================================================= # PERSONAL HELPERS From dd0e01218291ac82eb1f6224101e4b1365abd091 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:54:01 +0100 Subject: [PATCH 43/46] test --- scripts/upgrade | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 59a328b..05c1100 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -109,11 +109,12 @@ ynh_script_progression --message="Upgrading database..." --weight=1 pushd "$final_path" docker-compose build - $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 + docker-compose run --rm web python manage.py migrate + docker-compose run --rm web python manage.py compile_themes + docker-compose run --rm web python manage.py collectstatic --no-input docker-compose down docker-compose up -d + docker-compose run --rm web python manage.py populate_streams popd #================================================= From 0136287073b4a392d6a94e748721985e20da4ef3 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 11:17:52 +0100 Subject: [PATCH 44/46] Fix --- scripts/_common.sh | 2 +- scripts/upgrade | 32 ++++++++------------------------ 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 4946a6e..2bccbe6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="postgresql postgresql-contrib python3 python3-venv libpq-dev docker-compose-plugin" +pkg_dependencies="postgresql postgresql-contrib python3-venv libpq-dev" #================================================= # PERSONAL HELPERS diff --git a/scripts/upgrade b/scripts/upgrade index 05c1100..e532939 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,14 +21,14 @@ 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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$(ynh_app_setting_get --app=$app --key=db_user) -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +#db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#db_user=$(ynh_app_setting_get --app=$app --key=db_user) +#db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin_mail=$(ynh_user_get_info --username=$admin --key=username) -key=$(ynh_string_random --length=32) +#key=$(ynh_string_random --length=32) #================================================= # CHECK VERSION @@ -92,6 +92,7 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" + #================================================= # CONFIGURE THEN INSTALL SCRIPT AND DEPENDENCIES #================================================= @@ -107,15 +108,9 @@ $final_path/venv/bin/pip3 install -r "$final_path/requirements.txt" #================================================= ynh_script_progression --message="Upgrading database..." --weight=1 -pushd "$final_path" - docker-compose build - docker-compose run --rm web python manage.py migrate - docker-compose run --rm web python manage.py compile_themes - docker-compose run --rm web python manage.py collectstatic --no-input - docker-compose down - docker-compose up -d - docker-compose run --rm web python manage.py populate_streams -popd +$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 #================================================= # SET PERMISSIONS ON BOOKWYRM DIRECTORY @@ -131,17 +126,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPDATE A CONFIG FILE -#================================================= -ynh_script_progression --message="Updating a config file..." --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" - -set -a; source "$final_path/.env"; set +a - #================================================= # SETUP SYSTEMD #================================================= From c8d0c607696c9fbb47b891c08282245f17605d96 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 14:33:33 +0100 Subject: [PATCH 45/46] Remove datadir --- conf/.env.production | 2 +- conf/nginx.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/.env.production b/conf/.env.production index 8722cff..222eb53 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=__DATADIR__/images/ +MEDIA_ROOT=__FINALPATH__/images/ # Database configuration PGPORT=5432 diff --git a/conf/nginx.conf b/conf/nginx.conf index 570608a..8ad14a9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -8,7 +8,7 @@ location __PATH__/ { } location /images/ { - alias __DATADIR__/images/; + alias __FINALPATH__/images/; } location /static/ { From 899d447ce5b690dc91155ba9bee55adabd3168e3 Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Mon, 6 Feb 2023 16:29:09 +0100 Subject: [PATCH 46/46] Remove datadir --- scripts/backup | 7 ------- scripts/install | 15 --------------- scripts/remove | 12 ------------ scripts/restore | 14 -------------- scripts/upgrade | 5 ----- 5 files changed, 53 deletions(-) diff --git a/scripts/backup b/scripts/backup index 9a45c9f..d66eaf1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -31,7 +31,6 @@ 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) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -44,12 +43,6 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" -#================================================= -# BACKUP THE DATA DIR -#================================================= - -ynh_backup --src_path="$datadir" --is_big - #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index fea807f..a994bb8 100755 --- a/scripts/install +++ b/scripts/install @@ -105,21 +105,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# CREATE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Creating a data directory..." --weight=1 - -datadir=/home/yunohost.app/$app -ynh_app_setting_set --app=$app --key=datadir --value=$datadir - -mkdir -p $datadir -mkdir -p $datadir/images - -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" - #================================================= # CONFIGURE THEN INSTALL SCRIPT AND DEPENDENCIES #================================================= diff --git a/scripts/remove b/scripts/remove index 7eb1731..1101469 100644 --- a/scripts/remove +++ b/scripts/remove @@ -21,7 +21,6 @@ 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) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # STANDARD REMOVE @@ -76,17 +75,6 @@ ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" -#================================================= -# REMOVE DATA DIR -#================================================= - -# Remove the data directory if --purge option is used -if [ "${YNH_APP_PURGE:-0}" -eq 1 ] -then - ynh_script_progression --message="Removing app data directory..." --weight=1 - ynh_secure_remove --file="$datadir" -fi - #================================================= # REMOVE NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 06f5162..9ef1b92 100644 --- a/scripts/restore +++ b/scripts/restore @@ -34,7 +34,6 @@ 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) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -72,19 +71,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# RESTORE THE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Restoring the data directory..." --weight=1 - -ynh_restore_file --origin_path="$datadir" --not_mandatory - -mkdir -p $datadir - -chmod 750 "$datadir" -chmod -R o-rwx "$datadir" -chown -R $app:www-data "$datadir" - #================================================= # SPECIFIC RESTORATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e532939..20361dd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,14 +21,9 @@ 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) -#db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$(ynh_app_setting_get --app=$app --key=db_user) -#db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin_mail=$(ynh_user_get_info --username=$admin --key=username) -#key=$(ynh_string_random --length=32) #================================================= # CHECK VERSION