1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/meilisearch_ynh.git synced 2024-09-03 19:45:59 +02:00
This commit is contained in:
Éric Gaspar 2024-09-03 09:31:08 +02:00
parent 2a44eb02e9
commit db7bd26d45
5 changed files with 4 additions and 55 deletions

View file

@ -1,6 +1,5 @@
#!/bin/bash
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -18,16 +17,8 @@ ynh_backup "$install_dir"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup "/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/$app.service"
#=================================================

View file

@ -8,11 +8,8 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
chmod +x "$install_dir/meilisearch"
#=================================================
@ -20,13 +17,10 @@ chmod +x "$install_dir/meilisearch"
#=================================================
ynh_script_progression "Configuring NGINX web server..."
# Create a dedicated nginx config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
# Use logrotate to manage application logfile(s)
ynh_config_add_logrotate
yunohost service add $app --description="Opensource next generation search API" --log="/var/log/$app/$app.log"
@ -42,9 +36,6 @@ key=$(ynh_string_random --length=16)
ynh_config_add --template="config.toml" --destination="$install_dir/config.toml"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config.toml"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config.toml"
#=================================================
# START SYSTEMD SERVICE
#=================================================

View file

@ -9,20 +9,16 @@ source /usr/share/yunohost/helpers
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
if ynh_hide_warnings yunohost service status $app >/dev/null
then
ynh_script_progression "Removing Meilisearch service..."
yunohost service remove $app
fi
# Remove the dedicated systemd config
ynh_config_remove_systemd
# Remove the dedicated NGINX config
ynh_config_remove_nginx
# Remove the app-specific logrotate config
ynh_config_remove_logrotate
#=================================================

View file

@ -1,17 +1,8 @@
#!/bin/bash
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -19,8 +10,6 @@ ynh_script_progression "Restoring Meilisearch main directory..."
ynh_restore "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# SPECIFIC RESTORATION
#=================================================
@ -28,6 +17,8 @@ ynh_restore "$install_dir"
#=================================================
ynh_script_progression "Restoring $app's systemd service..."
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet

View file

@ -3,12 +3,6 @@
source _common.sh
source /usr/share/yunohost/helpers
if ynh_app_upgrading_from_version_before 1.1.0~ynh1; then
ynh_die "Please remove and reinstall Meilisearch"
else
fi
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
@ -19,18 +13,10 @@ ynh_systemctl --service=$app --action="stop"
#=================================================
# UPGRADING MEILISEARCH
#=================================================
ynh_script_progression "Upgrading source files..."
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
then
ynh_script_progression "Upgrading source files..."
ynh_setup_source --dest_dir="$install_dir" --keep="$install_dir/config.toml"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="$install_dir/config.toml"
fi
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
chmod +x "$install_dir/meilisearch"
#=================================================
@ -38,13 +24,10 @@ chmod +x "$install_dir/meilisearch"
#=================================================
ynh_script_progression "Configuring $app's systemd service..."
# Create a dedicated NGINX config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
# Use logrotate to manage app-specific logfile(s)
ynh_config_add_logrotate
yunohost service add $app --description="Opensource next generation search API" --log="/var/log/$app/$app.log"
@ -58,9 +41,6 @@ key=$(ynh_string_random --length=16)
ynh_config_add --template="config.toml" --destination="$install_dir/config.toml"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config.toml"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config.toml"
#=================================================
# START SYSTEMD SERVICE
#=================================================