From 3f798c071de99de64c75e725b2d57e87c916b5b7 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 23 Oct 2023 15:12:44 +0200 Subject: [PATCH 01/39] Switch from tarball download to git clone for the install --- manifest.toml | 3 +++ scripts/install | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 06060b7..e08b34f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -37,6 +37,7 @@ ram.runtime = "50M" type = "user" [resources] +<<<<<<< HEAD [resources.sources] [resources.sources.main] url = "https://codeberg.org/streams/streams/archive/8fb92b522b8bff562b350070b57954a998875e58.tar.gz" @@ -45,6 +46,8 @@ ram.runtime = "50M" [resources.sources.addons] url = "https://codeberg.org/streams/streams-addons/archive/39b1c5af9f2b1c639b6438ac85b0ea85273fc201.tar.gz" sha256 = "5885665bf3dfbe843387184543be17b6b2061b807a57c1d6962548af80794f75" +======= +>>>>>>> d73fcb5 (Switch from tarball download to git clone for the install) [resources.ports] diff --git a/scripts/install b/scripts/install index 01fc235..a62f6c7 100755 --- a/scripts/install +++ b/scripts/install @@ -45,9 +45,13 @@ ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \ #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" -ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" +mkdir -p "$install_dir" +chown -R $app:www-data "$install_dir" + +git config --system --add safe.directory $install_dir + +# Download, check integrity, uncompress and patch the source from GitHub +git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet touch "$install_dir/php.log" mkdir -p "$install_dir/store" From 8a1cee95239ab15a6923dad17daa335d6766ffbb Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 23 Oct 2023 20:49:01 +0200 Subject: [PATCH 02/39] Cronjobs & daily update script --- conf/{poller-cron => cronjobs} | 2 ++ conf/daily-update.sh | 12 ++++++++++++ scripts/install | 4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) rename conf/{poller-cron => cronjobs} (52%) create mode 100644 conf/daily-update.sh diff --git a/conf/poller-cron b/conf/cronjobs similarity index 52% rename from conf/poller-cron rename to conf/cronjobs index d0bfb9d..43f335d 100644 --- a/conf/poller-cron +++ b/conf/cronjobs @@ -1,2 +1,4 @@ # Run poller periodically to update your website */10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f Code/Daemon/Run.php Cron > /dev/null 2>&1 +# Daily software update job +30 05 * * * __APP__ /bin/bash __DATA_DIR__/daily-update.sh >> __DATA_DIR__/daily-updates.log 2>&1 diff --git a/conf/daily-update.sh b/conf/daily-update.sh new file mode 100644 index 0000000..faf36ba --- /dev/null +++ b/conf/daily-update.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# +echo " " +echo "+++ $(date) +++" +echo " " +echo "$(date) - db size." +du -h /var/lib/mysql/__APP__ +# +cd /var/www/__APP__ +/usr/bin/php__PHPVERSION__ util/udall +echo "$(date) - Daily update finished." + diff --git a/scripts/install b/scripts/install index a62f6c7..b0bec9a 100755 --- a/scripts/install +++ b/scripts/install @@ -110,9 +110,11 @@ chown $app:$app "$install_dir/.htconfig.php" ynh_script_progression --message="Setuping cron job..." --weight=1 # Set up cron job -ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app" +ynh_add_config --template="../conf/cronjobs" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" +# Add daily update script +ynh_add_config --template="../conf/daily-update.sh" --destination="/home/yunohost.app/$app/daily-update.sh" #================================================= # GENERIC FINALIZATION From ea2cd88eb145bd8eac5ddab4156291f3b76ee4d1 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 23 Oct 2023 21:38:09 +0200 Subject: [PATCH 03/39] Cronjobs & daily update script rework --- conf/cronjobs | 2 +- conf/daily-update.sh | 3 +-- scripts/install | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/cronjobs b/conf/cronjobs index 43f335d..79d98e2 100644 --- a/conf/cronjobs +++ b/conf/cronjobs @@ -1,4 +1,4 @@ # Run poller periodically to update your website */10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f Code/Daemon/Run.php Cron > /dev/null 2>&1 # Daily software update job -30 05 * * * __APP__ /bin/bash __DATA_DIR__/daily-update.sh >> __DATA_DIR__/daily-updates.log 2>&1 +30 05 * * * root /bin/bash __DATA_DIR__/daily-update.sh >> __DATA_DIR__/daily-updates.log 2>&1 diff --git a/conf/daily-update.sh b/conf/daily-update.sh index faf36ba..39b9618 100644 --- a/conf/daily-update.sh +++ b/conf/daily-update.sh @@ -6,7 +6,6 @@ echo " " echo "$(date) - db size." du -h /var/lib/mysql/__APP__ # -cd /var/www/__APP__ -/usr/bin/php__PHPVERSION__ util/udall +(cd /var/www/__APP__ ; sudo -u streams util/udall) echo "$(date) - Daily update finished." diff --git a/scripts/install b/scripts/install index b0bec9a..c100953 100755 --- a/scripts/install +++ b/scripts/install @@ -77,7 +77,8 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Pulling in external libraries with Composer..." -ynh_install_composer +#ynh_install_composer +composer install #================================================= # SPECIFIC SETUP From 3b354b4f74bb0128ffe779f112ed195d4aeee2d6 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 23 Oct 2023 22:18:45 +0200 Subject: [PATCH 04/39] Cronjobs & daily update script rework again --- scripts/install | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index c100953..5976d81 100755 --- a/scripts/install +++ b/scripts/install @@ -77,8 +77,11 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Pulling in external libraries with Composer..." -#ynh_install_composer -composer install +ynh_install_composer +pushd $install_dir + ynh_exec_as $app composer install + ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons +popd #================================================= # SPECIFIC SETUP From 5c36a5f1457087c01a5a0025265e168cfce70d00 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 23 Oct 2023 23:15:52 +0200 Subject: [PATCH 05/39] Still tryin' --- scripts/install | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 5976d81..d7eef27 100755 --- a/scripts/install +++ b/scripts/install @@ -48,10 +48,10 @@ ynh_script_progression --message="Setting up source files..." --weight=1 mkdir -p "$install_dir" chown -R $app:www-data "$install_dir" -git config --system --add safe.directory $install_dir +ynh_exec_as $app git config --system --add safe.directory $install_dir # Download, check integrity, uncompress and patch the source from GitHub -git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet +ynh_exec_as $app git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet touch "$install_dir/php.log" mkdir -p "$install_dir/store" @@ -79,7 +79,6 @@ ynh_script_progression --message="Pulling in external libraries with Composer... ynh_install_composer pushd $install_dir - ynh_exec_as $app composer install ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons popd From 4210ead311da9e23e34574c39eb21feb06d2d68d Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 23 Oct 2023 23:51:18 +0200 Subject: [PATCH 06/39] Diff'rent options --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index d7eef27..2696771 100755 --- a/scripts/install +++ b/scripts/install @@ -77,7 +77,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Pulling in external libraries with Composer..." -ynh_install_composer +ynh_install_composer --workdir="$install_dir" pushd $install_dir ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons popd From acb658260d878754fb54e621e57e715805c78c06 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 23 Oct 2023 23:55:09 +0200 Subject: [PATCH 07/39] Now as root! --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 2696771..09bb32d 100755 --- a/scripts/install +++ b/scripts/install @@ -48,10 +48,10 @@ ynh_script_progression --message="Setting up source files..." --weight=1 mkdir -p "$install_dir" chown -R $app:www-data "$install_dir" -ynh_exec_as $app git config --system --add safe.directory $install_dir +git config --system --add safe.directory $install_dir # Download, check integrity, uncompress and patch the source from GitHub -ynh_exec_as $app git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet +git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet touch "$install_dir/php.log" mkdir -p "$install_dir/store" @@ -79,7 +79,7 @@ ynh_script_progression --message="Pulling in external libraries with Composer... ynh_install_composer --workdir="$install_dir" pushd $install_dir - ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons + util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons popd #================================================= From 72898eec9d1e2604f1568b23a2ebd2550b6c3405 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 24 Oct 2023 00:01:16 +0200 Subject: [PATCH 08/39] Addons as user --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 09bb32d..9b18ade 100755 --- a/scripts/install +++ b/scripts/install @@ -79,7 +79,7 @@ ynh_script_progression --message="Pulling in external libraries with Composer... ynh_install_composer --workdir="$install_dir" pushd $install_dir - util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons + ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons popd #================================================= From e79d7bab15dd6e99b815dc7434eb8869f7da96ad Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 24 Oct 2023 12:54:49 +0200 Subject: [PATCH 09/39] Playing with users & permissions again --- conf/cronjobs | 2 +- conf/daily-update.sh | 4 +--- scripts/install | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/conf/cronjobs b/conf/cronjobs index 79d98e2..43f335d 100644 --- a/conf/cronjobs +++ b/conf/cronjobs @@ -1,4 +1,4 @@ # Run poller periodically to update your website */10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f Code/Daemon/Run.php Cron > /dev/null 2>&1 # Daily software update job -30 05 * * * root /bin/bash __DATA_DIR__/daily-update.sh >> __DATA_DIR__/daily-updates.log 2>&1 +30 05 * * * __APP__ /bin/bash __DATA_DIR__/daily-update.sh >> __DATA_DIR__/daily-updates.log 2>&1 diff --git a/conf/daily-update.sh b/conf/daily-update.sh index 39b9618..1a4080e 100644 --- a/conf/daily-update.sh +++ b/conf/daily-update.sh @@ -3,9 +3,7 @@ echo " " echo "+++ $(date) +++" echo " " -echo "$(date) - db size." -du -h /var/lib/mysql/__APP__ -# +echo "$(date) - Updating website..." (cd /var/www/__APP__ ; sudo -u streams util/udall) echo "$(date) - Daily update finished." diff --git a/scripts/install b/scripts/install index 9b18ade..2dca129 100755 --- a/scripts/install +++ b/scripts/install @@ -58,7 +58,6 @@ mkdir -p "$install_dir/store" mkdir -p "$install_dir/cache/smarty3" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" chmod -R 775 $install_dir/store $install_dir/cache #================================================= @@ -78,6 +77,8 @@ ynh_add_nginx_config ynh_script_progression --message="Pulling in external libraries with Composer..." ynh_install_composer --workdir="$install_dir" +chown -R $app:www-data "$install_dir" + pushd $install_dir ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons popd From bf949429048f78332d1f3dc99adc03fa9d0da9db Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 24 Oct 2023 13:55:45 +0200 Subject: [PATCH 10/39] Almost there... --- conf/daily-update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/daily-update.sh b/conf/daily-update.sh index 1a4080e..a0a1aa2 100644 --- a/conf/daily-update.sh +++ b/conf/daily-update.sh @@ -4,6 +4,6 @@ echo " " echo "+++ $(date) +++" echo " " echo "$(date) - Updating website..." -(cd /var/www/__APP__ ; sudo -u streams util/udall) +(cd /var/www/__APP__ ; util/udall) echo "$(date) - Daily update finished." From 6c58aa60d68ade693956dfc92361539136c5369f Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 24 Oct 2023 21:28:46 +0200 Subject: [PATCH 11/39] We should be good now --- conf/cronjobs | 2 +- conf/daily-update.sh | 2 +- scripts/install | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/cronjobs b/conf/cronjobs index 43f335d..79d98e2 100644 --- a/conf/cronjobs +++ b/conf/cronjobs @@ -1,4 +1,4 @@ # Run poller periodically to update your website */10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f Code/Daemon/Run.php Cron > /dev/null 2>&1 # Daily software update job -30 05 * * * __APP__ /bin/bash __DATA_DIR__/daily-update.sh >> __DATA_DIR__/daily-updates.log 2>&1 +30 05 * * * root /bin/bash __DATA_DIR__/daily-update.sh >> __DATA_DIR__/daily-updates.log 2>&1 diff --git a/conf/daily-update.sh b/conf/daily-update.sh index a0a1aa2..d3953cd 100644 --- a/conf/daily-update.sh +++ b/conf/daily-update.sh @@ -4,6 +4,6 @@ echo " " echo "+++ $(date) +++" echo " " echo "$(date) - Updating website..." -(cd /var/www/__APP__ ; util/udall) +(cd /var/www/__APP__ ; sudo -u __APP__ util/udall) echo "$(date) - Daily update finished." diff --git a/scripts/install b/scripts/install index 2dca129..ce9c096 100755 --- a/scripts/install +++ b/scripts/install @@ -52,6 +52,7 @@ git config --system --add safe.directory $install_dir # Download, check integrity, uncompress and patch the source from GitHub git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet +git config pull.rebase false touch "$install_dir/php.log" mkdir -p "$install_dir/store" @@ -81,6 +82,8 @@ chown -R $app:www-data "$install_dir" pushd $install_dir ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons + cd var/www/$app/extend/addon/zaddons + ynh_exec_as $app git config pull.rebase false popd #================================================= From ab5c247b55c8fe159dda27de61d75d362cebdc95 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 24 Oct 2023 21:34:07 +0200 Subject: [PATCH 12/39] Missing slash --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index ce9c096..ce76481 100755 --- a/scripts/install +++ b/scripts/install @@ -82,7 +82,7 @@ chown -R $app:www-data "$install_dir" pushd $install_dir ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons - cd var/www/$app/extend/addon/zaddons + cd /var/www/$app/extend/addon/zaddons ynh_exec_as $app git config pull.rebase false popd From 068b643e8349fb4547e269950d8f772e8acef3b3 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Wed, 25 Oct 2023 13:57:07 +0200 Subject: [PATCH 13/39] Improvements in scripts/install --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index ce76481..1fa3713 100755 --- a/scripts/install +++ b/scripts/install @@ -52,7 +52,6 @@ git config --system --add safe.directory $install_dir # Download, check integrity, uncompress and patch the source from GitHub git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet -git config pull.rebase false touch "$install_dir/php.log" mkdir -p "$install_dir/store" @@ -81,6 +80,7 @@ ynh_install_composer --workdir="$install_dir" chown -R $app:www-data "$install_dir" pushd $install_dir + ynh_exec_as $app git config pull.rebase false ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons cd /var/www/$app/extend/addon/zaddons ynh_exec_as $app git config pull.rebase false @@ -122,6 +122,7 @@ chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" # Add daily update script ynh_add_config --template="../conf/daily-update.sh" --destination="/home/yunohost.app/$app/daily-update.sh" +chown root: "/home/yunohost.app/$app/daily-update.sh" #================================================= # GENERIC FINALIZATION From 1740efd0a317a6d4c5c860d38bb4a04c9e5f71fe Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Sun, 12 Nov 2023 15:19:06 +0100 Subject: [PATCH 14/39] Rework of scripts More scripts rework Can't even remember why I'm doing this Oopsie wrong filename wrong filename, again! Give up the ynh_setup_source strategy --- manifest.toml | 13 +------------ scripts/backup | 3 ++- scripts/install | 11 ++++++----- scripts/remove | 3 +++ scripts/restore | 15 +++++++++++---- scripts/upgrade | 4 ++-- 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/manifest.toml b/manifest.toml index e08b34f..294d095 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Streams" description.en = "Open source fediverse server" description.fr = "Serveur fediverse open source" -version = "23.11.11~ynh1" +version = "23.11.12~ynh1" maintainers = ["Papa Dragon"] @@ -37,17 +37,6 @@ ram.runtime = "50M" type = "user" [resources] -<<<<<<< HEAD - [resources.sources] - [resources.sources.main] - url = "https://codeberg.org/streams/streams/archive/8fb92b522b8bff562b350070b57954a998875e58.tar.gz" - sha256 = "b06cb71508cdb166002b41d08a9385bac2bfd9ddb3301116a8cdf9b3bc026275" - - [resources.sources.addons] - url = "https://codeberg.org/streams/streams-addons/archive/39b1c5af9f2b1c639b6438ac85b0ea85273fc201.tar.gz" - sha256 = "5885665bf3dfbe843387184543be17b6b2061b807a57c1d6962548af80794f75" -======= ->>>>>>> d73fcb5 (Switch from tarball download to git clone for the install) [resources.ports] diff --git a/scripts/backup b/scripts/backup index 9d780ff..c06af88 100644 --- a/scripts/backup +++ b/scripts/backup @@ -49,10 +49,11 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= -# BACKUP VARIOUS FILES +# BACKUP CRON JOBS #================================================= ynh_backup --src_path="/etc/cron.d/$app" +ynh_backup --src_path="/$data_dir" #================================================= # BACKUP THE DATABASE diff --git a/scripts/install b/scripts/install index 1fa3713..003e705 100755 --- a/scripts/install +++ b/scripts/install @@ -79,6 +79,11 @@ ynh_script_progression --message="Pulling in external libraries with Composer... ynh_install_composer --workdir="$install_dir" chown -R $app:www-data "$install_dir" +#================================================= +# ADDONS +#================================================= +ynh_script_progression --message="Installing addons..." + pushd $install_dir ynh_exec_as $app git config pull.rebase false ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons @@ -102,17 +107,13 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/htconfig.sample.php" --destination="$install_dir/.htconfig.php" -# addon ldap config -#ynh_script_progression --message="Push LDAP configuration to .htconfig.php..." - -#cat ../conf/ldap_conf.php >> $install_dir/.htconfig.php ynh_store_file_checksum --file=$install_dir/.htconfig.php chmod 600 "$install_dir/.htconfig.php" chown $app:$app "$install_dir/.htconfig.php" #================================================= -# SET CRON JOB +# SET CRON JOBS #================================================= ynh_script_progression --message="Setuping cron job..." --weight=1 diff --git a/scripts/remove b/scripts/remove index 8101afc..e230ab7 100755 --- a/scripts/remove +++ b/scripts/remove @@ -29,6 +29,9 @@ ynh_remove_fail2ban_config # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" +# Remove daily updates logfile +ynh_secure_remove --file="$data_dir/daily-updates.log" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 0c7de08..9724b92 100644 --- a/scripts/restore +++ b/scripts/restore @@ -38,12 +38,15 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - +#================================================= +# RESTORE CRON JOBS +#================================================= ynh_restore_file --origin_path="/etc/cron.d/$app" +ynh_restore_file --origin_path="$data_dir" +#================================================= +# RESTORE LOGROTATE +#================================================= ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= @@ -53,6 +56,10 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index fbb37d4..aca9fd9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -57,7 +57,7 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" --keep="store/ .htconfig.php php.log" - ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" + fi mkdir -p "$install_dir/store" @@ -115,7 +115,7 @@ chmod 644 "/etc/cron.d/$app" ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append +ynh_use_logrotate "$install_dir/php.log" # Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="$install_dir/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP .*$" --max_retry="5" From 665b12b81b2287e098193e82c62ec0aa8343aa0f Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Sun, 12 Nov 2023 20:15:29 +0100 Subject: [PATCH 15/39] We use git clone for install and upgrade (if relevant) --- scripts/install | 4 ++++ scripts/upgrade | 30 +++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 003e705..1675a31 100755 --- a/scripts/install +++ b/scripts/install @@ -60,6 +60,10 @@ mkdir -p "$install_dir/cache/smarty3" chmod -R o-rwx "$install_dir" chmod -R 775 $install_dir/store $install_dir/cache +# Remember we use git clone to fetch code +ynh_app_setting_set --app=$app --key=git_clone --value=1 +ynh_script_progression --message="We set git_clone value to $git_clone" + #================================================= # PHP-FPM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index aca9fd9..aef2bb7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,6 +16,8 @@ ynh_script_progression --message="Loading settings..." --weight=1 email=$(ynh_user_get_info --username=$admin --key=mail) +ynh_app_setting_get --app=$app --key=git_clone + #================================================= # CHECK VERSION #================================================= @@ -56,8 +58,34 @@ 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="$install_dir" --keep="store/ .htconfig.php php.log" + # ynh_setup_source --dest_dir="$install_dir" --keep="store/ .htconfig.php php.log" + # First we save what we need to keep + mv $install_dir/store $data_dir/ + mv $install_dir/cache $data_dir/ + mv $install_dir/php.log $data_dir/ + + # Then we remove the previous install + ynh_secure_remove $install_dir + + # We make the install cloning the repo + mkdir -p "$install_dir" + chown -R $app:www-data "$install_dir" + + git config --system --add safe.directory $install_dir + + git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet + + # We restore what we previously saved + mv $data_dir/store $install_dir/ + mv $data_dir/cache $install_dir/ + mv $data_dir/php.log $install_dir/ + + chmod -R o-rwx "$install_dir" + chmod -R 775 $install_dir/store $install_dir/cache + + # We add a little something to remember we now use git clone to fetch the app code + ynh_app_setting_set --app=$app --key=git_clone --value=1 fi mkdir -p "$install_dir/store" From c962fdf78019c66bdfd0e5039de9bc41eab6ab77 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 12 Nov 2023 19:16:47 +0000 Subject: [PATCH 16/39] 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 6ef1deb..9966ccb 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The [streams repository](https://codeberg.org/streams/streams/) lets you install Your websites will be compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more. -**Shipped version:** 23.11.11~ynh1 +**Shipped version:** 23.11.12~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 1b4d5ce..5c6cbce 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ Le [dépôt streams](https://codeberg.org/streams/streams/) vous permet d'instal Vos sites web seront compatibles avec **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** et bien d'autres encore. -**Version incluse :** 23.11.11~ynh1 +**Version incluse :** 23.11.12~ynh1 ## Captures d’écran From bfd4342580264f9a16b4cd58420d6fde5079d26a Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Sun, 12 Nov 2023 20:26:25 +0100 Subject: [PATCH 17/39] We give another try to this git_clone thing --- scripts/install | 4 ---- scripts/upgrade | 3 --- 2 files changed, 7 deletions(-) diff --git a/scripts/install b/scripts/install index 1675a31..003e705 100755 --- a/scripts/install +++ b/scripts/install @@ -60,10 +60,6 @@ mkdir -p "$install_dir/cache/smarty3" chmod -R o-rwx "$install_dir" chmod -R 775 $install_dir/store $install_dir/cache -# Remember we use git clone to fetch code -ynh_app_setting_set --app=$app --key=git_clone --value=1 -ynh_script_progression --message="We set git_clone value to $git_clone" - #================================================= # PHP-FPM CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index aef2bb7..d28b311 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,9 +83,6 @@ then chmod -R o-rwx "$install_dir" chmod -R 775 $install_dir/store $install_dir/cache - - # We add a little something to remember we now use git clone to fetch the app code - ynh_app_setting_set --app=$app --key=git_clone --value=1 fi mkdir -p "$install_dir/store" From 6eb0d639281ece868acdbd1d024d2f523ded21f3 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Sun, 12 Nov 2023 22:50:31 +0100 Subject: [PATCH 18/39] Work on upgrade script --- scripts/upgrade | 50 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index d28b311..63e5742 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,8 +16,6 @@ ynh_script_progression --message="Loading settings..." --weight=1 email=$(ynh_user_get_info --username=$admin --key=mail) -ynh_app_setting_get --app=$app --key=git_clone - #================================================= # CHECK VERSION #================================================= @@ -57,41 +55,37 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] 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="$install_dir" --keep="store/ .htconfig.php php.log" + git_dir="$install_dir/.git" + if [ ! -d "$git_dir" ] + then - # First we save what we need to keep - mv $install_dir/store $data_dir/ - mv $install_dir/cache $data_dir/ - mv $install_dir/php.log $data_dir/ + # First we save what we need to keep + mv $install_dir/store $data_dir/ + mv $install_dir/cache $data_dir/ + mv $install_dir/php.log $data_dir/ - # Then we remove the previous install - ynh_secure_remove $install_dir + # Then we remove the previous install + ynh_secure_remove $install_dir - # We make the install cloning the repo - mkdir -p "$install_dir" - chown -R $app:www-data "$install_dir" + # We make the install cloning the repo + mkdir -p "$install_dir" + chown -R $app:www-data "$install_dir" - git config --system --add safe.directory $install_dir + git config --system --add safe.directory $install_dir - git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet + git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet - # We restore what we previously saved - mv $data_dir/store $install_dir/ - mv $data_dir/cache $install_dir/ - mv $data_dir/php.log $install_dir/ + # We restore what we previously saved + mv $data_dir/store $install_dir/ + mv $data_dir/cache $install_dir/ + mv $data_dir/php.log $install_dir/ - chmod -R o-rwx "$install_dir" - chmod -R 775 $install_dir/store $install_dir/cache + chmod -R o-rwx "$install_dir" + chown -R $app:www-data "$install_dir" + chmod -R 775 $install_dir/store $install_dir/cache + fi fi -mkdir -p "$install_dir/store" -mkdir -p "$install_dir/cache/smarty3" - -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" -chmod -R 775 $install_dir/store $install_dir/cache - #================================================= # PHP-FPM CONFIGURATION #================================================= From 4f2444c884a383296f156a47362da76b79a78304 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Sun, 12 Nov 2023 23:13:17 +0100 Subject: [PATCH 19/39] Upgrade script, again --- scripts/upgrade | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 63e5742..78e8f87 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,6 +83,18 @@ then chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod -R 775 $install_dir/store $install_dir/cache + + #================================================= + # ADDONS + #================================================= + ynh_script_progression --message="Installing addons..." + + pushd $install_dir + ynh_exec_as $app git config pull.rebase false + ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons + cd /var/www/$app/extend/addon/zaddons + ynh_exec_as $app git config pull.rebase false + popd fi fi @@ -119,12 +131,15 @@ chown $app:$app "$install_dir/.htconfig.php" #================================================= # UPGRADE CRON JOB #================================================= -ynh_script_progression --message="Upgrading cron job..." --weight=1 +ynh_script_progression --message="Setuping cron job..." --weight=1 # Set up cron job -ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app" +ynh_add_config --template="../conf/cronjobs" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" +# Add daily update script +ynh_add_config --template="../conf/daily-update.sh" --destination="/home/yunohost.app/$app/daily-update.sh" +chown root: "/home/yunohost.app/$app/daily-update.sh" #================================================= # GENERIC FINALIZATION From 0883335b9e5a5292e549404e610c79bc9e7d4437 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 13 Nov 2023 00:04:55 +0100 Subject: [PATCH 20/39] tests.toml --- tests.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index 09eb2f7..e64a874 100644 --- a/tests.toml +++ b/tests.toml @@ -13,6 +13,6 @@ test_format = 1.0 # Default args to use for install # ------------------------------- - test_upgrade_from.8985f0af2e713f8fc514dcf4b42208d1329f2403.name = "Upgrade from 23.11.05~ynh2" test_upgrade_from.5112b799be49c5768416ca8c23efd0afbba9cfb5.name = "Upgrade from 23.11.05~ynh3" + test_upgrade_from.d9393d31c20fca899e8e13650cb79f2c0846e81a.name = "Upgrade from 23.11.11~ynh1" From 60844403056c62c696119f191e7695c0b30b739a Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 13 Nov 2023 07:32:44 +0100 Subject: [PATCH 21/39] Upgrade script corrections --- scripts/upgrade | 65 +++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 78e8f87..0544490 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -55,47 +55,30 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 - git_dir="$install_dir/.git" - if [ ! -d "$git_dir" ] - then + # First we save what we need to keep + mv $install_dir/store $data_dir/ + mv $install_dir/cache $data_dir/ + mv $install_dir/php.log $data_dir/ - # First we save what we need to keep - mv $install_dir/store $data_dir/ - mv $install_dir/cache $data_dir/ - mv $install_dir/php.log $data_dir/ + # Then we remove the previous install + ynh_secure_remove $install_dir - # Then we remove the previous install - ynh_secure_remove $install_dir + # We make the install cloning the repo + mkdir -p "$install_dir" + chown -R $app:www-data "$install_dir" - # We make the install cloning the repo - mkdir -p "$install_dir" - chown -R $app:www-data "$install_dir" + git config --system --add safe.directory $install_dir - git config --system --add safe.directory $install_dir + git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet - git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet + # We restore what we previously saved + mv $data_dir/store $install_dir/ + mv $data_dir/cache $install_dir/ + mv $data_dir/php.log $install_dir/ - # We restore what we previously saved - mv $data_dir/store $install_dir/ - mv $data_dir/cache $install_dir/ - mv $data_dir/php.log $install_dir/ - - chmod -R o-rwx "$install_dir" - chown -R $app:www-data "$install_dir" - chmod -R 775 $install_dir/store $install_dir/cache - - #================================================= - # ADDONS - #================================================= - ynh_script_progression --message="Installing addons..." - - pushd $install_dir - ynh_exec_as $app git config pull.rebase false - ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons - cd /var/www/$app/extend/addon/zaddons - ynh_exec_as $app git config pull.rebase false - popd - fi + chmod -R o-rwx "$install_dir" + chown -R $app:www-data "$install_dir" + chmod -R 775 $install_dir/store $install_dir/cache fi #================================================= @@ -116,6 +99,18 @@ ynh_script_progression --message="Pulling in external libraries with Composer... ynh_install_composer +#================================================= +# ADDONS +#================================================= +ynh_script_progression --message="Installing addons..." + +pushd $install_dir + ynh_exec_as $app git config pull.rebase false + ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons + cd /var/www/$app/extend/addon/zaddons + ynh_exec_as $app git config pull.rebase false +popd + #================================================= # SPECIFIC UPGRADE #================================================= From 27c5278c95d3c5c08410cebedc76d52f6261a672 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 13 Nov 2023 09:00:08 +0100 Subject: [PATCH 22/39] Forgot to chown after composer install in scripts/upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 0544490..df9f745 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -98,6 +98,7 @@ ynh_add_nginx_config ynh_script_progression --message="Pulling in external libraries with Composer..." ynh_install_composer +chown -R $app:www-data "$install_dir" #================================================= # ADDONS From 76fbda57d90f72e539c155805ebd419e41dbbb45 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 13 Nov 2023 13:10:30 +0100 Subject: [PATCH 23/39] Update admin section in doc --- doc/ADMIN.md | 8 ++++++++ doc/ADMIN_fr.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 25fcdf5..0df3573 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -2,6 +2,14 @@ - Your website based on the [streams repository](https://codeberg.org/streams/streams/) requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. As your website uses the full domain and is installed on the root, you can create a subdomain such as mywebsite.domain.tld. Don't forget to update your DNS records if you manage them manually. +### Git branches and code updates + +- **Git branches**: the default branch used is "release", which should be considered as the stable version of the software. You can, at your own risk, switch to the "dev" development branch by using the `git checkout dev` command in the installation directory. To return to the stable branch, simply use the `git checkout release` command. + +- **Automatic updates**: your website code will be updated automatically every day at 5:30. The update log `daily-updates.log` is available in the directory /home/yunohost.app/streams (or /home/yunohost.app/streams__X, in the case of multiple installations, 'X' being the number corresponding to the relevant installation). + +- **Manual updates**: you can run a manual update using the command `sudo -u streams util/udall` in the installation directory (or `sudo -u streams__X util/udall` in the case of multiple installations). If you want to keep a record of your manual update in `daily-updates.log`, you can run `bash daily-update.sh` in the /home/yunohost.app/streams directory (or /home/yunohost.app/streams__X). + ### Admin user rights, logs and failed database updates - **Admin account**: When installation is complete, you must visit your new website and create the first account using the **admin's email address** (the admin is the YunoHost user which was chosen at the beginning of the installation process). You will then be able to create your first channel and have access the **admin pages** for your website. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index e45f216..7af6bd5 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -2,6 +2,14 @@ - Votre site basé sur le [dépôt streams](https://codeberg.org/streams/streams/) nécessite un domaine dédié, alors obtenez-en un et ajoutez-le à l'aide du panneau d'administration YunoHost. **Domaines -> Ajouter un domaine**. Votre site utilise un domaine complet et est installé à la racine, vous pouvez donc créer un sous-domaine tel que monsite.domaine.tld. N'oubliez pas de mettre à jour vos enregistrements DNS si vous les gérez manuellement. +### Branches git et mises à jour du code + +- **Branches git** : la branche utilisée par défaut est "release", qui doit être considérée comme la version stable du logiciel. Vous pouvez, à vos risques et périls, basculer vers la branche de développement "dev", en utilisant la commande `git checkout dev` dans le répertoire d'installation. Pour revenir à la branche stable, il vous suffit d'utiliser la commande `git checkout release`. + +- **Mises à jour automatiques** : le code de votre site sera mis à jour automatiquement tous les jours à 5:30. Le journal des mises à jours `daily-updates.log` est disponible dans le répertoire /home/yunohost.app/streams (ou /home/yunohost.app/streams__X, en cas d'installations multiples, 'X' étant le nombre correspondant à l'installation concernée). + +- **Mises à jour manuelles** : vous pouvez lancer une mise à jour manuellement en utilisant la commande `sudo -u streams util/udall` dans le répertoire d'installation (ou `sudo -u streams__X util/udall` en cas d'installations multiples). Si vous souhaitez conserver la trace de votre mise à jour manuelle dans `daily-updates.log`, vous pouvez lancer la commande `bash daily-update.sh` dans le répertoire /home/yunohost.app/streams (ou /home/yunohost.app/streams__X). + ### Droits d'utilisateur de l'administrateur, journaux et échec des mises à jour de la base de données - **Compte administrateur** : lorsque l'installation est terminée, vous devez vous rendre sur la page d'accueil de votre nouveau site et créer le premier compte en utilisant **l'adresse électronique de l' administrateur** (l'administrateur est l'utilisateur YunoHost qui a été choisi au début du processus d'installation). Vous pouvez ensuite créer votre premier canal et accéder à **l'interface d'administration** de votre site. From 5d0b015461242229e8599bde21e3bec0b9466e2a Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 13 Nov 2023 15:39:55 +0100 Subject: [PATCH 24/39] Add option to switch to dev branch --- config_panel.toml | 12 ++++++++++++ scripts/config | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/config_panel.toml b/config_panel.toml index fbc4a7e..50623e8 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -4,6 +4,18 @@ version = "1.0" name.en = "Streams configuration" name.fr = "Configuration de Streams" + [main.git_branch_mode] + name.en = "'dev' branch" + name.fr = "Branche 'dev'" + + [main.git_branch_mode.git_branch_mode] + ask.en = "Switch to git 'dev' branch" + ask.fr = "Basculer sur la branche git 'dev'" + type = "boolean" + default = "0" + help.en = "Use at your own risk, if you know ewactly what you're doing." + help.fr = "À utiliser à vos risques et périls, si vous savez exactement ce que vous faîtes." + [main.php_fpm_config] name.en = "PHP-FPM configuration" name.fr = "Configuration de PHP-FPM" diff --git a/scripts/config b/scripts/config index 91c2de7..2890f16 100644 --- a/scripts/config +++ b/scripts/config @@ -22,6 +22,22 @@ current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) # SPECIFIC GETTERS FOR TOML SHORT KEY #================================================= +get__git_branch_mode() { + # Maintenance mode status + git_branch_mode_status="$(cd "$install_dir" && ynh_exec_as "$app" \ + git branch --show-current)" 2> /dev/null + if echo $git_branch_mode_status | grep -q "release" + then + echo "0" + elif echo $git_branch_mode_status | grep -q "dev" + then + echo "1" + else + ynh_print_err --message="Not using \"release\" or \"dev\" branch, please handle this in command line" + exit 0 + fi +} + get__fpm_footprint() { # Free footprint value for php-fpm # Check if current_fpm_footprint is an integer @@ -49,6 +65,22 @@ get__free_footprint() { # SPECIFIC SETTERS FOR TOML SHORT KEYS #================================================= + +set__git_branch_mode() { + if [ "$git_branch_mode" -eq "0" ]; then + # If git_branch was set to 0, switch to "release" branch + (cd "$install_dir" && ynh_exec_as "$app" \ + git checkout release) + ynh_print_info "Switching to \"release\" branch" + elif [ "$git_branch_mode" -eq "1" ]; then + # If git_branch was set to 1, switch to "dev" branch + (cd "$install_dir" && ynh_exec_as "$app" \ + git checkout dev) + ynh_print_info "Switching to \"dev\" branch" + fi + ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode" +} + set__fpm_footprint() { if [ "$fpm_footprint" != "specific" ] then From afee1ab28a3c8e88871a7852e62a67c009d5b4d1 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 13 Nov 2023 16:52:36 +0100 Subject: [PATCH 25/39] Update admin doc --- config_panel.toml | 2 +- doc/ADMIN.md | 2 +- doc/ADMIN_fr.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 50623e8..1ac7639 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -13,7 +13,7 @@ name.fr = "Configuration de Streams" ask.fr = "Basculer sur la branche git 'dev'" type = "boolean" default = "0" - help.en = "Use at your own risk, if you know ewactly what you're doing." + help.en = "Use at your own risk, if you know exactly what you're doing." help.fr = "À utiliser à vos risques et périls, si vous savez exactement ce que vous faîtes." [main.php_fpm_config] diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 0df3573..5bd369d 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -4,7 +4,7 @@ ### Git branches and code updates -- **Git branches**: the default branch used is "release", which should be considered as the stable version of the software. You can, at your own risk, switch to the "dev" development branch by using the `git checkout dev` command in the installation directory. To return to the stable branch, simply use the `git checkout release` command. +- **Git branches**: the default branch used is "release", which should be considered as the stable version of the software. You can, at your own risk, switch to the "dev" development branch. You can do this in the YunoHost admin interface. You can also do it through a SSH connection by using the `git checkout dev` command in the installation directory (to return to the stable branch, simply use the `git checkout release` command). - **Automatic updates**: your website code will be updated automatically every day at 5:30. The update log `daily-updates.log` is available in the directory /home/yunohost.app/streams (or /home/yunohost.app/streams__X, in the case of multiple installations, 'X' being the number corresponding to the relevant installation). diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 7af6bd5..bcbb074 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -4,7 +4,7 @@ ### Branches git et mises à jour du code -- **Branches git** : la branche utilisée par défaut est "release", qui doit être considérée comme la version stable du logiciel. Vous pouvez, à vos risques et périls, basculer vers la branche de développement "dev", en utilisant la commande `git checkout dev` dans le répertoire d'installation. Pour revenir à la branche stable, il vous suffit d'utiliser la commande `git checkout release`. +- **Branches git** : la branche utilisée par défaut est "release", qui doit être considérée comme la version stable du logiciel. Vous pouvez, à vos risques et périls, basculer vers la branche de développement "dev". Vous pouvez le faire depuis l'interface d'administration de YunoHost. Vous pouvez aussi le faire via une connexion SSH en utilisant la commande `git checkout dev` dans le répertoire d'installation (pour revenir à la branche stable, il vous suffit d'utiliser la commande `git checkout release`). - **Mises à jour automatiques** : le code de votre site sera mis à jour automatiquement tous les jours à 5:30. Le journal des mises à jours `daily-updates.log` est disponible dans le répertoire /home/yunohost.app/streams (ou /home/yunohost.app/streams__X, en cas d'installations multiples, 'X' étant le nombre correspondant à l'installation concernée). From b1cca218bb6f8c01c6da6e2746c0f923cf08a1f2 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Mon, 13 Nov 2023 20:41:38 +0100 Subject: [PATCH 26/39] Only allow cron daily updates if release branch is used --- conf/daily-update.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/conf/daily-update.sh b/conf/daily-update.sh index d3953cd..ecb894f 100644 --- a/conf/daily-update.sh +++ b/conf/daily-update.sh @@ -3,7 +3,14 @@ echo " " echo "+++ $(date) +++" echo " " -echo "$(date) - Updating website..." -(cd /var/www/__APP__ ; sudo -u __APP__ util/udall) -echo "$(date) - Daily update finished." +git_branch="$(cd /var/www/__APP__ && sudo -u __APP__ \ + git branch --show-current)" 2> /dev/null +if echo $git_branch | grep -q "release" +then + echo "$(date) - Updating website..." + (cd /var/www/__APP__ ; sudo -u __APP__ util/udall) + echo "$(date) - Daily update finished." +else + echo "$(date) - release branch not in use, no automatic update" +fi From 65f81e22763570d3bf5672b8f87c571b5bc72e23 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 01:03:26 +0100 Subject: [PATCH 27/39] We set phpversion in _common.sh --- scripts/_common.sh | 1 + scripts/config | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 3b59e88..ea5fe64 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,6 +7,7 @@ #================================================= YNH_COMPOSER_VERSION="2.5.8" +YNH_PHP_VERSION="8.2" #================================================= # PERSONAL HELPERS diff --git a/scripts/config b/scripts/config index 2890f16..b3f277e 100644 --- a/scripts/config +++ b/scripts/config @@ -15,7 +15,7 @@ ynh_abort_if_errors # RETRIEVE ARGUMENTS #================================================= -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +phpversion="$YNH_PHP_VERSION" current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) #================================================= From 07c4ed1a8c03fe4be20256d92a85220ccd76221a Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 03:22:02 +0100 Subject: [PATCH 28/39] git checkout without ynh_exec_as --- scripts/config | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/config b/scripts/config index b3f277e..49b07ce 100644 --- a/scripts/config +++ b/scripts/config @@ -24,8 +24,7 @@ current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) get__git_branch_mode() { # Maintenance mode status - git_branch_mode_status="$(cd "$install_dir" && ynh_exec_as "$app" \ - git branch --show-current)" 2> /dev/null + git_branch_mode_status="$(cd "$install_dir" && git branch --show-current)" 2> /dev/null if echo $git_branch_mode_status | grep -q "release" then echo "0" @@ -69,13 +68,11 @@ get__free_footprint() { set__git_branch_mode() { if [ "$git_branch_mode" -eq "0" ]; then # If git_branch was set to 0, switch to "release" branch - (cd "$install_dir" && ynh_exec_as "$app" \ - git checkout release) + (cd "$install_dir" && git checkout release) ynh_print_info "Switching to \"release\" branch" elif [ "$git_branch_mode" -eq "1" ]; then # If git_branch was set to 1, switch to "dev" branch - (cd "$install_dir" && ynh_exec_as "$app" \ - git checkout dev) + (cd "$install_dir" && git checkout dev) ynh_print_info "Switching to \"dev\" branch" fi ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode" From 563f00e6756d6c949a3c11f330a92edc8dc55f6a Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 03:52:56 +0100 Subject: [PATCH 29/39] switch to release only if ahead of dev --- scripts/config | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/config b/scripts/config index 49b07ce..5f94714 100644 --- a/scripts/config +++ b/scripts/config @@ -66,10 +66,17 @@ get__free_footprint() { set__git_branch_mode() { - if [ "$git_branch_mode" -eq "0" ]; then - # If git_branch was set to 0, switch to "release" branch - (cd "$install_dir" && git checkout release) - ynh_print_info "Switching to \"release\" branch" + if [ "$git_branch_mode" -eq "0" ] + then + # We allow switch back to "release" only if the branch is ahead of "dev" + if [ -z "$(cd "$install_dir" && git log release..dev)" ] + then + # If git_branch was set to 0, switch to "release" branch + (cd "$install_dir" && git checkout release) + ynh_print_info "Switching to \"release\" branch" + else + ynh_print_err --message="\"release\" branch is behind your local \"dev\" branch, rolling back is not allowed here" + exit 0 elif [ "$git_branch_mode" -eq "1" ]; then # If git_branch was set to 1, switch to "dev" branch (cd "$install_dir" && git checkout dev) From 736f5d633ecf773ef1a49e0e8b235631035df7ac Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 03:59:06 +0100 Subject: [PATCH 30/39] Oops --- scripts/config | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/config b/scripts/config index 5f94714..79921da 100644 --- a/scripts/config +++ b/scripts/config @@ -77,6 +77,7 @@ set__git_branch_mode() { else ynh_print_err --message="\"release\" branch is behind your local \"dev\" branch, rolling back is not allowed here" exit 0 + fi elif [ "$git_branch_mode" -eq "1" ]; then # If git_branch was set to 1, switch to "dev" branch (cd "$install_dir" && git checkout dev) From a2818bf05ac3000e3b9ccac3a0b228d4fad9fc0a Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 04:31:12 +0100 Subject: [PATCH 31/39] We bring back ynh_exec_as to switch branches --- scripts/config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/config b/scripts/config index 79921da..a99cef8 100644 --- a/scripts/config +++ b/scripts/config @@ -72,15 +72,15 @@ set__git_branch_mode() { if [ -z "$(cd "$install_dir" && git log release..dev)" ] then # If git_branch was set to 0, switch to "release" branch - (cd "$install_dir" && git checkout release) + (cd "$install_dir" && ynh_exec_as "$app" git checkout release) ynh_print_info "Switching to \"release\" branch" else - ynh_print_err --message="\"release\" branch is behind your local \"dev\" branch, rolling back is not allowed here" - exit 0 + ynh_die --message="\"release\" branch is behind your local \"dev\" branch, rolling back is not allowed here" + exit 1 fi elif [ "$git_branch_mode" -eq "1" ]; then # If git_branch was set to 1, switch to "dev" branch - (cd "$install_dir" && git checkout dev) + (cd "$install_dir" && ynh_exec_as "$app" git checkout dev) ynh_print_info "Switching to \"dev\" branch" fi ynh_app_setting_set --app=$app --key=git_branch_mode --value="$git_branch_mode" From 725926b354b3e68b92e3d7512d8d5016082a7609 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 04:56:45 +0100 Subject: [PATCH 32/39] Extended description of the branch switching option --- config_panel.toml | 24 ++++++++++++------------ scripts/config | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index 1ac7639..f3117c1 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -4,18 +4,6 @@ version = "1.0" name.en = "Streams configuration" name.fr = "Configuration de Streams" - [main.git_branch_mode] - name.en = "'dev' branch" - name.fr = "Branche 'dev'" - - [main.git_branch_mode.git_branch_mode] - ask.en = "Switch to git 'dev' branch" - ask.fr = "Basculer sur la branche git 'dev'" - type = "boolean" - default = "0" - help.en = "Use at your own risk, if you know exactly what you're doing." - help.fr = "À utiliser à vos risques et périls, si vous savez exactement ce que vous faîtes." - [main.php_fpm_config] name.en = "PHP-FPM configuration" name.fr = "Configuration de PHP-FPM" @@ -46,3 +34,15 @@ name.fr = "Configuration de Streams" default = "medium" help.en = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.
medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.
high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding." help.fr = "low : Utilisation personnelle, derrière le SSO. Pas d'empreinte RAM en cas de non-utilisation, mais l'impact sur le processeur peut être élevé si de nombreux utilisateurs utilisent le service.
medium : Faible utilisation, peu d'utilisateurs et/ou service pas nécessairement accessible au public. Faible empreinte RAM, empreinte moyenne sur le processeur en cas d'utilisation.
high : Utilisation soutenue, site web fréquemment visité. L'empreinte RAM est élevée, mais l'utilisation du processeur est moindre et le service répond rapidement." + + [main.git_branch_mode] + name.en = "'dev' branch" + name.fr = "Branche 'dev'" + + [main.git_branch_mode.git_branch_mode] + ask.en = "Switch to git 'dev' branch" + ask.fr = "Basculer sur la branche git 'dev'" + type = "boolean" + default = "0" + help.en = "This option should only be used if you're either a professional software developer or a certified lunatic (or both).

