From edf4e8fc69514c46ed22f9f0be3ca7d8e595d529 Mon Sep 17 00:00:00 2001 From: ewilly Date: Wed, 27 Sep 2023 22:08:09 +0200 Subject: [PATCH] Move settings to install_dir --- conf/uwsgi.ini | 2 +- manifest.toml | 7 ++----- scripts/backup | 6 ------ scripts/install | 25 ++++++------------------- scripts/restore | 10 ---------- scripts/upgrade | 11 +++++++---- sources/extra_files/app/.gitignore | 2 -- sources/patches/.gitignore | 2 -- 8 files changed, 16 insertions(+), 49 deletions(-) delete mode 100644 sources/extra_files/app/.gitignore delete mode 100644 sources/patches/.gitignore diff --git a/conf/uwsgi.ini b/conf/uwsgi.ini index 7c637ea..d4cfa45 100644 --- a/conf/uwsgi.ini +++ b/conf/uwsgi.ini @@ -23,7 +23,7 @@ env = LC_ALL=C.UTF-8 chdir = __INSTALL_DIR__/searxng-src/searx # SearXNG configuration (settings.yml) -env = SEARXNG_SETTINGS_PATH=__DATA_DIR__/settings.yml +env = SEARXNG_SETTINGS_PATH=__INSTALL_DIR__/settings.yml # disable logging for privacy disable-logging = true diff --git a/manifest.toml b/manifest.toml index d3a1c3f..bc416db 100644 --- a/manifest.toml +++ b/manifest.toml @@ -24,8 +24,8 @@ multi_instance = false ldap = "not_relevant" sso = "not_relevant" disk = "210M" -ram.build = "50M" -ram.runtime = "50M" +ram.build = "250M" +ram.runtime = "200M" [install] [install.domain] @@ -45,9 +45,6 @@ ram.runtime = "50M" [resources.install_dir] dir = "/var/www/__APP__" - [resources.data_dir] - dir = "/home/yunohost.app/__APP__" - [resources.permissions] main.url = "/" diff --git a/scripts/backup b/scripts/backup index 4aa95de..a40341f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -20,12 +20,6 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" -#================================================= -# BACKUP THE DATA DIR -#================================================= - -ynh_backup --src_path="$data_dir" --is_big - #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index a630188..71cfebc 100755 --- a/scripts/install +++ b/scripts/install @@ -28,22 +28,15 @@ set +o nounset; source "$install_dir/searxng-pyenv/bin/activate"; set -o nounset pip3 install -U pip setuptools wheel pyyaml --no-cache-dir ynh_exec_fully_quiet pip3 install -e "$install_dir/searxng-src" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app: "$install_dir" - #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - ynh_add_nginx_config +ynh_add_uwsgi_service + #================================================= # APP INITIAL CONFIGURATION #================================================= @@ -52,17 +45,11 @@ ynh_add_nginx_config ynh_script_progression --message="Adding a configuration file..." --weight=1 secret_key=$(ynh_string_random) -ynh_add_config --template="../conf/settings.yml" --destination="$data_dir/settings.yml" +ynh_add_config --template="../conf/settings.yml" --destination="$install_dir/settings.yml" -chmod 400 "$data_dir/settings.yml" -chown $app: "$data_dir" - -#================================================= -# CONFIGURE UWSGI FOR SEARX -#================================================= -ynh_script_progression --message="Configuring uWSGI for SearXNG..." --weight=2 - -ynh_add_uwsgi_service +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app: "$install_dir" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index 88f791e..1ac85c5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -20,16 +20,6 @@ chown -R $app:www-data "$install_dir" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" -#================================================= -# RESTORE THE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Restoring the data directory..." --weight=1 - -ynh_restore_file --origin_path="$data_dir" --not_mandatory - -# (Same as for install dir) -chown -R $app:www-data "$data_dir" - #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 68f840b..d26e0ab 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,11 +18,14 @@ upgrade_type=$(ynh_check_app_version_changed) ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 if [ -e "$install_dir/searx" ]; then - sed -i '1s/^/use_default_settings: true\n\n/' "$install_dir/searx/settings.yml" - mv "$install_dir/searx/settings.yml" "$data_dir/settings.yml" - chmod 400 "$data_dir/settings.yml" - chown $app: "$data_dir" + tempdir="$(mktemp -d)" + mv "$install_dir/searx/settings.yml" "$tempdir/settings.yml" + sed -i '1s/^/use_default_settings: true\n\n/' "$tempdir/settings.yml" ynh_secure_remove --file="$install_dir" + mkdir "$install_dir" + mv "$tempdir/settings.yml" "$install_dir/settings.yml" + ynh_secure_remove --file="$tempdir" + ynh_store_file_checksum --file="$install_dir/settings.yml" ynh_delete_file_checksum --file="/opt/yunohost/$app/searx/settings.yml" fi diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/extra_files/app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] diff --git a/sources/patches/.gitignore b/sources/patches/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/patches/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op]