diff --git a/README.md b/README.md index b2cf8e4..4a7c6c9 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in The Standard Notes syncing server. An end-to-end encrypted note-taking app. -**Shipped version:** 2021.07.24~ynh3 +**Shipped version:** 2021.08.30~ynh1 **Demo:** https://standardnotes.org/demo @@ -25,9 +25,10 @@ The Standard Notes syncing server. An end-to-end encrypted note-taking app. * Any known limitations, constrains or stuff not working, such as (but not limited to): * No single-sign on or LDAP integration - * The app requires at least 450MB of RAM to work properly. - * The app requires at least 650MB of RAM to start. - * The app requires around 1800MB of disk. + * Ram requirements (Swap memory will be created during install): + * The app requires at least 800MB of RAM to work properly. + * The app requires at least 1000MB of RAM to start. + * The app requires at least 1500MB of RAM to install. * Other infos that people should be aware of, such as: * The ".env" config-files are stored under "/opt/yunohost/$app/live/" diff --git a/README_fr.md b/README_fr.md index 572842f..ee5d8e3 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour -**Version incluse :** 2021.07.24~ynh3 +**Version incluse :** 2021.08.30~ynh1 **Démo :** https://standardnotes.org/demo @@ -21,9 +21,10 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour * Any known limitations, constrains or stuff not working, such as (but not limited to): * No single-sign on or LDAP integration - * The app requires at least 450MB of RAM to work properly. - * The app requires at least 650MB of RAM to start. - * The app requires around 1800MB of disk. + * Ram requirements (Swap memory will be created during install): + * The app requires at least 800MB of RAM to work properly. + * The app requires at least 1000MB of RAM to start. + * The app requires at least 1500MB of RAM to install. * Other infos that people should be aware of, such as: * The ".env" config-files are stored under "/opt/yunohost/$app/live/" diff --git a/check_process b/check_process index 0c0de44..b6d90c3 100644 --- a/check_process +++ b/check_process @@ -15,18 +15,10 @@ setup_private=0 setup_public=1 upgrade=1 + # 2021.07.24~yhn3 + upgrade=1 from_commit=426dd68db71fda8aa61269928bd991c0f17feb3f # 3.22.8~yhn2 upgrade=1 from_commit=b0c7e9e6f16d286ec74fa3c1b9cdf8492f4dcb9b - # 3.22.8~yhn1 - #upgrade=1 from_commit=c9ea83e8102affd5ca74a6d438920fa40af4a63e - # 3.20.5~ynh2 - #upgrade=1 from_commit=e8db15c97db16f68d6453970a9dff74d5136017b - # 3.13.6~ynh4 - #upgrade=1 from_commit=bdb0c5049c8eacbef68059d2821353d0e0345290 - # 3.13.6~ynh2 - #upgrade=1 from_commit=e755357f8306805084317c81e85807ed87fdbd47 - # 3.13.6~ynh1 - #upgrade=1 from_commit=7474baadc1705ffe5981a52bdced16bdd1edf979 backup_restore=1 multi_instance=1 port_already_use=0 diff --git a/conf/app_api-gateway.src b/conf/app_api-gateway.src index 6ead746..7d7f51d 100644 --- a/conf/app_api-gateway.src +++ b/conf/app_api-gateway.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/standardnotes/api-gateway/archive/1.20.5.tar.gz -SOURCE_SUM=758F4ADC30CC16BA19BDDE50151F41AF868E7931886E3DBB42B6F4CBE86B7F7B +SOURCE_URL=https://github.com/standardnotes/api-gateway/archive/1.24.0.tar.gz +SOURCE_SUM=97EF89B8951448BB7B34D0B9A30DB242E23808EF1FFC5B154CC1C823965A8B39 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/app_auth.src b/conf/app_auth.src index 38d6b65..dafdbbc 100644 --- a/conf/app_auth.src +++ b/conf/app_auth.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/standardnotes/auth/archive/1.13.2.tar.gz -SOURCE_SUM=ABFC20349D04A68B86226B6D479D2085D4224138CD2CA6E78A9A81F3D00A51B5 +SOURCE_URL=https://github.com/standardnotes/auth/archive/1.17.4.tar.gz +SOURCE_SUM=a9d8a8db89c16b2f251d85135a70c2eee9d9b7c228be8a0322a9dd68acbce8b4 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/app_syncing-server-js.src b/conf/app_syncing-server-js.src index 63191df..0768ebb 100644 --- a/conf/app_syncing-server-js.src +++ b/conf/app_syncing-server-js.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/standardnotes/syncing-server-js/archive/1.36.1.tar.gz -SOURCE_SUM=5FC8B36A6D8C63E2FAD6991C60CDDF227FCE71E70D4EB75F19109FACD4027951 +SOURCE_URL=https://github.com/standardnotes/syncing-server-js/archive/1.38.9.tar.gz +SOURCE_SUM=80f3d3386457328ce2ed51ba0f41f859f9ba3fe65cf0ac0bb36d6116f16872c6 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/env_api-gateway.env.sample b/conf/env_api-gateway.env.sample index c906aa0..fd2c24b 100644 --- a/conf/env_api-gateway.env.sample +++ b/conf/env_api-gateway.env.sample @@ -2,6 +2,7 @@ __YNH_NODE_LOAD_PATH__ LOG_LEVEL="info" NODE_ENV="production" +VERSION="production" PORT="__PORT_API_GATEWAY__" diff --git a/conf/env_auth-worker.env.sample b/conf/env_auth-worker.env.sample index 1c431cd..161700d 100644 --- a/conf/env_auth-worker.env.sample +++ b/conf/env_auth-worker.env.sample @@ -2,6 +2,7 @@ __YNH_NODE_LOAD_PATH__ LOG_LEVEL="info" NODE_ENV="production" +VERSION="production" JWT_SECRET=__JWT_SECRET__ LEGACY_JWT_SECRET=__LEGACY_JWT_SECRET__ @@ -57,3 +58,6 @@ NEW_RELIC_NO_CONFIG_FILE=true NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=false NEW_RELIC_LOG_ENABLED=false NEW_RELIC_LOG_LEVEL=info + +# (Optional) Extensions Server +EXTENSION_SERVER_URL= diff --git a/conf/env_auth.env.sample b/conf/env_auth.env.sample index dd6b31e..3f2ed0b 100644 --- a/conf/env_auth.env.sample +++ b/conf/env_auth.env.sample @@ -2,6 +2,7 @@ __YNH_NODE_LOAD_PATH__ LOG_LEVEL="info" NODE_ENV="production" +VERSION="production" JWT_SECRET=__JWT_SECRET__ LEGACY_JWT_SECRET=__LEGACY_JWT_SECRET__ @@ -57,3 +58,6 @@ NEW_RELIC_NO_CONFIG_FILE=true NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=false NEW_RELIC_LOG_ENABLED=false NEW_RELIC_LOG_LEVEL=info + +# (Optional) Extensions Server +EXTENSION_SERVER_URL= diff --git a/conf/env_syncing-server-js-worker.env.sample b/conf/env_syncing-server-js-worker.env.sample index a441e14..92527df 100644 --- a/conf/env_syncing-server-js-worker.env.sample +++ b/conf/env_syncing-server-js-worker.env.sample @@ -2,6 +2,7 @@ __YNH_NODE_LOAD_PATH__ LOG_LEVEL="info" NODE_ENV="production" +VERSION="production" AUTH_JWT_SECRET=__AUTH_JWT_SECRET__ diff --git a/conf/env_syncing-server-js.env.sample b/conf/env_syncing-server-js.env.sample index 0894d75..3df2c23 100644 --- a/conf/env_syncing-server-js.env.sample +++ b/conf/env_syncing-server-js.env.sample @@ -2,6 +2,7 @@ __YNH_NODE_LOAD_PATH__ LOG_LEVEL="info" NODE_ENV="production" +VERSION="production" AUTH_JWT_SECRET=__AUTH_JWT_SECRET__ diff --git a/conf/ext_bold-editor.src b/conf/ext_bold-editor.src index da0e162..5f14968 100644 --- a/conf/ext_bold-editor.src +++ b/conf/ext_bold-editor.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/standardnotes/bold-editor/archive/1.2.1.zip -SOURCE_SUM=7bae5d62d0d49fe199f2a204317e23906e138072db4a8c2569a2479a42d2c357 +SOURCE_URL=https://github.com/standardnotes/bold-editor/archive/1.2.2.zip +SOURCE_SUM=2831f0fd4abed6562b860e558968388a398f691602a82795b10a13e897c3af2e SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/conf/ext_mfa-link.src b/conf/ext_mfa-link.src index 6827557..08edbd9 100644 --- a/conf/ext_mfa-link.src +++ b/conf/ext_mfa-link.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/standardnotes/mfa-link/archive/1.2.4.zip -SOURCE_SUM=d384b8927eafc009022c15d9488e67f0e11672c7b5c90f2318b4cb15b0c81c6a +SOURCE_URL=https://github.com/standardnotes/mfa-link/archive/1.2.5.zip +SOURCE_SUM=f5f5221fa3cf53bf5ee94e60a5adb7a455d1ee46fabe8b0ef13e085f4098cbc8 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index ac76b46..4a9f0a3 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,8 +1,9 @@ * Any known limitations, constrains or stuff not working, such as (but not limited to): * No single-sign on or LDAP integration - * The app requires at least 450MB of RAM to work properly. - * The app requires at least 650MB of RAM to start. - * The app requires around 1800MB of disk. + * Ram requirements (Swap memory will be created during install): + * The app requires at least 800MB of RAM to work properly. + * The app requires at least 1000MB of RAM to start. + * The app requires at least 1500MB of RAM to install. * Other infos that people should be aware of, such as: * The ".env" config-files are stored under "/opt/yunohost/$app/live/" diff --git a/manifest.json b/manifest.json index 25f16c6..834db58 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "description": { "en": "The Standard Notes syncing server. An end-to-end encrypted note-taking app." }, - "version": "2021.07.24~ynh3", + "version": "2021.08.30~ynh1", "url": "https://github.com/standardnotes/standalone", "upstream": { "license": "AGPL-3.0-or-later", diff --git a/scripts/_common.sh b/scripts/_common.sh index ab6a76d..1ce0d10 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,10 +6,12 @@ RUBY_VERSION="2.7.3" NODEJS_VERSION="15.11.0" -syncing_server_js_version="1.36.1" -auth_version="1.13.2" -api_gateway_version="1.20.5" -extensions_version="2021.07.06" +syncing_server_js_version="1.38.9" +auth_version="1.17.4" +api_gateway_version="1.24.0" +extensions_version="2021.08.27" + +swap_needed=1536 # dependencies used by the app pkg_dependencies="" diff --git a/scripts/install b/scripts/install index 3b023df..900b0b9 100755 --- a/scripts/install +++ b/scripts/install @@ -7,6 +7,7 @@ #================================================= source _common.sh +source ynh_add_swap source ynh_install_ruby__2 source ynh_redis source ynh_send_readme_to_admin__2 @@ -162,6 +163,13 @@ ynh_add_nginx_config #================================================= # SPECIFIC SETUP #================================================= +#================================================= +# ADD SWAP +#================================================= +ynh_script_progression --message="Adding swap..." + +ynh_add_swap --size=$swap_needed + #================================================= # MODIFY A CONFIG FILE #================================================= diff --git a/scripts/remove b/scripts/remove index e515606..fa0ca98 100755 --- a/scripts/remove +++ b/scripts/remove @@ -7,6 +7,7 @@ #================================================= source _common.sh +source ynh_add_swap source ynh_install_ruby__2 source ynh_redis source /usr/share/yunohost/helpers @@ -135,6 +136,12 @@ ynh_remove_fail2ban_config #================================================= # SPECIFIC REMOVE #================================================= +#================================================= +# REMOVE SWAP +#================================================= +ynh_script_progression --message="Removing swap..." + +ynh_del_swap #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index b78f163..1847ba0 100755 --- a/scripts/restore +++ b/scripts/restore @@ -8,6 +8,7 @@ #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 ../settings/scripts/ynh_install_ruby__2 source ../settings/scripts/ynh_redis source /usr/share/yunohost/helpers @@ -115,6 +116,14 @@ chown -R $app: "/var/log/$app" #================================================= # SPECIFIC RESTORATION +#================================================= +#================================================= +# ADD SWAP +#================================================= +ynh_script_progression --message="Adding swap..." + +ynh_add_swap --size=$swap_needed + #================================================= # REINSTALL DEPENDENCIES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4efee1f..3867953 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,6 +7,7 @@ #================================================= source _common.sh +source ynh_add_swap source ynh_install_ruby__2 source ynh_redis source ynh_send_readme_to_admin__2 @@ -381,6 +382,13 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st #================================================= # SPECIFIC UPGRADE #================================================= +#================================================= +# ADD SWAP +#================================================= +ynh_script_progression --message="Adding swap..." + +ynh_add_swap --size=$swap_needed + #================================================= # MODIFY A CONFIG FILE #================================================= diff --git a/scripts/ynh_add_swap b/scripts/ynh_add_swap new file mode 100644 index 0000000..4fe18d8 --- /dev/null +++ b/scripts/ynh_add_swap @@ -0,0 +1,94 @@ +#!/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} + + # 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 +} + diff --git a/sources/extra_files/extensions/repo.json b/sources/extra_files/extensions/repo.json index fc754ff..a24cb0d 100644 --- a/sources/extra_files/extensions/repo.json +++ b/sources/extra_files/extensions/repo.json @@ -137,12 +137,12 @@ "area": "editor-editor", "content_type": "SN|Component", "description": "A simple and peaceful rich editor that helps you write and think clearly. Features FileSafe integration, so you can embed your images, videos, and audio recordings directly inline.", - "download_url": "https://github.com/standardnotes/bold-editor/archive/1.2.1.zip", + "download_url": "https://github.com/standardnotes/bold-editor/archive/1.2.2.zip", "identifier": "org.standardnotes.bold-editor", "latest_url": "https://__DOMAIN__PATH__/extensions/src/bold-editor.json", "name": "Bold Editor", "url": "https://__DOMAIN__PATH__/extensions/src/bold-editor/dist/index.html", - "version": "1.2.1" + "version": "1.2.2" }, { "area": "editor-editor", @@ -280,12 +280,12 @@ "area": "modal", "content_type": "SN|Component", "description": "Set up 2FA to enable an extra layer of security on your private notes account.", - "download_url": "https://github.com/standardnotes/mfa-link/archive/1.2.4.zip", + "download_url": "https://github.com/standardnotes/mfa-link/archive/1.2.5.zip", "identifier": "org.stndardnotes.mfa-link", "latest_url": "https://__DOMAIN__PATH__/extensions/src/mfa-link.json", "name": "MFA-Link", "url": "https://__DOMAIN__PATH__/extensions/src/mfa-link/dist/index.html", - "version": "1.2.4" + "version": "1.2.5" }, { "area": "note-tags", diff --git a/sources/extra_files/extensions/src/bold-editor.json b/sources/extra_files/extensions/src/bold-editor.json index 6aba090..094c047 100644 --- a/sources/extra_files/extensions/src/bold-editor.json +++ b/sources/extra_files/extensions/src/bold-editor.json @@ -3,9 +3,9 @@ "name": "Bold Editor", "content_type": "SN|Component", "area": "editor-editor", - "version": "1.2.1", + "version": "1.2.2", "description": "A simple and peaceful rich editor that helps you write and think clearly. Features FileSafe integration, so you can embed your images, videos, and audio recordings directly inline.", "url": "https://__DOMAIN__PATH__/extensions/src/bold-editor/dist/index.html", - "download_url": "https://github.com/standardnotes/bold-editor/archive/1.2.1.zip", + "download_url": "https://github.com/standardnotes/bold-editor/archive/1.2.2.zip", "latest_url": "https://__DOMAIN__PATH__/extensions/src/bold-editor.json" } diff --git a/sources/extra_files/extensions/src/mfa-link.json b/sources/extra_files/extensions/src/mfa-link.json index 5433514..d3e625e 100644 --- a/sources/extra_files/extensions/src/mfa-link.json +++ b/sources/extra_files/extensions/src/mfa-link.json @@ -3,9 +3,9 @@ "name": "MFA-Link", "content_type": "SN|Component", "area": "editor-stack", - "version": "1.2.4", + "version": "1.2.5", "description": "Set up 2FA to enable an extra layer of security on your private notes account.", "url": "https://__DOMAIN__PATH__/extensions/src/mfa-link/dist/index.html", - "download_url": "https://github.com/sn-extensions/mfa-link/archive/1.2.4.zip", + "download_url": "https://github.com/sn-extensions/mfa-link/archive/1.2.5.zip", "latest_url": "https://__DOMAIN__PATH__/extensions/src/mfa-link.json" }