You can only return to the 'release' branch if it is ahead of the 'dev' branch.

You must be able to use the command line to solve any problems you may encounter after using this option.

If you haven't understood any of the above lines DON'T USE THIS OPTION!!!" + help.fr = "Cette option ne devrait être utilisée que si vous êtes un développeur de logiciels professionnel ou une personne totalement insensée (ou les deux)

Vous ne pourrez revenir à la branche 'release' que si celle-ci est en avance sur la branche 'dev'.

Vous devez impérativement être capable d'utiliser la ligne de commande pour résoudre tout problème que vous pourriez rencontrer après avoir utilisé cette option.

Si vous n'avez rien compris aux lignes ci-dessus N'UTILISEZ PAS CETTE OPTION!!!" diff --git a/scripts/config b/scripts/config index a99cef8..61bd5e1 100644 --- a/scripts/config +++ b/scripts/config @@ -69,7 +69,7 @@ set__git_branch_mode() { if [ "$git_branch_mode" -eq "0" ] then # We allow switch back to "release" only if the branch is ahead of "dev" - if [ -z "$(cd "$install_dir" && git log release..dev)" ] + if [ -z "$(cd "$install_dir" && git log --oneline release..dev)" ] then # If git_branch was set to 0, switch to "release" branch (cd "$install_dir" && ynh_exec_as "$app" git checkout release) From 89aeb3378281c0d942d4aeeb1c9aa00758c95a49 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 08:26:29 +0100 Subject: [PATCH 33/39] If release isn't current branch we git fetch it daily --- conf/daily-update.sh | 5 +++-- scripts/config | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/conf/daily-update.sh b/conf/daily-update.sh index ecb894f..fff1714 100644 --- a/conf/daily-update.sh +++ b/conf/daily-update.sh @@ -9,8 +9,9 @@ if echo $git_branch | grep -q "release" then echo "$(date) - Updating website..." (cd /var/www/__APP__ ; sudo -u __APP__ util/udall) - echo "$(date) - Daily update finished." else - echo "$(date) - release branch not in use, no automatic update" + echo "$(date) - Updating release branch code..." + (cd /var/www/__APP__ ; sudo -u __APP__ git fetch origin release:release) fi +echo "$(date) - Daily update finished." diff --git a/scripts/config b/scripts/config index 61bd5e1..457c906 100644 --- a/scripts/config +++ b/scripts/config @@ -72,8 +72,10 @@ set__git_branch_mode() { if [ -z "$(cd "$install_dir" && git log --oneline release..dev)" ] then # If git_branch was set to 0, switch to "release" branch - (cd "$install_dir" && ynh_exec_as "$app" git checkout release) ynh_print_info "Switching to \"release\" branch" + (cd "$install_dir" && ynh_exec_as "$app" git checkout release) + ynh_print_info "Full update of \"release\" branch" + (cd "$install_dir" && ynh_exec_as "$app" util/udall) else ynh_die --message="\"release\" branch is behind your local \"dev\" branch, rolling back is not allowed here" exit 1 From 30a7083b5ae4ba0430e5fe57e5afb74db4af4be8 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 09:18:10 +0100 Subject: [PATCH 34/39] Update admin doc --- config_panel.toml | 12 ++++++------ doc/ADMIN.md | 16 ++++++++-------- doc/ADMIN_fr.md | 16 ++++++++-------- scripts/config | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/config_panel.toml b/config_panel.toml index f3117c1..b2b4906 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -36,13 +36,13 @@ name.fr = "Configuration de Streams" help.fr = "low : Utilisation personnelle, derrière le SSO. Pas d'empreinte RAM en cas de non-utilisation, mais l'impact sur le processeur peut être élevé si de nombreux utilisateurs utilisent le service.
medium : Faible utilisation, peu d'utilisateurs et/ou service pas nécessairement accessible au public. Faible empreinte RAM, empreinte moyenne sur le processeur en cas d'utilisation.
high : Utilisation soutenue, site web fréquemment visité. L'empreinte RAM est élevée, mais l'utilisation du processeur est moindre et le service répond rapidement." [main.git_branch_mode] - name.en = "'dev' branch" - name.fr = "Branche 'dev'" + name.en = "Developer Mode" + name.fr = "Mode Développeur" [main.git_branch_mode.git_branch_mode] - ask.en = "Switch to git 'dev' branch" - ask.fr = "Basculer sur la branche git 'dev'" + ask.en = "Switch to 'dev' branch" + ask.fr = "Basculer sur la branche 'dev'" type = "boolean" default = "0" - help.en = "This option should only be used if you're either a professional software developer or a certified lunatic (or both).

