From 8d27dd88c49efc56bf983df313dc42af26c63a77 Mon Sep 17 00:00:00 2001 From: selfhoster1312 Date: Wed, 28 Aug 2024 17:23:20 +0200 Subject: Remove custom swap helpers ; use new upstream helpers --- scripts/install | 1 - scripts/remove | 1 - scripts/restore | 1 - scripts/upgrade | 1 - scripts/ynh_add_swap | 100 --------------------------------------------------- 5 files changed, 104 deletions(-) delete mode 100644 scripts/ynh_add_swap (limited to 'scripts') diff --git a/scripts/install b/scripts/install index 1385a30..1890e51 100644 --- a/scripts/install +++ b/scripts/install @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_add_swap source /usr/share/yunohost/helpers admin_mail=$(ynh_user_get_info --username=$admin --key=mail) diff --git a/scripts/remove b/scripts/remove index c8ca3a3..f5eca20 100644 --- a/scripts/remove +++ b/scripts/remove @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_add_swap source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/restore b/scripts/restore index 77e934b..92a20f0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,7 +8,6 @@ # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/ynh_add_swap source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c889e65..0bac752 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_add_swap source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) diff --git a/scripts/ynh_add_swap b/scripts/ynh_add_swap deleted file mode 100644 index aa82c51..0000000 --- a/scripts/ynh_add_swap +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash - -# Add swap -# -# usage: ynh_add_swap --size=SWAP in Mb -# | arg: -s, --size= - Amount of SWAP to add in Mb. -ynh_add_swap () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [s]=size= ) - local size - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - local swap_max_size=$(( $size * 1024 )) - - local free_space=$(df --output=avail / | sed 1d) - # Because we don't want to fill the disk with a swap file, divide by 2 the available space. - local usable_space=$(( $free_space / 2 )) - - SD_CARD_CAN_SWAP=${SD_CARD_CAN_SWAP:-0} - - # Can't swap inside an LXD - if [ "$(systemd-detect-virt)" == "lxc" ] - then - ynh_print_warn --message="You are inside a LXC container, swap will not be added, but that can cause troubles for the app $app. Please make sure you have more than 2.5G available RAM." - return - fi - - # Swap on SD card only if it's is specified - if ynh_is_main_device_a_sd_card && [ "$SD_CARD_CAN_SWAP" == "0" ] - then - ynh_print_warn --message="The main mountpoint of your system '/' is on an SD card, swap will not be added to prevent some damage of this one, but that can cause troubles for the app $app. If you still want activate the swap, you can relaunch the command preceded by 'SD_CARD_CAN_SWAP=1'" - return - fi - - # Compare the available space with the size of the swap. - # And set a acceptable size from the request - if [ $usable_space -ge $swap_max_size ] - then - local swap_size=$swap_max_size - elif [ $usable_space -ge $(( $swap_max_size / 2 )) ] - then - local swap_size=$(( $swap_max_size / 2 )) - elif [ $usable_space -ge $(( $swap_max_size / 3 )) ] - then - local swap_size=$(( $swap_max_size / 3 )) - elif [ $usable_space -ge $(( $swap_max_size / 4 )) ] - then - local swap_size=$(( $swap_max_size / 4 )) - else - echo "Not enough space left for a swap file" >&2 - local swap_size=0 - fi - - # If there's enough space for a swap, and no existing swap here - if [ $swap_size -ne 0 ] && [ ! -e /swap_$app ] - then - # Preallocate space for the swap file, fallocate may sometime not be used, use dd instead in this case - if ! fallocate -l ${swap_size}K /swap_$app - then - dd if=/dev/zero of=/swap_$app bs=1024 count=${swap_size} - fi - chmod 0600 /swap_$app - # Create the swap - mkswap /swap_$app - # And activate it - swapon /swap_$app - # Then add an entry in fstab to load this swap at each boot. - echo -e "/swap_$app swap swap defaults 0 0 #Swap added by $app" >> /etc/fstab - fi -} - -ynh_del_swap () { - # If there a swap at this place - if [ -e /swap_$app ] - then - # Clean the fstab - sed -i "/#Swap added by $app/d" /etc/fstab - # Desactive the swap file - swapoff /swap_$app - # And remove it - rm /swap_$app - fi -} - -# Check if the device of the main mountpoint "/" is an SD card -# -# [internal] -# -# return 0 if it's an SD card, else 1 -ynh_is_main_device_a_sd_card () { - local main_device=$(lsblk --output PKNAME --noheadings $(findmnt / --nofsroot --uniq --output source --noheadings --first-only)) - - if echo $main_device | grep --quiet "mmc" && [ $(tail -n1 /sys/block/$main_device/queue/rotational) == "0" ] - then - return 0 - else - return 1 - fi -} -- cgit v1.2.3-70-g09d2 From 4976431397f6e9824526276bdd94d62cefb3548a Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Sat, 30 Aug 2025 14:41:25 +0200 Subject: ruby and nodejs resources --- manifest.toml | 9 ++++++++- scripts/_common.sh | 2 -- scripts/install | 8 -------- scripts/remove | 4 ---- scripts/restore | 8 -------- scripts/upgrade | 8 -------- 6 files changed, 8 insertions(+), 31 deletions(-) (limited to 'scripts') diff --git a/manifest.toml b/manifest.toml index 7f0b634..152433a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,7 +19,7 @@ cpe = "cpe:2.3:a:joinmastodon:mastodon" fund = "https://joinmastodon.org/sponsors" [integration] -yunohost = ">= 12.0.10" +yunohost = ">= 12.1.15" helpers_version = "2.1" architectures = "all" multi_instance = true @@ -87,3 +87,10 @@ ram.runtime = "500M" [resources.database] type = "postgresql" + + [resources.nodejs] + version = "20" + + [resources.ruby] + version = "3.4.5" + diff --git a/scripts/_common.sh b/scripts/_common.sh index 182e391..c7ff983 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,8 +5,6 @@ #================================================= memory_needed="2560" -ruby_version=3.4.5 -nodejs_version=20 case $YNH_ARCH in amd64) diff --git a/scripts/install b/scripts/install index 7e400d5..38395c5 100644 --- a/scripts/install +++ b/scripts/install @@ -8,14 +8,6 @@ admin_mail=$(ynh_user_get_info --username=$admin --key=mail) # Set `service` settings to support `yunohost app shell` command ynh_app_setting_set --key=service --value="$app-web.service" -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression "Installing Ruby and NodeJS..." - -ynh_ruby_install -ynh_nodejs_install - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= diff --git a/scripts/remove b/scripts/remove index 297786f..e97be10 100644 --- a/scripts/remove +++ b/scripts/remove @@ -44,10 +44,6 @@ ynh_safe_rm "/etc/cron.d/$app" # Remote logrotate config ynh_config_remove_logrotate -# Remove metapackage and its dependencies -ynh_ruby_remove -ynh_nodejs_remove - # Remove swap ynh_del_swap diff --git a/scripts/restore b/scripts/restore index 0becd6c..2abaa4d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -39,14 +39,6 @@ ynh_script_progression "Adding $swap_needed Mo to swap..." ynh_add_swap --size=$swap_needed -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression "Reinstalling Ruby and NodeJS..." - -ynh_ruby_install -ynh_nodejs_install - #================================================= # BUILD APP #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 769b47c..1d28afd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,14 +46,6 @@ fi ynh_script_progression "Adding $swap_needed Mo to swap..." ynh_add_swap --size=$swap_needed -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression "Upgrading Ruby and NodeJS..." - -ynh_ruby_install -ynh_nodejs_install - #================================================= # "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) #================================================= -- cgit v1.2.3-70-g09d2 From d8854f4e663f6a24771bb2d1e1f78c8ff09ccfc1 Mon Sep 17 00:00:00 2001 From: eric_G <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:33:12 +0200 Subject: Update _common.sh --- scripts/_common.sh | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'scripts') diff --git a/scripts/_common.sh b/scripts/_common.sh index c7ff983..0ad6190 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,21 +5,3 @@ #================================================= memory_needed="2560" - -case $YNH_ARCH in - amd64) - ld_preload="LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so" - ;; - arm64) - ld_preload="LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libjemalloc.so" - ;; - armhf) - ld_preload="LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libjemalloc.so" - ;; - armel) - ld_preload="LD_PRELOAD=/usr/lib/arm-linux-gnueabi/libjemalloc.so" - ;; - i386) - ld_preload="LD_PRELOAD=/usr/lib/i386-linux-gnu/libjemalloc.so" - ;; -esac -- cgit v1.2.3-70-g09d2 From ca0f40885c7c8178161672bd369040dbc52208f5 Mon Sep 17 00:00:00 2001 From: eric_G <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 24 Sep 2025 23:00:38 +0200 Subject: cleaning --- conf/nginx.conf | 3 --- scripts/backup | 2 -- 2 files changed, 5 deletions(-) (limited to 'scripts') diff --git a/conf/nginx.conf b/conf/nginx.conf index 09e4a84..287d1d7 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -6,9 +6,6 @@ location / { proxy_set_header Accept-Encoding ""; try_files $uri @proxy; - - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; } location ~ /sw.js { diff --git a/scripts/backup b/scripts/backup index e9b18e8..5172032 100644 --- a/scripts/backup +++ b/scripts/backup @@ -18,8 +18,6 @@ ynh_backup "$install_dir" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# SPECIFIC BACKUP #================================================= # BACKUP LOGROTATE #================================================= -- cgit v1.2.3-70-g09d2