From ac9d372699c7284e2238ef19e9f0c7875c3cb532 Mon Sep 17 00:00:00 2001 From: OniriCorpe Date: Wed, 13 Mar 2024 21:16:29 +0100 Subject: [PATCH] add libjemalloc for better performances --- manifest.toml | 3 ++- scripts/install | 4 ++++ scripts/upgrade | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 6cca2ee..b1d1a4b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -118,7 +118,8 @@ ram.runtime = "200M" [resources.apt] packages = ["coturn", "acl", "postgresql", "php-fpm", "python3-dev", "python3-venv", "python3-pip", "python3-setuptools", "python3-lxml", - "build-essential", "libffi-dev", "libssl-dev", "libxml2-dev", "libxslt1-dev", "zlib1g-dev", "libjpeg-dev", "libpq-dev"] + "build-essential", "libffi-dev", "libssl-dev", "libxml2-dev", "libxslt1-dev", + "zlib1g-dev", "libjpeg-dev", "libpq-dev", "libjemalloc-dev"] [resources.database] type = "postgresql" diff --git a/scripts/install b/scripts/install index 8aa7a78..3eb3cfa 100644 --- a/scripts/install +++ b/scripts/install @@ -196,6 +196,10 @@ ynh_add_systemd_config --service=$app --template=synapse.service cp ../conf/default_coturn /etc/default/coturn-$app ynh_add_systemd_config --service=$app-coturn --template=synapse-coturn.service +# add libjemalloc.so to the matrix-synapse env file +libjemalloc_path=$(whereis libjemalloc | cut -d ' ' -f 3) +echo "LD_PRELOAD=$libjemalloc_path" >> "/etc/default/matrix-$app" + #================================================= # NGINX CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index ada47aa..c50309c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -466,6 +466,12 @@ ynh_add_systemd_config --service=$app --template=synapse.service cp ../conf/default_coturn /etc/default/coturn-$app ynh_add_systemd_config --service=$app-coturn --template=synapse-coturn.service +# if necessary, add libjemalloc.so to the matrix-synapse env file +if ! grep -q "libjemalloc" "/etc/default/matrix-$app"; then + libjemalloc_path=$(whereis libjemalloc | cut -d ' ' -f 3) + echo "LD_PRELOAD=$libjemalloc_path" >> "/etc/default/matrix-$app" +fi + #================================================= # UPGRADE FAIL2BAN #=================================================