You can only return to the 'release' branch if it is ahead of the 'dev' branch.

You must be able to use the command line to solve any problems you may encounter after using this option.

If you haven't understood any of the above lines DON'T USE THIS OPTION!!!" - help.fr = "Cette option ne devrait être utilisée que si vous êtes un développeur de logiciels professionnel ou une personne totalement insensée (ou les deux)

Vous ne pourrez revenir à la branche 'release' que si celle-ci est en avance sur la branche 'dev'.

Vous devez impérativement être capable d'utiliser la ligne de commande pour résoudre tout problème que vous pourriez rencontrer après avoir utilisé cette option.

Si vous n'avez rien compris aux lignes ci-dessus N'UTILISEZ PAS CETTE OPTION!!!" + help.en = "This option should only be used if you're either a professional software developer or a certified lunatic (or both).

You can only return to the 'release' branch if it is ahead of the 'dev' branch.

If authorised, the switch to the 'release' branch will be immediately followed by a global update of the site - via the util/udall command.

You must be able to use the command line to solve any problems you may encounter after using this option.

If you haven't understood any of the above lines DON'T USE THIS OPTION!!!" + help.fr = "Cette option ne devrait être utilisée que si vous êtes un développeur de logiciels professionnel ou une personne passablement déraisonnable (ou les deux à la fois)

