1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/searxng_ynh.git synced 2024-09-03 20:26:00 +02:00

Move settings to install_dir

This commit is contained in:
ewilly 2023-09-27 22:08:09 +02:00
parent 96136d7bcb
commit edf4e8fc69
8 changed files with 16 additions and 49 deletions

View file

@ -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

View file

@ -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 = "/"

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]