Vous ne pourrez revenir à la branche 'release' que si celle-ci est en avance sur la branche 'dev'.

Si elle est autorisée, la bascule vers la branche 'release' sera immédiatement suivie d'une mise à jour globale du site - via la commande util/udall.

Vous devez impérativement être capable d'utiliser la ligne de commande pour résoudre tout problème que vous pourriez rencontrer après avoir utilisé cette option.

Si vous n'avez rien compris aux lignes ci-dessus N'UTILISEZ PAS CETTE OPTION!!!" diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 5bd369d..6ddead3 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -2,14 +2,6 @@ - Your website based on the [streams repository](https://codeberg.org/streams/streams/) requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. As your website uses the full domain and is installed on the root, you can create a subdomain such as mywebsite.domain.tld. Don't forget to update your DNS records if you manage them manually. -### Git branches and code updates - -- **Git branches**: the default branch used is "release", which should be considered as the stable version of the software. You can, at your own risk, switch to the "dev" development branch. You can do this in the YunoHost admin interface. You can also do it through a SSH connection by using the `git checkout dev` command in the installation directory (to return to the stable branch, simply use the `git checkout release` command). - -- **Automatic updates**: your website code will be updated automatically every day at 5:30. The update log `daily-updates.log` is available in the directory /home/yunohost.app/streams (or /home/yunohost.app/streams__X, in the case of multiple installations, 'X' being the number corresponding to the relevant installation). - -- **Manual updates**: you can run a manual update using the command `sudo -u streams util/udall` in the installation directory (or `sudo -u streams__X util/udall` in the case of multiple installations). If you want to keep a record of your manual update in `daily-updates.log`, you can run `bash daily-update.sh` in the /home/yunohost.app/streams directory (or /home/yunohost.app/streams__X). - ### Admin user rights, logs and failed database updates - **Admin account**: When installation is complete, you must visit your new website and create the first account using the **admin's email address** (the admin is the YunoHost user which was chosen at the beginning of the installation process). You will then be able to create your first channel and have access the **admin pages** for your website. @@ -19,3 +11,11 @@ - **For logs**: Go to **admin->logs** and enter the file name **php.log**. - **Failed Database after Upgrade**: If the database upgrade fails after version upgrade, you can visit the dedicated page, `https://mywebsite.domain.tld/admin/dbsync/`, and check the numbers of failed updates. These updates will have to be ran manually using software such as **phpMyAdmin**. + +### Git branches and code updates + +- **Developer Mode**: the default git branch used is 'release', which should be considered as the stable version of the software. You can, **at your own risk**, switch to the 'dev' branch. You can do this in the config panel of your app in YunoHost admin interface. You can also do it through a SSH connection by using the `git checkout dev` command in the installation directory. **In the config panel you can only switch back to 'release' branch if it is ahead of the 'dev' branch**. You can do it anytime through SSH simply use the `git checkout release` command. + +- **Automatic updates**: your website code will be updated automatically every day at 5:30. The updates log `daily-updates.log` is available in the directory /home/yunohost.app/streams (or /home/yunohost.app/streams__X, in the case of multiple installations, 'X' being the number corresponding to the relevant installation). The full website automatic update will be performed if the current branch is 'release' (if not, only `git fetch` will be performed for 'release'), and also immediately after switching back to 'release' in the config panel. + +- **Manual updates**: in any branch you can run a manual update at any moment using the command `sudo -u streams util/udall` in the installation directory (or `sudo -u streams__X util/udall` in the case of multiple installations). If you want to keep a record of your manual update in `daily-updates.log`, you can run `bash daily-update.sh >> daily-updates.log` in the /home/yunohost.app/streams directory (or /home/yunohost.app/streams__X). diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index bcbb074..54dbd05 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -2,14 +2,6 @@ - Votre site basé sur le [dépôt streams](https://codeberg.org/streams/streams/) nécessite un domaine dédié, alors obtenez-en un et ajoutez-le à l'aide du panneau d'administration YunoHost. **Domaines -> Ajouter un domaine**. Votre site utilise un domaine complet et est installé à la racine, vous pouvez donc créer un sous-domaine tel que monsite.domaine.tld. N'oubliez pas de mettre à jour vos enregistrements DNS si vous les gérez manuellement. -### Branches git et mises à jour du code - -- **Branches git** : la branche utilisée par défaut est "release", qui doit être considérée comme la version stable du logiciel. Vous pouvez, à vos risques et périls, basculer vers la branche de développement "dev". Vous pouvez le faire depuis l'interface d'administration de YunoHost. Vous pouvez aussi le faire via une connexion SSH en utilisant la commande `git checkout dev` dans le répertoire d'installation (pour revenir à la branche stable, il vous suffit d'utiliser la commande `git checkout release`). - -- **Mises à jour automatiques** : le code de votre site sera mis à jour automatiquement tous les jours à 5:30. Le journal des mises à jours `daily-updates.log` est disponible dans le répertoire /home/yunohost.app/streams (ou /home/yunohost.app/streams__X, en cas d'installations multiples, 'X' étant le nombre correspondant à l'installation concernée). - -- **Mises à jour manuelles** : vous pouvez lancer une mise à jour manuellement en utilisant la commande `sudo -u streams util/udall` dans le répertoire d'installation (ou `sudo -u streams__X util/udall` en cas d'installations multiples). Si vous souhaitez conserver la trace de votre mise à jour manuelle dans `daily-updates.log`, vous pouvez lancer la commande `bash daily-update.sh` dans le répertoire /home/yunohost.app/streams (ou /home/yunohost.app/streams__X). - ### Droits d'utilisateur de l'administrateur, journaux et échec des mises à jour de la base de données - **Compte administrateur** : lorsque l'installation est terminée, vous devez vous rendre sur la page d'accueil de votre nouveau site et créer le premier compte en utilisant **l'adresse électronique de l' administrateur** (l'administrateur est l'utilisateur YunoHost qui a été choisi au début du processus d'installation). Vous pouvez ensuite créer votre premier canal et accéder à **l'interface d'administration** de votre site. @@ -19,3 +11,11 @@ - **Pour les logs** : Allez dans **admin->logs** et saisissez le nom du fichier **php.log**. - **Échec de la base de données après la mise à niveau** : Parfois, la mise à niveau de la base de données échoue après la mise à niveau de la version. Allez sur la page dédiée de votre site, `https://monsite.domaine.tld/admin/dbsync/`, et vérifiez les références de mises à jour défaillantes. Ces mises à jour devront être exécutées manuellement, sur **phpMyAdmin**. + +### Branches git et mises à jour du code + +- **Branches git** : la branche utilisée par défaut est 'release', qui doit être considérée comme la version stable du logiciel. Vous pouvez, **à vos risques et périls**, basculer vers la branche de développement 'dev'. Vous pouvez le faire dans le panneau de configuration de votre application dans l'interface d'administration de YunoHost. Vous pouvez aussi le faire via une connexion SSH en utilisant la commande `git checkout dev` dans le répertoire d'installation. **Dans le panneau de configuration, vous ne pouvez revenir à la branche 'release' que si elle est en avance sur la branche 'dev'**. Vous pouvez le faire à tout moment via SSH en utilisant la commande `git checkout release`. + +- **Mises à jour automatiques** : le code de votre site sera mis à jour automatiquement tous les jours à 5:30. Le journal des mises à jours `daily-updates.log` est disponible dans le répertoire /home/yunohost.app/streams (ou /home/yunohost.app/streams__X, en cas d'installations multiples, 'X' étant le nombre correspondant à l'installation concernée). La mise à jour automatique du site web complet sera effectuée si la branche courante est 'release' (sinon, seul `git fetch` sera effectué pour 'release'), et aussi immédiatement après le retour à 'release' par l'intermédiaire du panneau de configuration. + +- **Mises à jour manuelles** : quelle que soit la branche courante vous pouvez lancer une mise à jour manuellement en utilisant la commande `sudo -u streams util/udall` dans le répertoire d'installation (ou `sudo -u streams__X util/udall` en cas d'installations multiples). Si vous souhaitez conserver la trace de votre mise à jour manuelle dans `daily-updates.log`, vous pouvez lancer la commande `bash daily-update.sh >> daily-updates.log` dans le répertoire /home/yunohost.app/streams (ou /home/yunohost.app/streams__X). diff --git a/scripts/config b/scripts/config index 457c906..5f93dd1 100644 --- a/scripts/config +++ b/scripts/config @@ -74,7 +74,7 @@ set__git_branch_mode() { # If git_branch was set to 0, switch to "release" branch ynh_print_info "Switching to \"release\" branch" (cd "$install_dir" && ynh_exec_as "$app" git checkout release) - ynh_print_info "Full update of \"release\" branch" + ynh_print_info "Full update of the website" (cd "$install_dir" && ynh_exec_as "$app" util/udall) else ynh_die --message="\"release\" branch is behind your local \"dev\" branch, rolling back is not allowed here" From 05dd424962a4f9efbb2e0b5aa8623038145fbd81 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 09:39:56 +0100 Subject: [PATCH 35/39] log update when switching to release in config panel --- scripts/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config b/scripts/config index 5f93dd1..369220f 100644 --- a/scripts/config +++ b/scripts/config @@ -75,7 +75,7 @@ set__git_branch_mode() { ynh_print_info "Switching to \"release\" branch" (cd "$install_dir" && ynh_exec_as "$app" git checkout release) ynh_print_info "Full update of the website" - (cd "$install_dir" && ynh_exec_as "$app" util/udall) + (cd "$data_dir" && bash daily-update.sh >> daily-updates.log 2>&1) else ynh_die --message="\"release\" branch is behind your local \"dev\" branch, rolling back is not allowed here" exit 1 From eb6ead78c01dc42d3444a232f0e59ba72c957367 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 09:58:24 +0100 Subject: [PATCH 36/39] data_dir not recognised in scripts/config? --- scripts/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config b/scripts/config index 369220f..60be5e4 100644 --- a/scripts/config +++ b/scripts/config @@ -75,7 +75,7 @@ set__git_branch_mode() { ynh_print_info "Switching to \"release\" branch" (cd "$install_dir" && ynh_exec_as "$app" git checkout release) ynh_print_info "Full update of the website" - (cd "$data_dir" && bash daily-update.sh >> daily-updates.log 2>&1) + bash $data_dir/daily-update.sh >> $data_dir/daily-updates.log 2>&1 else ynh_die --message="\"release\" branch is behind your local \"dev\" branch, rolling back is not allowed here" exit 1 From 6e7a3e553dfe8d94dd282a605e9dcf060b13def5 Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 10:09:22 +0100 Subject: [PATCH 37/39] data_dir not recognised in scripts/config! --- scripts/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config b/scripts/config index 60be5e4..b930e1c 100644 --- a/scripts/config +++ b/scripts/config @@ -75,7 +75,7 @@ set__git_branch_mode() { ynh_print_info "Switching to \"release\" branch" (cd "$install_dir" && ynh_exec_as "$app" git checkout release) ynh_print_info "Full update of the website" - bash $data_dir/daily-update.sh >> $data_dir/daily-updates.log 2>&1 + (cd /home/yunohost.app/"$app" && bash daily-update.sh >> daily-updates.log 2>&1) else ynh_die --message="\"release\" branch is behind your local \"dev\" branch, rolling back is not allowed here" exit 1 From 00ccbbeb7e3da0209698ff12cdeb274a27f048af Mon Sep 17 00:00:00 2001 From: dragondaddy Date: Tue, 14 Nov 2023 14:25:43 +0100 Subject: [PATCH 38/39] Package version --- doc/ADMIN_fr.md | 2 +- manifest.toml | 2 +- scripts/config | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 54dbd05..75fd63e 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -14,7 +14,7 @@ ### Branches git et mises à jour du code -- **Branches git** : la branche utilisée par défaut est 'release', qui doit être considérée comme la version stable du logiciel. Vous pouvez, **à vos risques et périls**, basculer vers la branche de développement 'dev'. Vous pouvez le faire dans le panneau de configuration de votre application dans l'interface d'administration de YunoHost. Vous pouvez aussi le faire via une connexion SSH en utilisant la commande `git checkout dev` dans le répertoire d'installation. **Dans le panneau de configuration, vous ne pouvez revenir à la branche 'release' que si elle est en avance sur la branche 'dev'**. Vous pouvez le faire à tout moment via SSH en utilisant la commande `git checkout release`. +- **Mode Développeur** : la branche utilisée par défaut est 'release', qui doit être considérée comme la version stable du logiciel. Vous pouvez, **à vos risques et périls**, basculer vers la branche de développement 'dev'. Vous pouvez le faire dans le panneau de configuration de votre application dans l'interface d'administration de YunoHost. Vous pouvez aussi le faire via une connexion SSH en utilisant la commande `git checkout dev` dans le répertoire d'installation. **Dans le panneau de configuration, vous ne pouvez revenir à la branche 'release' que si elle est en avance sur la branche 'dev'**. Vous pouvez le faire à tout moment via SSH en utilisant la commande `git checkout release`. - **Mises à jour automatiques** : le code de votre site sera mis à jour automatiquement tous les jours à 5:30. Le journal des mises à jours `daily-updates.log` est disponible dans le répertoire /home/yunohost.app/streams (ou /home/yunohost.app/streams__X, en cas d'installations multiples, 'X' étant le nombre correspondant à l'installation concernée). La mise à jour automatique du site web complet sera effectuée si la branche courante est 'release' (sinon, seul `git fetch` sera effectué pour 'release'), et aussi immédiatement après le retour à 'release' par l'intermédiaire du panneau de configuration. diff --git a/manifest.toml b/manifest.toml index 294d095..e7f1cca 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Streams" description.en = "Open source fediverse server" description.fr = "Serveur fediverse open source" -version = "23.11.12~ynh1" +version = "23.11.14~ynh1" maintainers = ["Papa Dragon"] diff --git a/scripts/config b/scripts/config index b930e1c..06eb915 100644 --- a/scripts/config +++ b/scripts/config @@ -23,7 +23,7 @@ current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) #================================================= get__git_branch_mode() { - # Maintenance mode status + # Git branch mode status git_branch_mode_status="$(cd "$install_dir" && git branch --show-current)" 2> /dev/null if echo $git_branch_mode_status | grep -q "release" then From 6151bbd75eb84baf77566e4e71f964afeb9978a2 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 14 Nov 2023 13:25:53 +0000 Subject: [PATCH 39/39] 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 9966ccb..9a1a7cd 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The [streams repository](https://codeberg.org/streams/streams/) lets you install Your websites will be compatible with **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** and many, many more. -**Shipped version:** 23.11.12~ynh1 +**Shipped version:** 23.11.14~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 5c6cbce..1e94555 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ Le [dépôt streams](https://codeberg.org/streams/streams/) vous permet d'instal Vos sites web seront compatibles avec **Mastodon**, **Pleroma**, **Pixelfed**, **Friendica**, **Hubzilla**, **Funkwhale**, **Peertube**, **Plume**, **WriteFreely** et bien d'autres encore. -**Version incluse :** 23.11.12~ynh1 +**Version incluse :** 23.11.14~ynh1 ## Captures d’écran